[CMake] How the heck does one set options?

Dan Kegel dank at kegel.com
Thu Nov 3 15:20:19 EDT 2011


Thanks for the authoritative answer.

I'm now using

SET(gtest_force_shared_crt on CACHE BOOL
  "Use shared (DLL) run-time lib even when Google Test is built as static lib.")
add_subdirectory(gtest)
include_directories(gtest/include)
add_executable(mymain mymain.cpp)
target_link_libraries(mymain gtest_main)

in my test app, and it's working with visual c++ 2008 (will try linux shortly).

I confess, I've been putting off understanding cmake's variable scoping
and caching; I guess I'll have to pay more attention to it.
I hope the library of worked examples I'm putting together at
http://code.google.com/p/winezeug/source/browse/#svn/trunk/cmake_examples
will eventually help other doc-o-phobes come up the curve faster.
- Dan


More information about the CMake mailing list