> And then configure and run it like this: > > CMakeLists.txt: > --------------- > # ... > configure_file(foo_wrapper.cmake.in > "${CMAKE_CURRENT_BINARY_DIR}/foo_wrapper.cmake" @ONLY) > add_custom_command(OUTPUT bar > COMMAND "${CMAKE_COMMAND}" -P > "${CMAKE_CURRENT_BINARY_DIR}/foo_wrapper.cmake" > COMMENT "Creating bar") > > > If you need to pass the script variables using the -D flags, make sure > to pass them before the -P flag, otherwise they are silently ignored. > > I hope you get the idea. > >
I fear I've not explained enough the problem. If I understood correctly your solution when in my CMakeLists.txt I execute the custom command "bar" what I obtain is that "foo" is called. In my project I have some "IDL" files written in a custom format, those files require a preprocessing pass to be transformed in .h/.cpp, that I perform using add_custom_command() inside a macro ADD_CUSTOM_COMMAND( OUTPUT ${PROJECT_SOURCE_DIR}/inc/intf/${_out_FILE}.h DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} COMMAND idlcc ARGS -V -S -s ${PROJECT_SOURCE_DIR}/inc/intf -I${PROJECT_SOURCE_DIR}/inc/intf -I${PROJECT_SOURCE_DIR}/inc ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} ) The command *idlcc* is bundled within the repository and is in the directory $PROJECT_SOURCE_DIR/ext_bin/DFC, I can call it directly with a path, changing COMMAND idlcc to COMMAND ${PROJECT_SOURCE_DIR}/ext_bin/DFC/idlcc ...but the problem is that idlcc calls its "second step", *dfc_idl*, that is in the same directory, and pretend it to be in the command search path. the previous makefile used to do: export PATH=$PROJECT_DIR/ext/bin/DFC:$PATH The exported path is used by idlcc that is launched from the Makefile and that can find dfc_idl without problems. I need to mimic this behaviour in CMake. It seems a very simple task, I can see similar problems with LD_LIBRARY_PATH in other projects, it's strange CMake cannot do this in an easy way, that's why I think I'm missing something. ATM my solution is to manually do export PATH=basedir/ext_bin/DFC/idlcc:$PATH * * *BEFORE* building. -- Bye, Gabry
_______________________________________________ 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