How to set $PATH for try_compile runs, and during build?

Gary Oberbrunner
Fri, 01 Mar 2024 18:13:28 +0000
Usage

I’m trying to use CUDA with clang-cl (or just plain cl.exe) on Windows, using Mark Schofield’s Windows toolchain. The toolchain finds cl.exe, but then when CMake tries to find CUDA it fails, because nvcc can’t find compiler cl.exe in $PATH.

I think the same thing happens at build time, because cmake doesn’t set $PATH before invoking ninja.

How can I set my project up so cl.exe is on $PATH both while reading the CMakefiles and when running the build?

5 posts - 4 participants