QMAKE_EXTRA_COMPILERS adds file to OBJECTS
-
I have following .pro file
... # Rename <Class>.rep to rep_<Class>_source.h for correct output filename and add <Class>.rep to C_REP_REPLICA for replica creation defineReplace(addToReplica) { # Add <Class>.rep to C_REPC_REPLICA for replica generation C_REPC_REPLICA *= $$1 FILENAME_FULL = $$basename(1) FILENAME_SPLIT = $$split(FILENAME_FULL, .) CLASSNAME = $$member(FILENAME_SPLIT, 0) CLASSNAME_JOINED = $$join(CLASSNAME,,rep_,_source.h) return("$$FILENAME_FULL") } C_REPC_SOURCE += \ ExampleClass/ExampleClass.rep # Build rep_class_source.h with customized repc c_repc_source.input = C_REPC_SOURCE c_repc_source.commands = $$OUT_ROOT/bin/repc.exe -o source -I C:/Dev/Qt/6.6.1/msvc2019_64/include -I C:/Dev/Qt/6.6.1/msvc2019_64/include/QtRemoteObjects -I C:/Dev/Qt/6.6.1/msvc2019_64/include -I C:/Dev/Qt/6.6.1/msvc2019_64/include/QtRemoteObjects ${QMAKE_FILE_NAME} rep_${QMAKE_FILE_BASE}_source.h c_repc_source.output_function = addToReplica QMAKE_EXTRA_COMPILERS += c_repc_source ...
which results in following Makefile
... SOURCES = C:\Dev\project\src\Util\tests\tst_Ro\tst_Ro.cpp \ C:\Dev\project\src\Util\tests\tst_Ro\ExampleClass\ExampleClass.cpp \ C:\Dev\project\src\Util\tests\tst_Ro\RoTest\RoReceiverTest.cpp moc_ExampleClass.cpp \ moc_RoReceiverTest.cpp OBJECTS = ExampleClass.rep \ <------- REMOVE THIS tst_Ro.obj \ ExampleClass.obj \ RoReceiverTest.obj \ moc_ExampleClass.obj \ moc_RoReceiverTest.obj ...
When the linker is invoked it fails because of the wrongly added ExampleClass.rep to the OBJECTS variable.
I tried it with QMAKE_PRE_LINK but this variable only takes a command as input. I tried by passing a replaceFunction which does something like this
# Remove Class.rep from objects files to prevent linker error myObjectFileList = $$files($$OUT_PWD/*.o) myObjectFileList-= $$1
Which did not work because the reason stated in the previous sentence.
Is there any way to remove that value from OBJECTS before linker gets invoked?
-
I have following .pro file
... # Rename <Class>.rep to rep_<Class>_source.h for correct output filename and add <Class>.rep to C_REP_REPLICA for replica creation defineReplace(addToReplica) { # Add <Class>.rep to C_REPC_REPLICA for replica generation C_REPC_REPLICA *= $$1 FILENAME_FULL = $$basename(1) FILENAME_SPLIT = $$split(FILENAME_FULL, .) CLASSNAME = $$member(FILENAME_SPLIT, 0) CLASSNAME_JOINED = $$join(CLASSNAME,,rep_,_source.h) return("$$FILENAME_FULL") } C_REPC_SOURCE += \ ExampleClass/ExampleClass.rep # Build rep_class_source.h with customized repc c_repc_source.input = C_REPC_SOURCE c_repc_source.commands = $$OUT_ROOT/bin/repc.exe -o source -I C:/Dev/Qt/6.6.1/msvc2019_64/include -I C:/Dev/Qt/6.6.1/msvc2019_64/include/QtRemoteObjects -I C:/Dev/Qt/6.6.1/msvc2019_64/include -I C:/Dev/Qt/6.6.1/msvc2019_64/include/QtRemoteObjects ${QMAKE_FILE_NAME} rep_${QMAKE_FILE_BASE}_source.h c_repc_source.output_function = addToReplica QMAKE_EXTRA_COMPILERS += c_repc_source ...
which results in following Makefile
... SOURCES = C:\Dev\project\src\Util\tests\tst_Ro\tst_Ro.cpp \ C:\Dev\project\src\Util\tests\tst_Ro\ExampleClass\ExampleClass.cpp \ C:\Dev\project\src\Util\tests\tst_Ro\RoTest\RoReceiverTest.cpp moc_ExampleClass.cpp \ moc_RoReceiverTest.cpp OBJECTS = ExampleClass.rep \ <------- REMOVE THIS tst_Ro.obj \ ExampleClass.obj \ RoReceiverTest.obj \ moc_ExampleClass.obj \ moc_RoReceiverTest.obj ...
When the linker is invoked it fails because of the wrongly added ExampleClass.rep to the OBJECTS variable.
I tried it with QMAKE_PRE_LINK but this variable only takes a command as input. I tried by passing a replaceFunction which does something like this
# Remove Class.rep from objects files to prevent linker error myObjectFileList = $$files($$OUT_PWD/*.o) myObjectFileList-= $$1
Which did not work because the reason stated in the previous sentence.
Is there any way to remove that value from OBJECTS before linker gets invoked?
Hi,
Based on the qmake Adding Compilers chapter of Qt's documentation, you are missing
c_repc_source.output
. -
Hi,
Based on the qmake Adding Compilers chapter of Qt's documentation, you are missing
c_repc_source.output
.