aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Version.cmake8
1 files changed, 5 insertions, 3 deletions
diff --git a/cmake/Version.cmake b/cmake/Version.cmake
index 63b2a6790..3677e80d7 100644
--- a/cmake/Version.cmake
+++ b/cmake/Version.cmake
@@ -28,7 +28,7 @@
function (write_static_version_header hash)
set(VERSIONTAG "${hash}")
- configure_file("src/version.cpp.in" "version.cpp")
+ configure_file("${CMAKE_SOURCE_DIR}/src/version.cpp.in" "${CMAKE_BINARY_DIR}/version.cpp")
endfunction ()
find_package(Git QUIET)
@@ -37,14 +37,16 @@ if ("$Format:$" STREQUAL "")
write_static_version_header("release")
elseif (GIT_FOUND OR Git_FOUND)
message(STATUS "Found Git: ${GIT_EXECUTABLE}")
- add_custom_target(genversion ALL
+ add_custom_command(
+ OUTPUT "${CMAKE_BINARY_DIR}/version.cpp"
COMMAND "${CMAKE_COMMAND}"
"-D" "GIT=${GIT_EXECUTABLE}"
"-D" "TO=${CMAKE_BINARY_DIR}/version.cpp"
"-P" "cmake/GenVersion.cmake"
- BYPRODUCTS "${CMAKE_BINARY_DIR}/version.cpp"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
else()
message(STATUS "WARNING: Git was not found!")
write_static_version_header("unknown")
endif ()
+add_custom_target(genversion ALL
+ DEPENDS "${CMAKE_BINARY_DIR}/version.cpp")