Skip to content

Commit

Permalink
Use the make_versioncpp.py script in CMake
Browse files Browse the repository at this point in the history
Instead of using the now defunct subversion way of CMake to get the build
number, use the make_versioncpp.py script to generate all version related
source files.
  • Loading branch information
adrianbroher committed Apr 23, 2015
1 parent 9435226 commit 53c3046
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,17 @@ else ()
message(FATAL_ERROR "Unknown platform type! Your setup is not a supported platform for FreeOrion.")
endif ()

find_package(Subversion)
set(FreeOrion_WC_REVISION ???)
set(FreeOrion_BUILDSYS "CMake")
if (Subversion_FOUND AND (
IS_DIRECTORY "${CMAKE_SOURCE_DIR}/.svn" OR
IS_DIRECTORY "${CMAKE_SOURCE_DIR}/../.svn" OR
IS_DIRECTORY "${CMAKE_SOURCE_DIR}/../../.svn")
)
Subversion_WC_INFO("${CMAKE_SOURCE_DIR}" FreeOrion)
endif ()
configure_file(
${CMAKE_SOURCE_DIR}/util/Version.cpp.in
${CMAKE_BINARY_DIR}/util/Version.cpp
find_package(PythonInterp REQUIRED)

# To run the version generation every compile we need to deferr the
# execution to a separate target and the existing python command
add_custom_target(freeorionversion
COMMAND
"${CMAKE_SOURCE_DIR}/cmake/make_versioncpp.py"
"${CMAKE_SOURCE_DIR}"
"CMake"
)

if("${FreeOrion_WC_REVISION}" STREQUAL "???")
set(FreeOrion_WC_REVISION "unknown")
endif ()

if (WIN32)
# Add icon resource file to freeorion.exe
if (NOT EXISTS ${CMAKE_BINARY_DIR}/win32_resources.rc)
Expand Down Expand Up @@ -245,8 +237,7 @@ set (freeorioncommon_SOURCE
util/StringTable.cpp
util/VarText.cpp
util/XMLDoc.cpp
util/Version.cpp.in
${CMAKE_BINARY_DIR}/util/Version.cpp
util/Version.cpp
)

if (NOT WIN32)
Expand All @@ -260,6 +251,8 @@ add_library(freeorioncommon
${freeorioncommon_SOURCE}
)

add_dependencies(freeorioncommon freeorionversion)

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set_property(
SOURCE
Expand Down

0 comments on commit 53c3046

Please sign in to comment.