Hello,

obviously I have a problem with the understanding of generating dependencies of generated files.

generate_foo_static_lexer is using ${foo_LEXER_HPP} to generate a header file ${foo_STATIC_LEXER_HPP}. Each time ${foo_STATIC_LEXER_HPP} is changed the header shall be regenerated. Later, ${foo_STATIC_LEXER_HPP} can be more than one file (maybe list(xxx_HPP A;B;C)?? ).

But this doesn't happen, only the exe is re-created. What's wrong?

project(foo)

# generate foo's static lexer into the root of out-of-source build directory
set(foo_INCLUDE_PATH ${CMAKE_BINARY_DIR}/include/foo/io/foo)
set(foo_STATIC_LEXER_HPP ${foo_INCLUDE_PATH}/foo_static_lexer.hpp)
file(MAKE_DIRECTORY ${foo_INCLUDE_PATH})
set(foo_LEXER_HPP ${CMAKE_SOURCE_DIR}/include/foo/io/foo/lexer_impl.hpp)

add_executable(generate_foo_static_lexer generate_foo_static_lexer.cpp)
set_target_properties(generate_foo_static_lexer PROPERTIES COMPILE_DEFINITIONS "foo_LEXER_DYNAMIC_TABLES;BOOST_SPIRIT_LEXERTL_DEBUG")

add_custom_command(
   OUTPUT  ${foo_STATIC_LEXER_HPP}
   COMMAND generate_foo_static_lexer ${foo_STATIC_LEXER_HPP}
   COMMENT "Generating foo static DFA lexer header ${foo_STATIC_LEXER_HPP}"
   )
add_custom_target(foo_dfa DEPENDS ${foo_LEXER_HPP})
add_dependencies(foo_dfa generate_foo_static_lexer)
set_source_files_properties(${foo_STATIC_LEXER_HPP} PROPERTIES GENERATED 1)
--

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