How to specify separate compilation options for different purposes in qmake?

Is it possible to specify separate compilation options for different purposes in qmake?

For instance:

QMAKE_CXXFLAGS += -O SOURCES += file1.cpp QMAKE_CXXFLAGS += -std=gnu++0x -O SOURCES += file2.cpp 

Thus, file1.cpp will be compiled only with the -O option and file2.cpp with the parameters -std = gnu ++ 0x -O.

+6
source share
1 answer

You can create and use a separate "additional compiler", as shown below:

 # Use the built-in compiler for file1.cpp QMAKE_CXXFLAGS += -O SOURCES += file1.cpp # Create a new compiler for file2.cpp gnupp0x.input = SOURCES_GNUPP0X gnupp0x.output = ${QMAKE_FILE_BASE}.o gnupp0x.commands = g++ -std=gnu++0x $$QMAKE_CXXFLAGS ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT} QMAKE_EXTRA_COMPILERS += gnupp0x # Use the new compiler for file2.cpp SOURCES_GNUPP0X += file2.cpp 
+8
source

All Articles