[CMake] Installing results of ADD_CUSTOM_COMMAND
Troels Frimor
troels at in.tum.de
Sun Nov 7 13:11:50 EST 2004
Hi,
I have to do the exact same thing in our project. Now it works fine, and
the only thing I can see your are missing is to set the source as generated:
SET_SOURCE_FILES_PROPERTIES(${IDL_HEADER_FILES} PROPERTIES GENERATED true)
and then you should be able to:
INSTALL_FILES(/headers FILES ${IDL_HEADER_FILES})
with best regards,
Troels
Alex Brooks wrote:
> 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
>
> _______________________________________________
> CMake mailing list
> CMake at www.cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
>
More information about the CMake
mailing list