Hi,

I'm trying to figure out how to correctly set up dependencies for
generated header files.
I have prepared an example setup here: http://github.com/usovalx/cmake_test.git

Quick summary:
root/CMakeLists.txt:
add_subdirectory(sub1)
add_subdirectory(sub2)

sub2/CMakeLists.txt:
add_custom_command(
    OUTPUT tt.h tt.c
    COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/gen.sh
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    VERBATIM)
add_custom_target(sub2Hxx)
add_dependencies(sub2Hxx tt.h tt.c)
add_library(t2 gen.sh tt.c tt.h)
add_dependencies(t2 sub2Hxx)

sub1/CMakeLists.txt:
add_executable(t1    main.c)
add_dependencies(t1 sub2Hxx)

sub1/main.c:
#include "../sub2/tt.h"

Now if I'm trying to build target t1 compilation fails because
generator script didn't run.
What is the correct way to trigger code generation in this case?

-- 
Best regards,
  Alexander.
--

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

Reply via email to