I recently ported my Qt project from qmake to CMake . My main program contains a value that depends on the #define directive.
I want to indicate that the define directive is externally via CMake and build 3 named versions of the same executable.
How can I do it?
I saw set_target_properties , but this only works for libraries, not for executables.
For example, I want the following program,
int main() { cout << BUILDTYPE << endl; }
it is compiled in 3 different versions (3 executable files) based on BUILDTYPE "define" For example, in my CMakeLists.txt I want to specify
add_executable(myAppV1 -DBUILDTYPE=1) add_executable(myAppV2 -DBUILDTYPE=2) add_executable(myAppV3 -DBUILDTYPE=3)
but this is not the correct syntax. Any hint? and I get 3 executables that print
c ++ build cmake compiler-flags
linello
source share