How do I add a configuration variable to my CMake

2019-03-14 07:03发布

问题:

I'd like to add a variable that the user must set after clicking "Configure" in cmake-gui. Is there a way to do this?

回答1:

Using the set command, specify CACHE parameters, e.g.

set(NAME_INCLUDE "default value" CACHE FILEPATH "description")
set(NAME_LIB "default value" CACHE FILEPATH "description")

In the GUI CMake will group all variables with the same prefix.

See the CMake documentation for set.



标签: cmake