Fix: [CMake] Auto-fill version details in rev.cpp and ottres.rc (#9066)

This commit is contained in:
Loïc Guilloux
2021-04-20 21:38:46 +02:00
committed by GitHub
parent fe3cd185d7
commit d4f0b6f434
4 changed files with 19 additions and 4 deletions

View File

@@ -4,7 +4,9 @@ if(NOT BINARY_NAME)
set(BINARY_NAME openttd)
endif()
project(${BINARY_NAME})
project(${BINARY_NAME}
VERSION 1.12.0
)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "In-source builds not allowed. Please run \"cmake ..\" from the build directory. You may need to delete \"${CMAKE_SOURCE_DIR}/CMakeCache.txt\" first.")
@@ -72,6 +74,9 @@ add_custom_target(find_version
${CMAKE_COMMAND}
-DFIND_VERSION_BINARY_DIR=${CMAKE_BINARY_DIR}/generated
-DCPACK_BINARY_DIR=${CMAKE_BINARY_DIR}
-DREV_MAJOR=${CMAKE_PROJECT_VERSION_MAJOR}
-DREV_MINOR=${CMAKE_PROJECT_VERSION_MINOR}
-DREV_BUILD=${CMAKE_PROJECT_VERSION_PATCH}
-P "${CMAKE_SOURCE_DIR}/cmake/scripts/FindVersion.cmake"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
BYPRODUCTS ${GENERATED_SOURCE_FILES}