[CMake] compiling idl files

Jon W knowdat at gmail.com
Fri Jun 22 17:31:25 EDT 2007


Adding the idl files as source seems to work to a certain point, but
I'm missing some syntax to have this work in reality.  I'm not sure
how to write this syntax to then compile the .c and .h files that are
generated by midl.  Maybe another cmakelist.txt file?

Thank you for the macro.  Right now I'll try this with midl to compile
the idl files.

If anybody else has examples, please let me know.
-Jon

On 6/22/07, Guilherme Balena Versiani <guibv at comunip.com.br> wrote:
> AFAIK, you just need to add these files as source ones (I didn't tested
> to make sure, but I think it do the job)...
>
> If you are talking about XPCOM IDLs, then you need to use
> ADD_CUSTOM_COMMAND, in a similar way as you do for .y and .l files
> (yacc/flex), put these IDL files as a dependecy for each .h file
> generated and mark that .h files as 'generated', so cmake does not
> complain the missing headers (if you like to add the generated headers
> as source ones). I have a 'MacroAddInterfaces.cmake' file in my own
> project with something like:
>
> ----
> # MACRO_ADD_INTERFACES(idl_files...)
>
> # Copyright (c) 2007, Guilherme Balena Versiani, <guibv at comunip.com.br>
> #
> # Redistribution and use is allowed according to the terms of the BSD
> license.
> # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
>
> MACRO (MACRO_ADD_INTERFACES)
>
>   FOREACH(_in_FILE ${ARGN})
>
>     GET_FILENAME_COMPONENT(_out_FILE ${_in_FILE} NAME_WE)
>     GET_FILENAME_COMPONENT(_in_PATH ${_in_FILE} PATH)
>
>     ADD_CUSTOM_COMMAND(
>       OUTPUT ${XPCOM_INTERFACES_DIR}/${_out_FILE}.h
>       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE}
>       COMMAND ${XPIDL_EXECUTABLE} -m header ${VXIDL_INCLUDES} -I
> ${CMAKE_CURRENT_SOURCE_DIR}/${_in_PATH} -o ${_out_FILE}
> ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE}
>       WORKING_DIRECTORY ${XPCOM_INTERFACES_DIR}
>     )
>
>     MACRO_ADD_FILE_DEPENDENCIES(
>       ${XPCOM_INTERFACES_DIR}/${_out_FILE}.h
>       ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE}
>     )
>
>     SET_SOURCE_FILES_PROPERTIES(
>       ${XPCOM_INTERFACES_DIR}/${_out_FILE}.h
>       PROPERTIES
>       GENERATED TRUE
>     )
>
>   ENDFOREACH(_in_FILE ${ARGN})
>
> ENDMACRO (MACRO_ADD_INTERFACES)
>
> Regards,
>
> Guilherme Balena Versiani.
>
>
> Jon W wrote:
> > Does anybody have a CMakelists.txt example on how to properly compile
> > idl files into visual studio projects?  I'm not sure if I need to use
> > ADD_CUSTOM_COMMAND or just list the idl files in the sources, etc..
> >
> > Thanks,
> > Jon
> > _______________________________________________
> > CMake mailing list
> > CMake at cmake.org
> > http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list