From 6eb84e42f2db3164b82aa00eac5184097e4496b2 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 7 Mar 2019 13:59:18 -0800 Subject: [PATCH] cmake: Remove invalid clang syntax Clang compiler uses the same syntax for sending flags to the linker as gcc. If we use -XLinker, we can't use comma-separated options but there appears to be no reason to anyway. Removes extra warning quieting that was added for compiling Boost in tree. --- CMakeLists.txt | 45 ++++++++++++++------------------------------- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c170e76bd5..b8e34f8362 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -266,7 +266,7 @@ endif(USE_CCACHE) #================================================ -# Provide access to CCACHE +# Provide access to DISTCC #================================================ if (USE_DISTCC) find_program(DISTCC_FOUND distcc) @@ -287,18 +287,9 @@ endif(USE_DISTCC) if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) - execute_process( COMMAND ${CMAKE_C_COMPILER} -dumpversion - OUTPUT_VARIABLE GCC_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE ) - - if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) - set( TO_LINKER -XLinker ) - else() - set( TO_LINKER -Wl ) - # Set 32-bit flag for GCC to prevent excess precision - if( CMAKE_SIZEOF_VOID_P EQUAL 4 ) - set( CMAKE_CXX_FLAGS "-ffloat-store ${CMAKE_CXX_FLAGS}" ) - endif() + # Set 32-bit flag for GCC to prevent excess precision + if( CMAKE_SIZEOF_VOID_P EQUAL 4 ) + set( CMAKE_CXX_FLAGS "-ffloat-store ${CMAKE_CXX_FLAGS}" ) endif() # Establish -Wall early, so specialized relaxations of this may come @@ -347,29 +338,21 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) # snprintf add_definitions(-D__USE_MINGW_ANSI_STDIO=1) - else() - if( NOT APPLE ) - # Thou shalt not link vaporware and tell us it's a valid DSO (apple ld doesn't support it) - set( CMAKE_SHARED_LINKER_FLAGS "${TO_LINKER},--no-undefined" ) - set( CMAKE_MODULE_LINKER_FLAGS "${TO_LINKER},--no-undefined" ) + elseif( NOT APPLE ) + # Thou shalt not link vaporware and tell us it's a valid DSO (apple ld doesn't support it) + set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" ) + set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" ) - set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" ) + set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" ) - # Defeat ELF's ability to use the GOT to replace locally implemented functions - # with ones from another module. - # https://bugs.launchpad.net/kicad/+bug/1322354 - set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${TO_LINKER},-Bsymbolic" ) - set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${TO_LINKER},-Bsymbolic" ) - endif() + # Defeat ELF's ability to use the GOT to replace locally implemented functions + # with ones from another module. + # https://bugs.launchpad.net/kicad/+bug/1322354 + set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-Bsymbolic" ) + set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-Bsymbolic" ) endif() - # quiet GCC while in boost - if( GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8 OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs" ) - endif() - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-aliasing" ) - if( APPLE ) set( CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -headerpad_max_install_names") # needed by fixbundle endif()