Skip to content

Commit 14e7b57

Browse files
committed
Setting up project version and setting plan for next steps
1 parent b16117a commit 14e7b57

File tree

2 files changed

+53
-4
lines changed

2 files changed

+53
-4
lines changed

CMakeLists.txt

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2-
# SPDX-License-Identifier: Apache-2.0.
2+
# SPDX-License-Identifier: Apache-2.0
33
#
44

55
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
@@ -20,17 +20,46 @@ else ()
2020
message(STATUS "Building with 1.10 CMake scripts.")
2121
string(CONCAT DESCRIPTION_STRING "The AWS SDK for C++ provides a modern C++ (standard version C++11 or later) "
2222
"interface for Amazon Web Services (AWS).")
23+
24+
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
25+
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
26+
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE
27+
STRING "Choose the type of build." FORCE)
28+
# cmake-gui helper
29+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
30+
endif ()
31+
32+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
33+
include(sdk_versioning)
34+
obtain_project_version(SDK_PROJECT_VERSION)
35+
2336
project("aws-cpp-sdk"
2437
LANGUAGES CXX
25-
VERSION 1.10.0
38+
VERSION ${SDK_PROJECT_VERSION}
2639
DESCRIPTION ${DESCRIPTION_STRING}
2740
HOMEPAGE_URL "https://docs.aws.amazon.com/sdk-for-cpp"
2841
)
2942
set(CMAKE_CXX_STANDARD 11)
3043
set(CMAKE_CXX_EXTENSIONS OFF)
3144
set(CMAKE_CXX_STANDARD_REQUIRED ON)
3245

33-
message(STATUS "Building ${PROJECT_NAME} ${PROJECT_VERSION}")
46+
message(STATUS "Building ${PROJECT_NAME} ${CMAKE_PROJECT_VERSION}")
47+
48+
49+
message(WARNING "Anything below this warning is a TODO not yet implemented.")
50+
51+
message(STATUS "Detecting toolchain and external dependencies.")
52+
message(STATUS "Prepare CRT dependency.")
53+
message(STATUS "Setting up core library.")
54+
message(STATUS "Building core library.")
55+
message(STATUS "Building core library tests.")
56+
message(STATUS "Add support for static analysis.")
57+
message(STATUS "Building client libraries.")
58+
message(STATUS "Setting up tests.")
59+
message(STATUS "Setting up installation.")
60+
message(STATUS "Setting up packaging. ")
61+
message(STATUS "Setting up docs.")
62+
message(STATUS "Add support support for SDK flags.")
63+
message(STATUS "Add previously available options.")
3464

35-
message(WARNING "This builds nothing yet.")
3665
endif ()

cmake/sdk_versioning.cmake

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
include_guard()
2+
3+
function(obtain_project_version resultVar)
4+
find_package(Git QUIET)
5+
if (GIT_FOUND)
6+
execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git describe --abbrev=0 --tags
7+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
8+
OUTPUT_VARIABLE VERSION_STRING
9+
OUTPUT_STRIP_TRAILING_WHITESPACE)
10+
endif ()
11+
12+
if (NOT VERSION_STRING)
13+
# extract it from the existing generated header file
14+
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/src/aws-cpp-sdk-core/include/aws/core/VersionConfig.h" __SDK_VERSION_LINE LIMIT_COUNT 1 REGEX "AWS_SDK_VERSION_STRING.*[0-9]+\\.[0-9]+\\.[0-9]+")
15+
string(REGEX MATCH "([0-9]+\\.[0-9]+\\.[0-9]+)" VERSION_STRING "${__SDK_VERSION_LINE}")
16+
endif ()
17+
18+
set(${resultVar} ${VERSION_STRING} PARENT_SCOPE)
19+
message(STATUS "SDK project version: ${VERSION_STRING}")
20+
endfunction(obtain_project_version)

0 commit comments

Comments
 (0)