Hello, I'm looking for a way to preprocess a linker script.
After (unsuccessfully) trying add_custom_command() I found this explanation and a workaround: http://www.mail-archive.com/[email protected]/msg16496.html It uses an intermediate dependency "dummy.c" in the source list of the executable, which forces the custom command to be executed: ---- add_executable(cmake_test ${CMAKE_CURRENT_BINARY_DIR}/dummy.c) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dummy.c COMMAND ${CMAKE_C_COMPILER} -E ${CMAKE_CURRENT_SOURCE_DIR}/api.lds.S -P -o ${CMAKE_CURRENT_BINARY_DIR}/api.lds COMMAND echo "/* this file is (almost) empty */" > ${CMAKE_CURRENT_BINARY_DIR}/dummy.c MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/api.lds.S ) set(CMAKE_EXE_LINKER_FLAGS "-T api.lds") ---- While this is actually working, I find the approach somehow "dirty". Is there a more elegant solution without the dummy.c file? Best Regards Michael -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
