diff options
author | Brad King <brad.king@kitware.com> | 2009-12-02 20:17:53 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-12-02 20:17:53 (GMT) |
commit | 4d72006bd6ba8c471236a9732ae4fd9cc9e90cfa (patch) | |
tree | 3665c5144e0d62b4c9150064babc6bf322802447 /Modules | |
parent | 9daa4a6c3f3106adf02c9f8bc587fa8096a56b3b (diff) | |
download | CMake-4d72006bd6ba8c471236a9732ae4fd9cc9e90cfa.zip CMake-4d72006bd6ba8c471236a9732ae4fd9cc9e90cfa.tar.gz CMake-4d72006bd6ba8c471236a9732ae4fd9cc9e90cfa.tar.bz2 |
Reduce duplication in Platform/<os>.cmake files
Several platform-wide linker flag variables are defined in
Modules/Platform/<os>.cmake files for C and then copied by the
Modules/CMake<lang>Information.cmake file for each language.
We now use this approach for the variables
CMAKE_EXE_EXPORTS_${lang}_FLAG
CMAKE_SHARED_LIBRARY_SONAME_${lang}_FLAG
CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS
to avoid duplication for multiple languages in each platform file.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeCXXInformation.cmake | 8 | ||||
-rw-r--r-- | Modules/CMakeFortranInformation.cmake | 8 | ||||
-rw-r--r-- | Modules/Platform/BeOS.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/Darwin.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/FreeBSD.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/GNU.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/Haiku.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/IRIX.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/IRIX64.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/Linux-Intel-Fortran.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/Linux-SunPro-C.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/Linux.cmake | 3 | ||||
-rw-r--r-- | Modules/Platform/NetBSD.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/OSF1.cmake | 1 | ||||
-rw-r--r-- | Modules/Platform/QNX.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/syllable.cmake | 2 |
16 files changed, 16 insertions, 22 deletions
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 9221831..0a7e990 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -114,6 +114,14 @@ IF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG) SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) ENDIF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG) +IF(NOT DEFINED CMAKE_EXE_EXPORTS_CXX_FLAG) + SET(CMAKE_EXE_EXPORTS_CXX_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG}) +ENDIF() + +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG) + SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG}) +ENDIF() + IF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG) SET(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}) ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG) diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index c57c959..97a5e7e 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -89,6 +89,14 @@ IF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG) SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) ENDIF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG) +IF(NOT DEFINED CMAKE_EXE_EXPORTS_Fortran_FLAG) + SET(CMAKE_EXE_EXPORTS_Fortran_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG}) +ENDIF() + +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG) + SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG}) +ENDIF() + # repeat for modules IF(NOT CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) diff --git a/Modules/Platform/BeOS.cmake b/Modules/Platform/BeOS.cmake index c4b66bb..41aa8f7 100644 --- a/Modules/Platform/BeOS.cmake +++ b/Modules/Platform/BeOS.cmake @@ -6,6 +6,5 @@ SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 825f218..1d88bf1 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -172,8 +172,6 @@ IF(NOT XCODE) # but the fact that the setting exists will cause the generators to support # soname computation. SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name") - SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-install_name") - SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-install_name") ENDIF(NOT XCODE) # Xcode does not support -isystem yet. diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake index e7b26ac..033db06 100644 --- a/Modules/Platform/FreeBSD.cmake +++ b/Modules/Platform/FreeBSD.cmake @@ -7,9 +7,7 @@ IF(EXISTS /usr/include/dlfcn.h) SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") - SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") - SET(CMAKE_EXE_EXPORTS_CXX_FLAG "-Wl,--export-dynamic") ENDIF(EXISTS /usr/include/dlfcn.h) # Shared libraries with no builtin soname may not be linked safely by diff --git a/Modules/Platform/GNU.cmake b/Modules/Platform/GNU.cmake index 1b4dded..fe3d47b 100644 --- a/Modules/Platform/GNU.cmake +++ b/Modules/Platform/GNU.cmake @@ -5,5 +5,4 @@ SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake index 532ca3f..8277a24 100644 --- a/Modules/Platform/Haiku.cmake +++ b/Modules/Platform/Haiku.cmake @@ -6,7 +6,6 @@ SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") INCLUDE(Platform/UnixPaths) LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH /boot/common) diff --git a/Modules/Platform/IRIX.cmake b/Modules/Platform/IRIX.cmake index 58c1037..fac941f 100644 --- a/Modules/Platform/IRIX.cmake +++ b/Modules/Platform/IRIX.cmake @@ -1,6 +1,5 @@ SET(CMAKE_DL_LIBS "") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") -SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -rdata_shared") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty IF(NOT CMAKE_COMPILER_IS_GNUCXX) diff --git a/Modules/Platform/IRIX64.cmake b/Modules/Platform/IRIX64.cmake index d83ca60..b60a7f2 100644 --- a/Modules/Platform/IRIX64.cmake +++ b/Modules/Platform/IRIX64.cmake @@ -1,10 +1,8 @@ SET(CMAKE_DL_LIBS "") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -rdata_shared") -SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -rdata_shared") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") IF(NOT CMAKE_COMPILER_IS_GNUCC) # Set default flags init. SET(CMAKE_C_FLAGS_INIT "") diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake index da3b935..60925c4 100644 --- a/Modules/Platform/Linux-Intel-Fortran.cmake +++ b/Modules/Platform/Linux-Intel-Fortran.cmake @@ -12,5 +12,4 @@ SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-shared -i_dynamic -nofor_main") SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-i_dynamic") SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,-rpath,") SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") -SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-soname,") SET(CMAKE_DL_LIBS "dl") diff --git a/Modules/Platform/Linux-SunPro-C.cmake b/Modules/Platform/Linux-SunPro-C.cmake index 74aedd0..45ef404 100644 --- a/Modules/Platform/Linux-SunPro-C.cmake +++ b/Modules/Platform/Linux-SunPro-C.cmake @@ -1,3 +1,2 @@ # Linux sun studio c options SET(CMAKE_DL_LIBS "dl") -SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake index 5858eb3..bde19b3 100644 --- a/Modules/Platform/Linux.cmake +++ b/Modules/Platform/Linux.cmake @@ -6,10 +6,7 @@ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-soname,") SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") -SET(CMAKE_EXE_EXPORTS_CXX_FLAG "-Wl,--export-dynamic") # Shared libraries with no builtin soname may not be linked safely by # specifying the file path. diff --git a/Modules/Platform/NetBSD.cmake b/Modules/Platform/NetBSD.cmake index abf0a61..0fb8636 100644 --- a/Modules/Platform/NetBSD.cmake +++ b/Modules/Platform/NetBSD.cmake @@ -7,9 +7,7 @@ IF(EXISTS /usr/include/dlfcn.h) SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") - SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") - SET(CMAKE_EXE_EXPORTS_CXX_FLAG "-Wl,--export-dynamic") ENDIF(EXISTS /usr/include/dlfcn.h) INCLUDE(Platform/UnixPaths) diff --git a/Modules/Platform/OSF1.cmake b/Modules/Platform/OSF1.cmake index 27af3b1..652bed4 100644 --- a/Modules/Platform/OSF1.cmake +++ b/Modules/Platform/OSF1.cmake @@ -12,7 +12,6 @@ ENDIF(CMAKE_SYSTEM MATCHES "OSF1-1.*") IF(CMAKE_SYSTEM MATCHES "OSF1-V.*") SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-expect_unresolved,\\*") # -shared - SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,-expect_unresolved,\\*") # -shared IF(CMAKE_COMPILER_IS_GNUCXX) SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,-rpath,") ELSE(CMAKE_COMPILER_IS_GNUCXX) diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index 88bb604..8cdbe02 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -12,9 +12,7 @@ SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,") SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,") SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") -SET(CMAKE_EXE_EXPORTS_CXX_FLAG "-Wl,--export-dynamic") # Shared libraries with no builtin soname may not be linked safely by # specifying the file path. diff --git a/Modules/Platform/syllable.cmake b/Modules/Platform/syllable.cmake index 2bcaf8c..3ce42f6 100644 --- a/Modules/Platform/syllable.cmake +++ b/Modules/Platform/syllable.cmake @@ -14,9 +14,7 @@ SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,") -SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-soname,") #SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic") -#SET(CMAKE_EXE_EXPORTS_CXX_FLAG "-Wl,--export-dynamic") # Initialize C link type selection flags. These flags are used when # building a shared library, shared module, or executable that links |