[CMake] Installing results of ADD_CUSTOM_COMMAND
Alex Brooks
a.brooks at acfr.usyd.edu.au
Sun Nov 7 09:27:05 EST 2004
Hi,
I have a bit of a problem using cmake for IDL files.
I used ADD_CUSTOM_COMMAND to generate .h/.cpp files from .idl files:
FOREACH ( SUFFIX ${IDL_SUFFIXES} )
STRING( REGEX REPLACE "\\.idl" ${SUFFIX} OUTPUT "${IDL_SOURCE}" )
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT}
COMMAND ${TAO_IDL}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${IDL_SOURCE} ${TAO_IDL_ARGS}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${IDL_SOURCE}
)
...
The .cpp files are then compiled into a library and marked for
installation:
ADD_LIBRARY( ${LIB_NAME} ${IDL_CPP_FILES} ${HUMAN_SOURCE_LIST} )
I also want to install the .h files.
I tell cmake to install the header files with:
FOREACH ( FILE ${IDL_HEADER_FILES} )
INSTALL_FILES( /include/orca ${FILE} )
ENDFOREACH ( FILE ${IDL_HEADER_FILES} )
The problem is that cmake can't find the IDL_HEADER_FILES when it is run
(because they're only generated from .idl later, when 'make' is run).
The only way I've found to make it work correctly is to do:
'cmake .; make; cmake .; make install'
The second 'cmake .' can see the generated header files and creates the
correct install rules. There's gotta be a better way of doing this
though -- can anyone offer any suggestions?
Thanks,
Alex
More information about the CMake
mailing list