Skip to content

Commit b401e6d

Browse files
Update cmake to remove duplication
1 parent 6b6a727 commit b401e6d

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/libpsl-native/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@ project(PSL-NATIVE)
33

44
# Can't use add_compile_options with 2.8.11
55
set(CMAKE_BUILD_TYPE "Release")
6-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror -fstack-protector-strong -fpie -D_FORTIFY_SOURCE=2 -DGLIBC_MIN_VERSION=2.27 -gdwarf-5")
6+
7+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror -fstack-protector-strong -fpie -D_FORTIFY_SOURCE=2 -gdwarf-5")
8+
9+
if(NOT DEFINED PS_GLIBC_MIN_VERSION)
10+
set(PS_GLIBC_MIN_VERSION "2.27"
11+
CACHE STRING "Minimum glibc version for this build")
12+
endif()
13+
14+
add_compile_definitions(GLIBC_MIN_VERSION=${PS_GLIBC_MIN_VERSION})
15+
716

817
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR "FreeBSD")
918
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,relro,-z,now")

src/libpsl-native/arm.toolchain.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
set(CMAKE_SYSTEM_NAME Linux)
22
set(CMAKE_SYSTEM_VERSION 1)
33
set(CMAKE_SYSTEM_PROCESSOR armv7l)
4-
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++ -fstack-protector-strong -fpie -D_FORTIFY_SOURCE=2 -DGLIBC_MIN_VERSION=2.35)
4+
set(PS_GLIBC_MIN_VERSION "2.35" CACHE STRING "Minimum glibc version for this toolchain")
5+
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++ -fstack-protector-strong -fpie -D_FORTIFY_SOURCE=2)
56
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,relro,-z,now")
67
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
78

src/libpsl-native/arm64.toolchain.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
set(CMAKE_SYSTEM_NAME Linux)
22
set(CMAKE_SYSTEM_VERSION 1)
33
set(CMAKE_SYSTEM_PROCESSOR aarch64)
4-
set(CMAKE_CXX_COMPILER g++ -fstack-protector-strong -fpie -D_FORTIFY_SOURCE=2 -DGLIBC_MIN_VERSION=2.27)
4+
set(CMAKE_CXX_COMPILER g++ -fstack-protector-strong -fpie -D_FORTIFY_SOURCE=2)
55
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,relro,-z,now")
66
set(CMAKE_C_COMPILER gcc)
77

0 commit comments

Comments
 (0)