-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
27 lines (20 loc) · 1.02 KB
/
Copy pathCMakeLists.txt
File metadata and controls
27 lines (20 loc) · 1.02 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
cmake_minimum_required(VERSION 3.9)
# Set the C++ standard from the environment variable
if(NOT DEFINED CPP_VERSION)
set(CPP_VERSION 11) # Default to C++11 if not set
endif()
set(CMAKE_CXX_STANDARD ${CPP_VERSION})
project(hello LANGUAGES CXX)
message(STATUS "Project name: ${PROJECT_NAME}")
find_package(aws-lambda-runtime)
add_executable(${PROJECT_NAME} "main.cpp")
target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-lambda-runtime)
# Dynamically set the compile features based on CPP_VERSION
string(CONCAT CXX_STD_FEATURE "cxx_std_" ${CPP_VERSION})
target_compile_features(${PROJECT_NAME} PRIVATE ${CXX_STD_FEATURE})
target_compile_options(${PROJECT_NAME} PRIVATE "-Wall" "-Wextra")
# Important is, that if you are building in an amazon linux environment
# you have to include aws_lambda_package_target(hello NO_LIBC) to your CMakeLists.txt.
# This is in order to not include the C runtime as a dependency.
# this line creates a target that packages your binary and zips it up
aws_lambda_package_target(${PROJECT_NAME} NO_LIBC)