[CMake] Preprocessed linker script

Vladimir kv11111 at mail.ru
Mon Sep 29 11:12:05 EDT 2008


Hello,

I want to link an executable with custom linker script, but my script have
to be preprocessed with cpp. I've tried using add_custom_command and
add_dependencies:

set(MOD_LINKER_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/kernel_mod.ld)
add_custom_command(OUTPUT ${MOD_LINKER_SCRIPT}
    cpp -nostdinc -P ${CMAKE_SOURCE_DIR}/${ARCH_LINKER_SCRIPT} -o
${MOD_LINKER_SCRIPT}
    DEPENDS ${CMAKE_SOURCE_DIR}/${ARCH_LINKER_SCRIPT} VERBATIM)

add_executable(kernel_mod ${MOD_SOURCES})
add_dependencies(kernel_mod ${MOD_LINKER_SCRIPT})
set_target_properties(kernel_mod PROPERTIES
LINK_FLAGS "-T${MOD_LINKER_SCRIPT}")

but the dependency is somhow ignored and my custom command is not invoked.
What am I doing wrong ? Thanks for your attention.

-- 
         Best Regards,
              Vladimir



More information about the CMake mailing list