From 48470eaa0072d1ce6e4f407c014d18197f4cd5c3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 5 Oct 2006 15:08:23 -0400 Subject: ENH: Enabling link-type selection flags on Cygwin, MSYS, and MinGW. This addresses bug#1644 on these platforms. --- Modules/Platform/CYGWIN.cmake | 10 ++++++++++ Modules/Platform/Windows-gcc.cmake | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index c7ccd98..0d508f0 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -27,4 +27,14 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY " -o -Wl,--out-implib, ") SET(CMAKE_CXX_CREATE_SHARED_LIBRARY " -o -Wl,--out-implib, ") + +# 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) diff --git a/Modules/Platform/Windows-gcc.cmake b/Modules/Platform/Windows-gcc.cmake index b3bf19f..a5152b3 100644 --- a/Modules/Platform/Windows-gcc.cmake +++ b/Modules/Platform/Windows-gcc.cmake @@ -34,3 +34,14 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY " -o -Wl,--out-implib, ") SET(CMAKE_CXX_CREATE_SHARED_LIBRARY " -o -Wl,--out-implib, ") + +# 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. +IF(MSYS OR MINGW) + 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) +ENDIF(MSYS OR MINGW) -- cgit v0.12