I've got something like this in the CMakeLists file:
set(CMAKE_CXX_FLAGS "-g -Wextra -DFLAG")
Later in the same CMakeLists.txt file, I need to check if FLAG
has been defined. Is it possible to do something like this?
IF(FLAG)
target_link_libraries(${PRODUCT} ${LIBS1})
ELSE()
target_link_libraries(${PRODUCT} ${LIBS2})
ENDIF()
I am also gonna check if FLAG
has been defined in my c++ code. If defined, I will use codes from LIBS1
, else I will make use of codes defined in LIBS2
library set.
#ifdef FLAG
// some code that uses LIBS1 libraries
#else
// some code that uses LIBS2 libraries
#endif