From ceefe305ec7941e7502ff79346cd599f1f5e4893 Mon Sep 17 00:00:00 2001 From: Learath2 Date: Sat, 17 Oct 2020 18:50:26 +0200 Subject: [PATCH] Add workaround for CMake 2.8. Fix version caching --- CMakeLists.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cbc6d2df..67a6ac2c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,7 +98,11 @@ option(DOWNLOAD_GTEST "Download and compile GTest" ${AUTO_DEPENDENCIES_DEFAULT}) option(STEAM "Build the Steam release version" OFF) option(PREFER_BUNDLED_LIBS "Prefer bundled libraries over system libraries" ${AUTO_DEPENDENCIES_DEFAULT}) option(DEV "Don't generate stuff necessary for packaging" OFF) -set(VERSION ${PROJECT_VERSION} CACHE STRING "Specify version string") + +# Set version if not explicitly set +if(NOT VERSION) + set(VERSION ${PROJECT_VERSION}) +endif() set(OpenGL_GL_PREFERENCE LEGACY) @@ -117,9 +121,13 @@ endif() set(DBG $,$>) -set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS - src/game/version.h -) +if(CMAKE_VERSION VERSION_LESS 3.0) + configure_file(src/game/version.h vd.h) +else() + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS + src/game/version.h + ) +endif() set(SERVER_EXECUTABLE DDNet-Server CACHE STRING "Name of the built server executable") set(CLIENT_EXECUTABLE DDNet CACHE STRING "Name of the build client executable")