Adding command line options to CMake
Just a little correction:
If you have other variables to pass, it is recommended to indicate the type of these:
//CMakeLists.txt
option(MyOption "MyOption" OFF)
//Command line
cmake -DMyOption:BOOL=ON MyProjectFolder -D...
Yeah, you should use the option
command. You can set options from the command line this way:
//CMakeLists.txt
option(MyOption "MyOption" OFF)
//Command line
cmake -DMyOption=ON MyProjectFolder
Note that -DMyOption
must come before the path.