Hi Robert,

thanks very much, with an additional add_custom_target() it's working!

Best Regards
Michael


PS: This is the complete CMakeLists.txt (for future reference):
----
project (cmake_test_custom_command)
cmake_minimum_required (VERSION 2.8)
set(CMAKE_MAKE_PROGRAM c:/devel/msys-gcc-m68k-elf/bin/make)

include_directories(inc)
set(CMAKE_EXE_LINKER_FLAGS "-T api.lds")

add_executable(cmake_test hello.c)

add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/api.lds
                   MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/api.lds.S
                   COMMAND ${CMAKE_C_COMPILER}
                   -E ${CMAKE_CURRENT_SOURCE_DIR}/api.lds.S -P
                   -o ${CMAKE_CURRENT_BINARY_DIR}/api.lds
                   -I ${CMAKE_CURRENT_SOURCE_DIR}/inc
                   VERBATIM)

add_custom_target(linkerscript
                  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/api.lds
                  VERBATIM)

add_dependencies(cmake_test linkerscript)
----



On Fri, 8 Nov 2013 10:56:19 -0500
Robert Maynard <[email protected]> wrote:

> add_dependencies works only on targets not files. You will need to use
> add_custom_target whose DEPENDS is set to
> ${CMAKE_CURRENT_BINARY_DIR}/api.lds. You can than specify that
> cmake_test depends on the custom target.
> 
> On Fri, Nov 8, 2013 at 5:15 AM, Michael Weise <[email protected]> 
> wrote:
> > On Thu, 7 Nov 2013 19:56:29 +0000
> > "Williams, Norman K" <[email protected]> wrote:
> >
> >> Why doesn't this work?
> >> add_custom_command(
> >> ...
> >
> > Good point, that's the core of my question.
> >
> > I did implement the "add_custom_command" as you suggested, including
> > "dependencies". Unfortunatly, the custom command is not executed.
> >
--

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

Reply via email to