summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-09-15 18:09:10 (GMT)
committerBrad King <brad.king@kitware.com>2006-09-15 18:09:10 (GMT)
commit1d0502927c32cb3a14c101da16d7ab97901dc2a2 (patch)
treea42fea8061717baf973c3d1588f7ca0f136aa3d1 /Modules
parent429571bd1f35541f1d5c64d3d46bdc2e6b0a95ac (diff)
downloadCMake-1d0502927c32cb3a14c101da16d7ab97901dc2a2.zip
CMake-1d0502927c32cb3a14c101da16d7ab97901dc2a2.tar.gz
CMake-1d0502927c32cb3a14c101da16d7ab97901dc2a2.tar.bz2
ENH: Adding support to link specifically to an archive or a shared library based on the file name specified. This fixes the problem of having -lfoo linking to libfoo.so even when it came from libfoo.a being specified.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeCXXInformation.cmake16
-rw-r--r--Modules/CMakeSystemSpecificInformation.cmake1
-rw-r--r--Modules/Platform/Linux.cmake10
3 files changed, 22 insertions, 5 deletions
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index 8d05933..4e03bf3 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -72,10 +72,6 @@ IF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS)
SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS})
ENDIF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS)
-IF(NOT CMAKE_SHARED_MODULE_LINK_CXX_FLAGS)
- SET(CMAKE_SHARED_MODULE_LINK_CXX_FLAGS ${CMAKE_SHARED_MODULE_LINK_C_FLAGS})
-ENDIF(NOT CMAKE_SHARED_MODULE_LINK_CXX_FLAGS)
-
IF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG)
SET(CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG ${CMAKE_SHARED_MODULE_RUNTIME_FLAG})
ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG)
@@ -84,6 +80,18 @@ IF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP)
SET(CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_MODULE_RUNTIME_FLAG_SEP})
ENDIF(NOT CMAKE_SHARED_MODULE_RUNTIME_CXX_FLAG_SEP)
+# Initialize CXX link type selection flags from C versions.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ IF(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS)
+ SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS
+ ${CMAKE_${type}_LINK_STATIC_C_FLAGS})
+ ENDIF(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS)
+ IF(NOT CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS)
+ SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS
+ ${CMAKE_${type}_LINK_DYNAMIC_C_FLAGS})
+ ENDIF(NOT CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS)
+ENDFOREACH(type)
+
# add the flags to the cache based
# on the initial values computed in the platform/*.cmake files
# use _INIT variables so that this only happens the first time
diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake
index 099c45e..53905eb 100644
--- a/Modules/CMakeSystemSpecificInformation.cmake
+++ b/Modules/CMakeSystemSpecificInformation.cmake
@@ -30,7 +30,6 @@ ENDIF(EXISTS ${CMAKE_SYSTEM_INFO_FILE})
IF(NOT CMAKE_MODULE_EXISTS)
SET(CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}")
SET(CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}")
- SET(CMAKE_SHARED_MODULE_LINK_C_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS})
SET(CMAKE_SHARED_MODULE_RUNTIME_C_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG})
SET(CMAKE_SHARED_MODULE_RUNTIME_C_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
ENDIF(NOT CMAKE_MODULE_EXISTS)
diff --git a/Modules/Platform/Linux.cmake b/Modules/Platform/Linux.cmake
index 9174eb6..498e491 100644
--- a/Modules/Platform/Linux.cmake
+++ b/Modules/Platform/Linux.cmake
@@ -8,4 +8,14 @@ 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,")
SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-soname,")
+
+# Initialize C link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
+ENDFOREACH(type)
+
INCLUDE(Platform/UnixPaths)