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.
This commit is contained in:
parent
9daa4a6c3f
commit
4d72006bd6
|
@ -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)
|
||||
|
|
|
@ -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})
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 "")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
# Linux sun studio c options
|
||||
SET(CMAKE_DL_LIBS "dl")
|
||||
SET(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue