Fix cmake dependences for version-generated.h
* Seems like different versions of CMake and GNU Make doing different things and does not resolve dependeces correctly * add_custom_command in old version of CMake cannot depends on non-file target * Old version of CMake does not resolve dependency stratagus.cpp --> version.h --> version-generated.h and trying to compile stratagus.cpp before version-generated.h * And when generating doxygen documentation, it cannot find rule how to generate version-generated.h, so in stratagus_HDRS file version-generated.h must be twice * I belive that now compilation is working with CMake 2.6, 2.8, GNU Make 3.8 and Ninja
This commit is contained in:
parent
8550a3ae72
commit
781af593cb
1 changed files with 4 additions and 3 deletions
|
@ -587,6 +587,7 @@ set(stratagus_HDRS
|
|||
${stratagus_guichan_HDRS}
|
||||
${stratagus_spell_HDRS}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version-generated.h
|
||||
version-generated.h # This line is needed for CMake when generating Doxygen documentation
|
||||
)
|
||||
|
||||
# Additional platform checks
|
||||
|
@ -1004,13 +1005,14 @@ if(NOT CMAKE_CROSSCOMPILING)
|
|||
set(genversion_SRCS tools/genversion.cpp)
|
||||
source_group(genversion FILES ${genversion_SRCS})
|
||||
add_executable(genversion ${genversion_SRCS})
|
||||
add_custom_target(version ALL
|
||||
add_custom_target(version-generated.h ALL
|
||||
genversion ${CMAKE_CURRENT_BINARY_DIR}/version-generated.h "${STRATAGUS_VERSION}"
|
||||
DEPENDS genversion
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_command(OUTPUT version-generated.h DEPENDS version)
|
||||
set_source_files_properties(version-generated.h PROPERTIES GENERATED true)
|
||||
set_source_files_properties(src/include/version.h PROPERTIES OBJECT_DEPENDS version-generated.h) # This is needed for old CMake which does not generate correct dependences
|
||||
list(APPEND CLEAN_FILES version-generated.h)
|
||||
else()
|
||||
# Generate header file version-generated.h without bzr revision
|
||||
|
@ -1037,7 +1039,6 @@ add_custom_command(OUTPUT tolua.cpp
|
|||
)
|
||||
|
||||
add_executable(stratagus WIN32 ${stratagus_SRCS} ${stratagus_HDRS})
|
||||
add_dependencies(stratagus version-generated.h)
|
||||
target_link_libraries(stratagus ${stratagus_LIBS})
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
|
|
Loading…
Reference in a new issue