-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathinitialize_project_version.cmake
More file actions
45 lines (38 loc) · 1.34 KB
/
initialize_project_version.cmake
File metadata and controls
45 lines (38 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git describe --abbrev=0 --tags
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
if(NOT VERSION_STRING)
# read it from the version file
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" VERSION_STRING)
endif()
set(PROJECT_VERSION "${VERSION_STRING}")
message(STATUS "Building project version: ${PROJECT_VERSION}")
macro(add_project name description)
set(PROJECT_NAME "${name}")
set(PROJECT_STRING "${name}_${PROJECT_VERSION}")
set(PROJECT_TARNAME "${name}-${PROJECT_VERSION}")
set(PROJECT_BUGREPORT "https://github.com/aws/aws-sdk-cpp/issues/")
set(PROJECT_DESCRIPTION "${description}")
set(PROJECT_LIBS "")
set(PROJECT_LIBS_STRING "")
foreach(library_var ${ARGN})
list(APPEND PROJECT_LIBS "${library_var}")
set(PROJECT_LIBS_STRING "${PROJECT_LIBS_STRING} ${library_var}")
endforeach()
if(POLICY CMP0028)
cmake_policy(SET CMP0028 NEW)
endif()
if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
if(POLICY CMP0056)
cmake_policy(SET CMP0056 NEW)
endif()
project(${name} VERSION "${PROJECT_VERSION}" LANGUAGES CXX C)
endmacro()