I have the following macro for generation of c++ source from a proprietary
IDL language:

macro (oidl_generate IDL_SOURCES IDL_INCLUDE_DIRS)
  message (STATUS "IDL Sources: ${IDL_SOURCES}")
  foreach (idlsrc ${IDL_SOURCES})
    get_filename_component (idlsrc_file ${idlsrc} NAME_WE)
    get_filename_component (idlsrc_path ${idlsrc} PATH)
    set (outsrc_file
${CMAKE_CURRENT_BINARY_DIR}/${idlsrc_path}/${idlsrc_file}.cpp)
    set (outsrc_path ${CMAKE_CURRENT_BINARY_DIR}/${idlsrc_path})
    set (omegaprotocols_SOURCES ${omegaprotocols_SOURCES} ${outsrc_file})
    set_source_files_properties ($outsrc_file PROPERTIES OBJECT_DEPENDS
${idlsrc})
    set (insrc_file ${CMAKE_CURRENT_SOURCE_DIR}/${idlsrc})
    make_directory (${outsrc_path})
    add_custom_command (
      OUTPUT ${outsrc_file}
      DEPENDS oidl
      COMMAND oidl ${insrc_file} -m -dynamic -O ${outsrc_path}
${IDL_INCLUDE_DIRS}
      )
  endforeach ()
endmacro ()

I call the macro from another CMakeLists.txt file:

include (OidlRules)
message (STATUS "IDL Sources from protocols: ${omegaprotocols_IDL_SOURCES}")
oidl_generate (${omegaprotocols_IDL_SOURCES} ${omegaprotocols_IDL_INCLUDES})

Inside of my macro, the status message indicates that ${IDL_SOURCES} is not
getting expanded to the full list, but is instead giving me the first
element of the list I passed in.  In my CMakeLists.txt file, before I call
the macro, status message indicates that the ${omegaprotocols_IDL_SOURCES}
value is the expected full list.  Is anything special required when passing
lists as arguments to macros?

Many thanks,
-allen
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to