aboutsummaryrefslogtreecommitdiffhomepage
path: root/CMake
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2021-05-29 00:35:37 +0300
committerlevlam <levlam@telegram.org>2021-05-29 00:35:37 +0300
commitbfb2be101819ade11d5ce777f29d0b8dae1316a5 (patch)
tree3b9b102104f215c04ccfc53421f5d4a208ebd410 /CMake
parenta77707d8d580dacc57ff6f88fc05faa5bbcd8e6d (diff)
Improve linker flags.
Diffstat (limited to 'CMake')
-rw-r--r--CMake/TdSetUpCompiler.cmake14
1 files changed, 8 insertions, 6 deletions
diff --git a/CMake/TdSetUpCompiler.cmake b/CMake/TdSetUpCompiler.cmake
index c4a580fd8..d168a5960 100644
--- a/CMake/TdSetUpCompiler.cmake
+++ b/CMake/TdSetUpCompiler.cmake
@@ -51,19 +51,21 @@ function(td_set_up_compiler)
elseif (CLANG OR GCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${STD14_FLAG} -fno-omit-frame-pointer -fno-exceptions -fno-rtti")
if (APPLE)
- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-dead_strip,-x,-S")
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-dead_strip,-x,-S")
+ set(TD_LINKER_FLAGS "-Wl,-dead_strip")
+ if (NOT CMAKE_BUILD_TYPE MATCHES "Deb")
+ set(TD_LINKER_FLAGS "${TD_LINKER_FLAGS},-x,-S")
+ endif()
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
if (CMAKE_SYSTEM_NAME STREQUAL "SunOS")
- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,ignore")
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,ignore")
+ set(TD_LINKER_FLAGS "-Wl,-z,ignore")
else()
- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL")
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL")
+ set(TD_LINKER_FLAGS "-Wl,--gc-sections -Wl,--exclude-libs,ALL")
endif()
endif()
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${TD_LINKER_FLAGS}")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TD_LINKER_FLAGS}")
if (WIN32 OR CYGWIN)
if (GCC)