How do I specify build options for CMake-based projects?
I don't understand how to configure project and handling command line options using CMake. I need to set variables of directories of 3rd party library (for example Poco and GTest). Usual, i just run ./configure with necessary parameters. For example:
./configure --poco-inc=~/libs/poco/include --poco-lib=~/libs/poco/lib --gtest-inc=~/libs/gtest/include --gtest-lib=~/libs/gtest/lib
But how do I pass the equivalent information to CMake ? How to spec开发者_运维问答ify options and handling it with 'set' or 'property' in cmake file ?
Additionally, you can use OPTION command
option(<option_variable> "help string describing option" [initial value])
See also
http://cmake.org/cmake/help/v2.8.10/cmake.html#command:option
The options are defined by cmake command line arguments
-D<variable-name>=<value>
You can also use
cmake -LH
to display the options and their help messages.
精彩评论