[CMake] Question regarding list arguments in macros
Allen Gooch
allen.gooch at gmail.com
Tue Mar 31 16:06:20 EDT 2009
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090331/95a20c36/attachment.htm>
More information about the CMake
mailing list