summaryrefslogtreecommitdiff
path: root/cmake/modules/VersionInfo.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/VersionInfo.cmake')
-rw-r--r--cmake/modules/VersionInfo.cmake84
1 files changed, 44 insertions, 40 deletions
diff --git a/cmake/modules/VersionInfo.cmake b/cmake/modules/VersionInfo.cmake
index 2955ce1..53024c3 100644
--- a/cmake/modules/VersionInfo.cmake
+++ b/cmake/modules/VersionInfo.cmake
@@ -1,39 +1,38 @@
-set( MAJOR_VER 3 )
-set( MINOR_VER 10 )
-set( RELEASE_VER 1 )
-set( BUILD_VER 1208 )
if( $ENV{BUILD_NUMBER} )
- set( BUILD_VER 1208 )
-endif()
-
-if( WIN32 )
- execute_process( COMMAND "cmd.exe" "/C date /T" OUTPUT_VARIABLE BUILD_DATE )
- string( REGEX REPLACE ".*([0-3][0-9]).([0-1][0-9]).([0-9][0-9][0-9][0-9]).*" "\\1.\\2.\\3" BUILD_DATE ${BUILD_DATE} )
-elseif( UNIX )
- execute_process( COMMAND "date" "+%d.%m.%Y" OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE )
+ set( BUILD_VER $ENV{BUILD_NUMBER} )
+elseif(PROJECT_VERSION_TWEAK)
+ set( BUILD_VER ${PROJECT_VERSION_TWEAK} )
else()
- message( SEND_ERROR "date not implemented")
- set( BUILD_DATE "00.00.0000" )
+ set( BUILD_VER 0 )
+endif()
+if(NOT BUILD_DATE)
+ string(TIMESTAMP BUILD_DATE "%d.%m.%Y")
endif()
-set( VERSION ${MAJOR_VER}.${MINOR_VER}.${RELEASE_VER}.${BUILD_VER} )
+set( VERSION ${PROJECT_VERSION}.${BUILD_VER} )
add_definitions(
- -DMAJOR_VER=${MAJOR_VER}
- -DMINOR_VER=${MINOR_VER}
- -DRELEASE_VER=${RELEASE_VER}
+ -DMAJOR_VER=${PROJECT_VERSION_MAJOR}
+ -DMINOR_VER=${PROJECT_VERSION_MINOR}
+ -DRELEASE_VER=${PROJECT_VERSION_PATCH}
-DBUILD_VER=${BUILD_VER}
-DVER_SUFFIX=\"$ENV{VER_SUFFIX}\"
-DBUILD_DATE=\"${BUILD_DATE}\"
- -DDOMAINURL=\"ria.ee\"
- -DORG=\"RIA\"
)
-set( MACOSX_BUNDLE_COPYRIGHT "(C) 2010-2015 Estonian Information System Authority" )
-set( MACOSX_BUNDLE_SHORT_VERSION_STRING ${MAJOR_VER}.${MINOR_VER}.${RELEASE_VER} )
+set( MACOSX_BUNDLE_COPYRIGHT "(C) 2010-2018 Estonian Information System Authority" )
+set( MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION} )
set( MACOSX_BUNDLE_BUNDLE_VERSION ${BUILD_VER} )
set( MACOSX_BUNDLE_ICON_FILE Icon.icns )
-set( MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${MAJOR_VER}.${MINOR_VER}.${RELEASE_VER} )
+set( MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PROJECT_VERSION} )
set( MACOSX_FRAMEWORK_BUNDLE_VERSION ${BUILD_VER} )
+if( APPLE AND NOT IOS AND NOT CMAKE_OSX_DEPLOYMENT_TARGET )
+ execute_process(COMMAND xcodebuild -version -sdk macosx SDKVersion
+ OUTPUT_VARIABLE CMAKE_OSX_DEPLOYMENT_TARGET OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
+if( APPLE AND NOT CMAKE_OSX_SYSROOT )
+ execute_process(COMMAND xcodebuild -version -sdk macosx Path
+ OUTPUT_VARIABLE CMAKE_OSX_SYSROOT OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
macro( SET_APP_NAME OUTPUT NAME )
set( ${OUTPUT} "${NAME}" )
@@ -55,28 +54,38 @@ endmacro()
macro( add_manifest TARGET )
if( WIN32 )
add_custom_command(TARGET ${TARGET} POST_BUILD
- COMMAND mt -manifest "${CMAKE_MODULE_PATH}/win81.exe.manifest" -outputresource:"$<TARGET_FILE:${TARGET}>")
+ COMMAND mt -nologo -manifest "${CMAKE_MODULE_PATH}/win81.exe.manifest" -outputresource:"$<TARGET_FILE:${TARGET}>")
endif()
endmacro()
-macro( SET_EX NAME VAR DEF )
- if( "${VAR}" STREQUAL "" )
- set( ${NAME} ${DEF} ${ARGN} )
+macro( SET_ENV NAME DEF )
+ if( DEFINED ENV{${NAME}} )
+ set( ${NAME} $ENV{${NAME}} ${ARGN} )
else()
- set( ${NAME} ${VAR} ${ARGN} )
+ set( ${NAME} ${DEF} ${ARGN} )
endif()
endmacro()
-if(CMAKE_COMPILER_IS_GNUCC OR __COMPILER_GNU)
- if(NOT DEFINED ENABLE_VISIBILITY)
- set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+
+if(NOT DEFINED ENABLE_VISIBILITY)
+ if(POLICY CMP0063)
+ cmake_policy(GET CMP0063 VISIBILITY_POLICY)
+ endif()
+ if(VISIBILITY_POLICY STREQUAL NEW)
+ set(CMAKE_C_VISIBILITY_PRESET hidden)
+ set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+ set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
+ elseif(CMAKE_COMPILER_IS_GNUCC OR __COMPILER_GNU)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
- #set( CMAKE_C_VISIBILITY_PRESET hidden )
- #set( CMAKE_CXX_VISIBILITY_PRESET hidden )
- #set( CMAKE_VISIBILITY_INLINES_HIDDEN 1 )
endif()
+endif()
- if(NOT DISABLE_CXX11)
+if(NOT DISABLE_CXX11)
+ if(CMAKE_VERSION VERSION_GREATER 3.1.0)
+ set(CMAKE_CXX_STANDARD 11)
+ set(CMAKE_CXX_STANDARD_REQUIRED YES)
+ elseif(CMAKE_COMPILER_IS_GNUCC OR __COMPILER_GNU)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-std=c++11 C11)
CHECK_CXX_COMPILER_FLAG(-std=c++0x C0X)
@@ -87,9 +96,4 @@ if(CMAKE_COMPILER_IS_GNUCC OR __COMPILER_GNU)
endif()
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++0x")
endif()
- if(APPLE)
- set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
- set(CMAKE_OSX_DEPLOYMENT_TARGET "10.7")
- endif()
endif()