forked from mirror/OpenTTD
Codechange: Make codestyle for CMake files consistent for 'control' statements
This commit is contained in:
@@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
find_package(Git QUIET)
|
||||
# ${CMAKE_SOURCE_DIR}/.git may be a directory or a regular file
|
||||
if (GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
# Make sure LC_ALL is set to something desirable
|
||||
set(SAVED_LC_ALL "$ENV{LC_ALL}")
|
||||
set(ENV{LC_ALL} C)
|
||||
@@ -26,7 +26,7 @@ if (GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
if (NOT IS_MODIFIED STREQUAL "")
|
||||
if(NOT IS_MODIFIED STREQUAL "")
|
||||
set(REV_MODIFIED 2)
|
||||
endif()
|
||||
|
||||
@@ -69,34 +69,34 @@ if (GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
)
|
||||
string(REGEX REPLACE "\^0$" "" TAG "${TAG}")
|
||||
|
||||
if (REV_MODIFIED EQUAL 0)
|
||||
if(REV_MODIFIED EQUAL 0)
|
||||
set(HASHPREFIX "-g")
|
||||
elseif (REV_MODIFIED EQUAL 2)
|
||||
elseif(REV_MODIFIED EQUAL 2)
|
||||
set(HASHPREFIX "-m")
|
||||
else ()
|
||||
else()
|
||||
set(HASHPREFIX "-u")
|
||||
endif()
|
||||
|
||||
# Set the version string
|
||||
if (NOT TAG STREQUAL "")
|
||||
if(NOT TAG STREQUAL "")
|
||||
set(REV_VERSION "${TAG}")
|
||||
set(REV_ISTAG 1)
|
||||
|
||||
string(REGEX REPLACE "^[0-9.]+$" "" STABLETAG "${TAG}")
|
||||
if (NOT STABLETAG STREQUAL "")
|
||||
if(NOT STABLETAG STREQUAL "")
|
||||
set(REV_ISSTABLETAG 1)
|
||||
else ()
|
||||
else()
|
||||
set(REV_ISSTABLETAG 0)
|
||||
endif ()
|
||||
else ()
|
||||
endif()
|
||||
else()
|
||||
set(REV_VERSION "${REV_ISODATE}-${BRANCH}${HASHPREFIX}${SHORTHASH}")
|
||||
set(REV_ISTAG 0)
|
||||
set(REV_ISSTABLETAG 0)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
# Restore LC_ALL
|
||||
set(ENV{LC_ALL} "${SAVED_LC_ALL}")
|
||||
elseif (EXISTS "${CMAKE_SOURCE_DIR}/.ottdrev")
|
||||
elseif(EXISTS "${CMAKE_SOURCE_DIR}/.ottdrev")
|
||||
file(READ "${CMAKE_SOURCE_DIR}/.ottdrev" OTTDREV)
|
||||
string(REPLACE "\n" "" OTTDREV "${OTTDREV}")
|
||||
string(REPLACE "\t" ";" OTTDREV "${OTTDREV}")
|
||||
@@ -107,7 +107,7 @@ elseif (EXISTS "${CMAKE_SOURCE_DIR}/.ottdrev")
|
||||
list(GET OTTDREV 4 REV_ISTAG)
|
||||
list(GET OTTDREV 5 REV_ISSTABLETAG)
|
||||
list(GET OTTDREV 6 REV_YEAR)
|
||||
else ()
|
||||
else()
|
||||
message(WARNING "No version detected; this build will NOT be network compatible")
|
||||
set(REV_VERSION "norev0000")
|
||||
set(REV_ISODATE "19700101")
|
||||
@@ -116,25 +116,25 @@ else ()
|
||||
set(REV_ISTAG 0)
|
||||
set(REV_ISSTABLETAG 0)
|
||||
set(REV_YEAR "1970")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
message(STATUS "Version string: ${REV_VERSION}")
|
||||
|
||||
if (GENERATE_OTTDREV)
|
||||
if(GENERATE_OTTDREV)
|
||||
message(STATUS "Generating .ottdrev")
|
||||
file(WRITE ${CMAKE_SOURCE_DIR}/.ottdrev "${REV_VERSION}\t${REV_ISODATE}\t${REV_MODIFIED}\t${REV_HASH}\t${REV_ISTAG}\t${REV_ISSTABLETAG}\t${REV_YEAR}\n")
|
||||
else (GENERATE_OTTDREV)
|
||||
else()
|
||||
message(STATUS "Generating rev.cpp")
|
||||
configure_file("${CMAKE_SOURCE_DIR}/src/rev.cpp.in"
|
||||
"${FIND_VERSION_BINARY_DIR}/rev.cpp")
|
||||
|
||||
if (WIN32)
|
||||
if(WIN32)
|
||||
message(STATUS "Generating ottdres.rc")
|
||||
configure_file("${CMAKE_SOURCE_DIR}/src/os/windows/ottdres.rc.in"
|
||||
"${FIND_VERSION_BINARY_DIR}/ottdres.rc")
|
||||
endif (WIN32)
|
||||
endif()
|
||||
|
||||
message(STATUS "Generating CPackProperties.cmake")
|
||||
configure_file("${CMAKE_SOURCE_DIR}/CPackProperties.cmake.in"
|
||||
"${CPACK_BINARY_DIR}/CPackProperties.cmake" @ONLY)
|
||||
endif (GENERATE_OTTDREV)
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user