[CMake] Concern with 2.6.3
Bill Hoffman
bill.hoffman at kitware.com
Mon Mar 9 14:34:26 EDT 2009
Pau Garcia i Quiles wrote:
>>> What does not work is what I am doing: I'm listing the .h files as
>>> source files so that they show in the VC++ project. Now, given that
>>> header files are marked as "excluded from build", VC++ disables
>>> right-click-and-compile for those header files.
>> The .h file is not compiled, so that would not work anyway in a CMake
>> generated project. If the .h file where the input to a custom command then
>> it would work. That is how the VTK wrappers work. Each .h file is
>> "compiled" by a custom command into a .cxx file.
>
> Is it possible to mark each .h file as the entry point to the
> corresponding (already-generated) CMake rule, so that "compile" is
> available and runs moc on that .h?
>
Should be, I have not looked into the moc generation stuff recently, but
that is how it works in VTK with the wrapper generation.
In the test CustomCommand in CMake this is done:
ADD_CUSTOM_COMMAND(
OUTPUT ${PROJECT_BINARY_DIR}/wrapped.c
${PROJECT_BINARY_DIR}/wrapped_help.c
DEPENDS wrapper
MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/wrapped.h
COMMAND ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/wrapper
${PROJECT_BINARY_DIR}/wrapped.c ${PROJECT_BINARY_DIR}/wrapped_help.c
${CMAKE_CFG_INTDIR} # this argument tests passing of the configuration
VERBATIM # passing of configuration should work in this mode
)
I just verified and I can right click on wrapped.h and compile it to run
the generator. The MAIN_DEPENDENCY is doing that. That said,
FindQt4.cmake seems to already be using MAIN_DEPENDENCY, so it should be
working...
-Bill
More information about the CMake
mailing list