find_package(Git)
configure_file(GitInfo.cmake.in GitInfo.cmake @ONLY)
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/git_versioninfo.cpp
+ COMMAND ${CMAKE_COMMAND} -DGIT_FOUND=${GIT_FOUND} -P GitInfo.cmake
+)
+set_source_files_properties(
+ ${CMAKE_CURRENT_BINARY_DIR}/git_versioninfo.cpp
+ PROPERTIES GENERATED TRUE
+)
add_custom_target(gen-gitinfo
- COMMAND ${CMAKE_COMMAND} -DGIT_FOUND=${GIT_FOUND} -P GitInfo.cmake)
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/git_versioninfo.cpp
+)
#-----------------------------------------------------------------------------#
${PROJECT_SOURCE_DIR}/src/*.g)
string(REPLACE ";" " " source_files_list "${source_files}")
-# Note: gen-tags-{debug,trace} are targets since we always want to generate
-# the temporary tag files {Debug,Trace}_tags.tmp in order to check if tags
-# were added/modified/deleted.
-add_custom_target(
- gen-tags-debug
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags.tmp
COMMAND
${gentmptags_script} ${CMAKE_CURRENT_LIST_DIR} Debug ${source_files_list}
- DEPENDS mktags
- BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags.tmp
+ DEPENDS mktags ${gentmptags_script} ${source_files}
)
-add_custom_target(
- gen-tags-trace
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags.tmp
COMMAND
${gentmptags_script} ${CMAKE_CURRENT_LIST_DIR} Trace ${source_files_list}
- DEPENDS mktags
- BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags.tmp
+ DEPENDS mktags ${gentmptags_script} ${source_files}
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags
COMMAND ${gentags_script} Debug
- DEPENDS gen-tags-debug ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags.tmp
+ DEPENDS ${gentags_script} ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags.tmp
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags
COMMAND ${gentags_script} Trace
- DEPENDS gen-tags-trace ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags.tmp
+ DEPENDS ${gentags_script} ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags.tmp
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags.h
COMMAND ${genheader_script} ${CMAKE_CURRENT_LIST_DIR} Debug
- DEPENDS mktagheaders ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags
+ DEPENDS mktagheaders ${genheader_script} ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags.h
COMMAND ${genheader_script} ${CMAKE_CURRENT_LIST_DIR} Trace
- DEPENDS mktagheaders ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags
+ DEPENDS mktagheaders ${genheader_script} ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags
)
add_custom_target(gen-tags
${CMAKE_CURRENT_BINARY_DIR}/Debug_tags.h
${CMAKE_CURRENT_BINARY_DIR}/Trace_tags.h
)
+
+set_source_files_properties(
+ ${CMAKE_CURRENT_BINARY_DIR}/Debug_tags.h
+ ${CMAKE_CURRENT_BINARY_DIR}/Trace_tags.h
+ PROPERTIES GENERATED TRUE
+)