-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathaws-lambda-cpp-make-lto-optional.patch
36 lines (32 loc) · 1.25 KB
/
aws-lambda-cpp-make-lto-optional.patch
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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eb8327f..e6eeda5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,10 +4,9 @@ project(aws-lambda-runtime
VERSION 0.2.6
LANGUAGES CXX)
+option(ENABLE_LTO "Enables link-time optimization, requires compiler support." ON)
option(ENABLE_TESTS "Enables building the test project, requires AWS C++ SDK." OFF)
-include(CheckIPOSupported)
-
add_library(${PROJECT_NAME}
"src/logging.cpp"
"src/runtime.cpp"
@@ -23,11 +22,14 @@ target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
-check_ipo_supported(RESULT has_lto OUTPUT lto_check_output)
-if(has_lto)
- set_property(TARGET ${PROJECT_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
-else()
- message(WARNING "Link-time optimization (LTO) is not supported: ${lto_check_output}")
+if (ENABLE_LTO)
+ include(CheckIPOSupported)
+ check_ipo_supported(RESULT has_lto OUTPUT lto_check_output)
+ if(has_lto)
+ set_property(TARGET ${PROJECT_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
+ else()
+ message(WARNING "Link-time optimization (LTO) is not supported: ${lto_check_output}")
+ endif()
endif()
find_package(CURL REQUIRED)