I\'ve recently ported my Qt
project from qmake
to CMake
.
My main program contains a value which depends on a #define
directiv
Are you sure that set_target_properties
does not work? How about this one:
set_target_properties(myAppV1 PROPERTIES COMPILE_FLAGS "-DBUILDTYPE=1")
or:
set_target_properties(myAppV1 PROPERTIES COMPILE_DEFINITIONS "BUILDTYPE=1")
On my machine it works:
add_executable(myAppV1 main.cpp)
add_executable(myAppV2 main.cpp)
set_target_properties(myAppV1 PROPERTIES COMPILE_DEFINITIONS "BUILDTYPE=1")
set_target_properties(myAppV2 PROPERTIES COMPILE_DEFINITIONS "BUILDTYPE=2")