--- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,7 @@ set (GENERIC_FLAGS "-Wall -Wextra -Wundef -Wpointer-arith -Wunreachable-code -Wunused -Wdeprecated-declarations -fno-omit-frame-pointer -fstack-protector-strong") #set (GENERIC_GNU_FLAGS "${COMPILER_OPTIMIZATION_FLAG} -Wcast-align -Wswitch-enum -fvisibility=default -pedantic") set (GENERIC_GNU_FLAGS "${COMPILER_OPTIMIZATION_FLAG} -Wcast-align -Wswitch-enum -fvisibility=default -pedantic -ffunction-sections -fdata-sections -pipe") -if(NOT APPLE) +if(NOT (APPLE OR "${CMAKE_C_COMPILER_LINKER_ID}" MATCHES "LLD") ) set (GENERIC_GNU_LINK_FLAGS "-Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined") endif() set (GENERIC_C_FLAGS "${GENERIC_FLAGS} -fno-exceptions") --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -566,7 +566,7 @@ if(NOT ICONV_LIBRARIES) set(ICONV_LIBRARIES "") endif() -if(NOT APPLE) +if(NOT (APPLE OR "${CMAKE_C_COMPILER_LINKER_ID}" MATCHES "LLD") ) set(TURN_OFF_AS_NEEDED "-Wl,--no-as-needed") set(TURN_ON_AS_NEEDED "-Wl,--as-needed") endif()