diff options
author | Leif Walsh <leif.walsh@gmail.com> | 2014-05-20 14:39:56 -0400 |
---|---|---|
committer | Leif Walsh <leif.walsh@gmail.com> | 2014-05-20 14:39:56 -0400 |
commit | bfe318a43372d1ebc974baf2bad26fb65017d9cb (patch) | |
tree | 34003d86c2bd6a35a4fc51fbc6bc1ddd59614aa3 | |
parent | ac31894df60b1cef31729b9d538823a2296f2f2c (diff) | |
download | mariadb-git-bfe318a43372d1ebc974baf2bad26fb65017d9cb.tar.gz |
moved/cleaned up gcc-ar/gcc-ranlib checking #245
-rw-r--r-- | CMakeLists.txt | 25 | ||||
-rw-r--r-- | cmake_modules/TokuSetupCompiler.cmake | 8 |
2 files changed, 25 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 30de495271e..5a5a9713b4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,31 @@ project(TokuDB) set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") +## Versions of gcc >= 4.9.0 require special version of 'ar' and 'ranlib' for +## link-time optimizations to work properly. +## +## From https://gcc.gnu.org/gcc-4.9/changes.html: +## +## When using a linker plugin, compiling with the -flto option now +## generates slim objects files (.o) which only contain intermediate +## language representation for LTO. Use -ffat-lto-objects to create +## files which contain additionally the object code. To generate +## static libraries suitable for LTO processing, use gcc-ar and +## gcc-ranlib; to list symbols from a slim object file use +## gcc-nm. (Requires that ar, ranlib and nm have been compiled with +## plugin support.) +if ((CMAKE_CXX_COMPILER_ID STREQUAL GNU) AND + NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9.0")) + find_program(gcc_ar "gcc-ar") + if (gcc_ar) + set(CMAKE_AR "${gcc_ar}") + endif () + find_program(gcc_ranlib "gcc-ranlib") + if (gcc_ranlib) + set(CMAKE_RANLIB "${gcc_ranlib}") + endif () +endif() + include(TokuFeatureDetection) include(TokuSetupCompiler) include(TokuSetupCTest) diff --git a/cmake_modules/TokuSetupCompiler.cmake b/cmake_modules/TokuSetupCompiler.cmake index 316d0757fdc..4b8a600f141 100644 --- a/cmake_modules/TokuSetupCompiler.cmake +++ b/cmake_modules/TokuSetupCompiler.cmake @@ -137,14 +137,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL Clang) set(CMAKE_C_FLAGS_RELEASE "-g -O3 ${CMAKE_C_FLAGS_RELEASE} -UNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-g -O3 ${CMAKE_CXX_FLAGS_RELEASE} -UNDEBUG") else () - if (CMAKE_CXX_COMPILER_ID MATCHES GNU) - ## Versions of gcc >= 4.9.0 require special version of 'ar' and 'ranlib' for - ## link-time optimizations to work properly. - if (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9.0")) - set(CMAKE_AR "gcc-ar") - set(CMAKE_RANLIB "gcc-ranlib") - endif() - endif() # we overwrite this because the default passes -DNDEBUG and we don't want that set(CMAKE_C_FLAGS_RELWITHDEBINFO "-flto -fuse-linker-plugin ${CMAKE_C_FLAGS_RELWITHDEBINFO} -g -O3 -UNDEBUG") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-flto -fuse-linker-plugin ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -O3 -UNDEBUG") |