Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 specify options and handling it with 'set' or 'property' in cmake file ?

like image 477
Reddy Avatar asked Jul 22 '11 08:07

Reddy


1 Answers

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.

like image 150
Like Avatar answered Nov 22 '22 15:11

Like