summaryrefslogtreecommitdiffhomepage
path: root/cmake/opentrack-version.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/opentrack-version.cmake')
-rw-r--r--cmake/opentrack-version.cmake20
1 files changed, 5 insertions, 15 deletions
diff --git a/cmake/opentrack-version.cmake b/cmake/opentrack-version.cmake
index 24970b59..0ff516f2 100644
--- a/cmake/opentrack-version.cmake
+++ b/cmake/opentrack-version.cmake
@@ -1,3 +1,4 @@
+include_guard(GLOBAL)
include(GetGitRevisionDescription)
find_package(Git QUIET)
@@ -5,19 +6,9 @@ if(GIT_FOUND)
git_describe(OPENTRACK_COMMIT --tags --always)
endif()
-unset(_build_type)
-if(CMAKE_BUILD_TYPE)
- string(TOUPPER ${CMAKE_BUILD_TYPE} _build_type)
- if (NOT _build_type STREQUAL "DEBUG")
- unset(_build_type)
- else()
- set(_build_type "-${_build_type}")
- endif()
-endif()
-
-file(WRITE ${CMAKE_BINARY_DIR}/opentrack-version.h "#define OPENTRACK_VERSION \"${OPENTRACK_COMMIT}${_build_type}\"")
+file(WRITE ${CMAKE_BINARY_DIR}/opentrack-version.hxx "#define OPENTRACK_VERSION \"${OPENTRACK_COMMIT}\"")
-set(version-string "
+set(version-string "\
#ifdef __cplusplus
extern \"C\"
#else
@@ -25,8 +16,7 @@ extern
#endif
const char* const opentrack_version;
-
-const char* const opentrack_version = \"${OPENTRACK_COMMIT}${_build_type}\";
+const char* const opentrack_version = \"${OPENTRACK_COMMIT}\";
")
set(file "${CMAKE_CURRENT_BINARY_DIR}/version.cpp")
@@ -42,5 +32,5 @@ endif()
add_library(opentrack-version STATIC "${file}")
if(NOT MSVC)
- set_property(TARGET opentrack-version APPEND_STRING PROPERTY COMPILE_FLAGS "-fno-lto ")
+ target_compile_options(opentrack-version PRIVATE -fno-lto)
endif()