From 479a17f0670496cc6560a1a143473960c1a95bb0 Mon Sep 17 00:00:00 2001 From: Florent Pruvost <florent.pruvost@inria.fr> Date: Wed, 4 Mar 2015 13:53:58 +0000 Subject: [PATCH] add gcc flag --no-as-needed only if gnu and Linux --- CMakeLists.txt | 6 +++--- cmake_modules/morse/find/FindBLAS.cmake | 5 ++++- cmake_modules/morse/find/FindFFTW.cmake | 4 +++- cmake_modules/morse/find/FindLAPACK.cmake | 5 ++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9852ac6c0..293f44544 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -880,11 +880,11 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/") get_directory_property( CHAMELEON_DEFINITIONS_LIST DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS ) include(PrintOpts) - if (${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local" OR ${CMAKE_INSTALL_PREFIX} STREQUAL "C:/Program Files") + if (CMAKE_INSTALL_PREFIX STREQUAL "/usr/local" OR CMAKE_INSTALL_PREFIX STREQUAL "C:/Program Files") message("-- ${Yellow}Your CMAKE_INSTALL_PREFIX is ${CMAKE_INSTALL_PREFIX} which is a default system path." - "You may want to change it: set the CMAKE_INSTALL_PREFIX variable to do so.${ColourReset}") + "You may want to change it: set the CMAKE_INSTALL_PREFIX variable to do so${ColourReset}") else() - message("-- ${Yellow}Your CMAKE_INSTALL_PREFIX is ${CMAKE_INSTALL_PREFIX}.${ColourReset}") + message("-- ${Yellow}Your CMAKE_INSTALL_PREFIX is ${CMAKE_INSTALL_PREFIX}${ColourReset}") endif() else(MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/cmake_modules/") diff --git a/cmake_modules/morse/find/FindBLAS.cmake b/cmake_modules/morse/find/FindBLAS.cmake index d2b71bcff..82b7dd4cf 100644 --- a/cmake_modules/morse/find/FindBLAS.cmake +++ b/cmake_modules/morse/find/FindBLAS.cmake @@ -307,7 +307,10 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") set(BLAS_SEARCH_LIBS "") - set(additional_flags "-Wl,--no-as-needed") + set(additional_flags "") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(additional_flags "-Wl,--no-as-needed") + endif() if(BLA_F95) diff --git a/cmake_modules/morse/find/FindFFTW.cmake b/cmake_modules/morse/find/FindFFTW.cmake index cf9e46ea6..801c85207 100644 --- a/cmake_modules/morse/find/FindFFTW.cmake +++ b/cmake_modules/morse/find/FindFFTW.cmake @@ -373,7 +373,9 @@ if( NOT FFTW_FOUND ) # MKL if(FFTW_LOOK_FOR_MKL) list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT};-lm") - list(APPEND REQUIRED_LDFLAGS "-Wl,--no-as-needed") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux") + list(APPEND REQUIRED_LDFLAGS "-Wl,--no-as-needed") + endif() endif() # set required libraries for link diff --git a/cmake_modules/morse/find/FindLAPACK.cmake b/cmake_modules/morse/find/FindLAPACK.cmake index 1f27e6c9e..66070b084 100644 --- a/cmake_modules/morse/find/FindLAPACK.cmake +++ b/cmake_modules/morse/find/FindLAPACK.cmake @@ -366,7 +366,10 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") set(LAPACK_SEARCH_LIBS "") - set(additional_flags "-Wl,--no-as-needed") + set(additional_flags "") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(additional_flags "-Wl,--no-as-needed") + endif() if (BLA_F95) set(LAPACK_mkl_SEARCH_SYMBOL "CHEEV") -- GitLab