Reputation: 18127
I've got something like this in the CMakeLists file:
set(CMAKE_CXX_FLAGS "-g -Wextra -DFLAG1=A")
Later in the file, I need to check if FLAG1
has been defined. Is it possible to do something like this?
IF(${FLAG1} EQUAL A)
#Do something
ELSE()
#Do something else
ENDIF()
Upvotes: 1
Views: 4732
Reputation: 34391
Well, you can do
set(FLAG1 A)
set(CMAKE_CXX_FLAGS "-g -Wextra -DFLAG1=${FLAG1}")
...
if(${FLAG1} STREQUAL A)
...
Upvotes: 3