Set CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND in Windows.MSVC.toolchain.cmake#129
Conversation
Signed-off-by: Jacek Szafarkiewicz <jacek@szafar.pl>
|
I don't really follow - this doesn't really seem to be a responsibility of the toolchain..? |
|
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8359 |
Ah, gotcha. So it's not really for generating moc_predefs.h directly - defining If I add, say: execute_process(
COMMAND ${CMAKE_CXX_COMPILER_PREDEFINES_COMMAND}
OUTPUT_VARIABLE CXX_PREDEFINES_OUTPUT
)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cxx_predefines.txt ${CXX_PREDEFINES_OUTPUT})Then the predefines are written, but an '.obj' file is generated into my work-tree. It looks like you can redirect to Is it worth adding a set(CMAKE_C_COMPILER_PREDEFINES_COMMAND
${CMAKE_C_COMPILER}
/nologo
/Zc:preprocessor
/PD
/c
/Fonul.
${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c
) |
…obj files being written
|
@hadogenes - I pushed a commit with my recommendations. Does that work for your use case? |
…n.cmake (MarkSchofield#129) * Generate moc_predefs.h file for automoc Signed-off-by: Jacek Szafarkiewicz <jacek@szafar.pl> * Add CMAKE_C_COMPILER_PREDEFINES_COMMAND; include '/Fonul.' to avoid .obj files being written --------- Signed-off-by: Jacek Szafarkiewicz <jacek@szafar.pl> Co-authored-by: Mark Schofield <34426337+MarkSchofield@users.noreply.github.com>
Setting "CMAKE__COMPILER_PREDEFINES_COMMAND" with the command that will produce the compiler's predefines unblocks downstream consumers, like 'automoc'.