From b2353cc016ab6d5f442d677a84de6a2404aadca1 Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Sat, 30 Mar 2013 17:29:34 +0100 Subject: [PATCH] Improve the autorevision in cmake. It now sets its default based on an initial testrun. --- CMakeLists.txt | 32 +++++++++++++++++++++++++++----- changelog | 1 + 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a5068b9f41..7e023dcaf71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,12 +82,34 @@ option(ENABLE_NLS "Enable building of translations" ON) option(ENABLE_LOW_MEM "Reduce memory usage by removing extra functionality" OFF) option(ENABLE_OMP "Enables OpenMP, and has additional dependencies" OFF) -if(NOT UNIX) - set(DEFAULT_ENABLE_DISPLAY_REVISION false) -else() - # TODO test whether can be enabled by default - set(DEFAULT_ENABLE_DISPLAY_REVISION false) +if(NOT DEFINED ENABLE_DISPLAY_REVISION) + # Test whether the code is used in a repository if not autorevision will + # fail and should be disabled by default. If inside a repository enable + # the display of revision numbers by default. + execute_process( + COMMAND + ${CMAKE_SOURCE_DIR}/utils/autorevision + -th + > ${CMAKE_CURRENT_BINARY_DIR}/revision.dummy + WORKING_DIRECTORY + ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE + ENABLE_DISPLAY_REVISION_TEST_OUTPUT + ERROR_VARIABLE + ENABLE_DISPLAY_REVISION_TEST_ERRNO + ) + + if("${ENABLE_DISPLAY_REVISION_TEST_ERRNO}" STREQUAL "") + set(DEFAULT_ENABLE_DISPLAY_REVISION true) + else() + set(DEFAULT_ENABLE_DISPLAY_REVISION false) + endif() + + unset(ENABLE_DISPLAY_REVISION_TEST_OUTPUT) + unset(ENABLE_DISPLAY_REVISION_TEST_ERRNO) + endif() + option( ENABLE_DISPLAY_REVISION "Enable the display of the revision number in the game, only enable it when in a checkout" diff --git a/changelog b/changelog index 5581e4387e9..6f3d476f0a1 100644 --- a/changelog +++ b/changelog @@ -3,6 +3,7 @@ Version 1.11.2+dev: * Updated translations: Indonesian, Portuguese, Vietnamese * Miscellaneous and bug fixes * Switched to git version control. Hosting moved to SourceForge + * Improved: Autorevision based revision numbers in CMake. Version 1.11.2: * Add-ons client: