Hi,
We have a custom command for a third-party utility (genreflex, from the
ROOT system) which has a directive:
IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/classes.h
How would I, either as an extra COMMAND or as a separate custom command,
manually invoke the configured CXX compiler with all the
correctly-configured include directories and other pre-processor and
compiler flags with the expected option (-MMD for GCC, I think) on the
above-mentioned classes.h file so that the resulting file can be used in
a DEPFILE directive for the Ninja generator? I would like to model as
closely as possible exactly what CMake would specify to invoke the
compiler to (e.g.) compile an object with only the necessary changes,
but I'm not sure whence to obtain this information. I'm assuming it's
some combination of automatic variables and properties via generator
expressions, but I'm at a loss, I'm afraid. I also don't know whether I
would need to specify the .d file as an OUTPUT or a BYPRODUCTS if I do
this as a COMMAND, or in DEPENDS in addition to DEPFILE if a separate
custom command, and which choice would be better (assuming both of them
work). The resulting CMake code would need to conditionally support both
Makefile and Ninja generators.
Any advice gratefully accepted.
Current custom command definition:
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${dictname}_dict.cpp
${SOURCE_OUTPUT} ${GD_ROOTMAP_OUTPUT} ${PCM_OUTPUT}
COMMAND ${ROOT_GENREFLEX} ${CMAKE_CURRENT_SOURCE_DIR}/classes.h
-s ${CMAKE_CURRENT_SOURCE_DIR}/classes_def.xml
-I${CMAKE_SOURCE_DIR}
${GENREFLEX_INCLUDES} ${GENREFLEX_FLAGS}
-o ${dictname}_dict.cpp
${CLEANUP_COMMAND}
IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/classes.h
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/classes_def.xml
COMMENT "Generating dictionary files for target ${dictname}"
)
Many thanks,
Chris.
--
Chris Green <gre...@fnal.gov>, FNAL CS/SCD/ADSS/SSI/TAC;
'phone (630) 840-2167; Skype: chris.h.green;
IM: gre...@jabber.fnal.gov, chissgreen (AIM),
chris.h.green (Google Talk).
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake