# HG changeset patch # User koda # Date 1372931920 -7200 # Node ID 15487f7fed4249a1701b8e07670688f84ff0f898 # Parent 62032a4cd00b6826680b44ef7d4e6c827ec15a6d as-needed only at release time diff -r 62032a4cd00b -r 15487f7fed42 cmake_modules/compilerchecks.cmake --- a/cmake_modules/compilerchecks.cmake Wed Jul 03 17:35:17 2013 +0200 +++ b/cmake_modules/compilerchecks.cmake Thu Jul 04 11:58:40 2013 +0200 @@ -29,7 +29,7 @@ if(UNIX) - #symbol visibility, not supported on Windows (error out then) + #symbol visibility check_c_compiler_flag("-fvisibility=hidden" HAVE_VISIBILITY) if(HAVE_VISIBILITY) add_flag_append(CMAKE_C_FLAGS "-fvisibility=hidden") @@ -37,7 +37,7 @@ endif() #check for noexecstack on ELF, Gentoo security - set(CMAKE_REQUIRED_FLAGS "-Wl,-z,noexecstack") + set(CMAKE_REQUIRED_FLAGS "-Wl,-znoexecstack") check_c_compiler_flag("" HAVE_NOEXECSTACK) if(HAVE_NOEXECSTACK) add_linker_flag("-znoexecstack") @@ -58,11 +58,12 @@ endif() endif() - #this is actually an optimisation - set(CMAKE_REQUIRED_FLAGS "-Wl,--as-needed") - check_c_compiler_flag("" HAVE_ASNEEDED) - if(HAVE_ASNEEDED) - add_linker_flag("--as-needed") + if(CMAKE_BUILD_TYPE MATCHES "RELEASE") + set(CMAKE_REQUIRED_FLAGS "-Wl,--as-needed") + check_c_compiler_flag("" HAVE_ASNEEDED) + if(HAVE_ASNEEDED) + add_linker_flag("--as-needed") + endif() endif() else(UNIX) #check for ASLR on Windows Vista or later, requires binutils >= 2.20