if — CMake 3.23.0-rc3 Documentation
cmake.org › cmake › helpif — CMake 3.23.0-rc2 Documentation if ¶ Conditionally execute a group of commands. Synopsis ¶ if (<condition>) <commands> elseif (<condition>) # optional block, can be repeated <commands> else () # optional block <commands> endif () Evaluates the condition argument of the if clause according to the Condition syntax described below.
Writing CMakeLists Files — Mastering CMake
cmake.org › cmake › helpCMake also supports elseif to help sequentially test for multiple conditions. For example: if (MSVC80) # do something here elseif (MSVC90) # do something else elseif (APPLE) # do something else endif () The if command documents the many conditions it can test. Looping Constructs ¶