[CMake] Problem while setting variables in CMakeCache

James Bigler jamesbigler at gmail.com
Tue Sep 7 15:20:20 EDT 2010


>> set(VAR_FOR_TEST "secondValue" CACHE STRING "Just for testing" FORCE)
>> find_package(CUDA)
>
> thanks for your reply, I implemented your first suggestion and this
> works perfectly.

I miss-typed that set command above.  I needed to leave outthe FORCE
flag.  This will initialize VAR_FOR_TEST to your initial value making
the set command in find_package have no effect.  This will also allow
users to change the value in the GUI, because subsequent runs of cmake
will not forcibly change the value in the cache.

set(CUDA_NVCC_FLAGS "-arch;sm_20" CACHE STRING "Flags for nvcc")
find_package(CUDA)

James


More information about the CMake mailing list