Skip to content

Commit 93fd61c

Browse files
committed
Removing internal dependencies on app sample project
1 parent 271f1d9 commit 93fd61c

File tree

1 file changed

+43
-13
lines changed

1 file changed

+43
-13
lines changed

tools/CI/install-test/CMakeLists.txt

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,45 @@
1-
cmake_minimum_required(VERSION 3.3)
1+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
cmake_minimum_required(VERSION 3.13)
5+
# -- Preamble --
6+
project("sample_app"
7+
LANGUAGES CXX
8+
VERSION 1.0
9+
DESCRIPTION "A testing app using AWS SDK for C++"
10+
)
11+
12+
# -- Project wide setup --
13+
# Setting C++ minimum requirements
214
set(CMAKE_CXX_STANDARD 11)
3-
project(app LANGUAGES CXX)
15+
set(CMAKE_CXX_EXTENSIONS OFF)
16+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
17+
18+
# Setting build to hide symbols in targets by default
19+
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
20+
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
21+
22+
# Preventing writes to package registry by default
23+
set(CMAKE_EXPORT_NO_PACKAGE_REGISTRY YES)
24+
25+
# Validating config type and setting default if needed
26+
get_property(is_multi_conf_build GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
27+
if (NOT is_multi_conf_build)
28+
set(allowed_build_types Debug Release RelWithDebInfo MinSizeRel)
29+
# cmake-gui helper
30+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${allowed_build_types}")
31+
if (NOT CMAKE_BUILD_TYPE)
32+
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
33+
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build." FORCE)
34+
elseif (NOT CMAKE_BUILD_TYPE IN_LIST allowed_build_types)
35+
message(FATAL_ERROR "Unknown build type: ${CMAKE_BUILD_TYPE}")
36+
endif ()
37+
endif ()
38+
39+
# -- Dependencies --
440
find_package(AWSSDK REQUIRED COMPONENTS s3-crt)
5-
add_executable(${PROJECT_NAME} "main.cpp")
6-
if(MSVC AND BUILD_SHARED_LIBS)
7-
target_compile_definitions(${PROJECT_NAME} PUBLIC "USE_IMPORT_EXPORT")
8-
add_definitions(-DUSE_IMPORT_EXPORT)
9-
# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.
10-
list(APPEND SERVICE_LIST s3-crt)
11-
AWSSDK_CPY_DYN_LIBS(SERVICE_LIST "" ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
12-
endif()
13-
set_compiler_flags(${PROJECT_NAME})
14-
set_compiler_warnings(${PROJECT_NAME})
15-
target_link_libraries(${PROJECT_NAME} ${AWSSDK_LINK_LIBRARIES})
41+
42+
# -- main build target --
43+
add_executable(app "main.cpp")
44+
target_link_libraries(app ${AWSSDK_LINK_LIBRARIES})
45+
target_include_directories(app ${AWSSDK_INCLUDE_DIRS})

0 commit comments

Comments
 (0)