[CMake] How the heck does one set options?

Tim Gallagher tim.gallagher at gatech.edu
Wed Nov 2 21:21:42 EDT 2011


Using set() as you have done only sets the value in the current scoping unit. If you did:

set(gtest_force_shared_crt ON CACHE INTERNAL "")

then it will be set to ON and hidden from the GUI display.

If it will always be a bool and you want it displayed on the GUI, you can also do:

option(gtest_force_shared_crt ON)

Tim

----- Original Message -----
From: "Dan Kegel" <dank at kegel.com>
To: cmake at cmake.org
Sent: Wednesday, November 2, 2011 9:14:19 PM
Subject: [CMake] How the heck does one set options?

Right, so, I have this fragment:

set(gtest_force_shared_crt ON)
add_subdirectory(gtest)

Oddly, when I run cmake, that variable is off.  WTF?

Looking at the cache, I see

build/CMakeCache.txt:gtest_force_shared_crt:BOOL=OFF

It looks like someone else ran into this before,
http://www.mail-archive.com/cmake@cmake.org/msg20930.html

What am I missing?  Surely it can't be this hard to set options...
- Dan
--

Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list