summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-06-12 20:01:04 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-06-12 20:01:04 (GMT)
commitc95d1baa194c8108841a8b973d3bbe50ca7d5666 (patch)
treebe3efd1ba2c1b58cb3d51242e246777527842efc /Modules
parentc6f6929e31a3e8067633aa57cf0775bced9d8443 (diff)
parentbd3496300262bd26073ce03e020731c592249148 (diff)
downloadCMake-c95d1baa194c8108841a8b973d3bbe50ca7d5666.zip
CMake-c95d1baa194c8108841a8b973d3bbe50ca7d5666.tar.gz
CMake-c95d1baa194c8108841a8b973d3bbe50ca7d5666.tar.bz2
Merge topic 'position-independent-targets'
bd34963 Refactor generation of shared library flags 55d7aa4 Add platform variable for flags specific to shared libraries 31d7a0f Add platform variables for position independent code flags
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeCXXInformation.cmake12
-rw-r--r--Modules/CMakeFortranInformation.cmake12
-rw-r--r--Modules/Compiler/GNU.cmake4
-rw-r--r--Modules/Compiler/SCO.cmake3
-rw-r--r--Modules/Compiler/SunPro-C.cmake2
-rw-r--r--Modules/Compiler/SunPro-CXX.cmake2
-rw-r--r--Modules/Platform/BeOS.cmake2
-rw-r--r--Modules/Platform/BlueGeneP-base.cmake4
-rw-r--r--Modules/Platform/CYGWIN-GNU.cmake5
-rw-r--r--Modules/Platform/FreeBSD.cmake4
-rw-r--r--Modules/Platform/HP-UX-HP.cmake1
-rw-r--r--Modules/Platform/Haiku.cmake2
-rw-r--r--Modules/Platform/Linux-Intel.cmake2
-rw-r--r--Modules/Platform/Linux-PGI.cmake2
-rw-r--r--Modules/Platform/Linux-PathScale.cmake2
-rw-r--r--Modules/Platform/MP-RAS.cmake4
-rw-r--r--Modules/Platform/NetBSD.cmake4
-rw-r--r--Modules/Platform/OSF1.cmake4
-rw-r--r--Modules/Platform/SINIX.cmake2
-rw-r--r--Modules/Platform/SunOS.cmake6
-rw-r--r--Modules/Platform/UNIX_SV.cmake2
-rw-r--r--Modules/Platform/UnixWare.cmake2
-rw-r--r--Modules/Platform/Windows-Embarcadero.cmake3
-rw-r--r--Modules/Platform/Windows-GNU.cmake6
-rw-r--r--Modules/Platform/Windows-wcl386.cmake3
-rw-r--r--Modules/Platform/syllable.cmake4
26 files changed, 89 insertions, 10 deletions
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index 608b833..9dc9cbd 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -100,6 +100,18 @@ IF(NOT CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS)
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
ENDIF(NOT CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS)
+IF(NOT CMAKE_CXX_COMPILE_OPTIONS_PIC)
+ SET(CMAKE_CXX_COMPILE_OPTIONS_PIC ${CMAKE_C_COMPILE_OPTIONS_PIC})
+ENDIF(NOT CMAKE_CXX_COMPILE_OPTIONS_PIC)
+
+IF(NOT CMAKE_CXX_COMPILE_OPTIONS_PIE)
+ SET(CMAKE_CXX_COMPILE_OPTIONS_PIE ${CMAKE_C_COMPILE_OPTIONS_PIE})
+ENDIF(NOT CMAKE_CXX_COMPILE_OPTIONS_PIE)
+
+IF(NOT CMAKE_CXX_COMPILE_OPTIONS_DLL)
+ SET(CMAKE_CXX_COMPILE_OPTIONS_DLL ${CMAKE_C_COMPILE_OPTIONS_DLL})
+ENDIF(NOT CMAKE_CXX_COMPILE_OPTIONS_DLL)
+
IF(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS)
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
ENDIF(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS)
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index 2cbd7f8..d962f4c 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -74,6 +74,18 @@ ENDIF()
# catch any modules
SET(CMAKE_NEEDS_REQUIRES_STEP_Fortran_FLAG 1)
+IF(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIC)
+ SET(CMAKE_Fortran_COMPILE_OPTIONS_PIC ${CMAKE_C_COMPILE_OPTIONS_PIC})
+ENDIF(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIC)
+
+IF(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIE)
+ SET(CMAKE_Fortran_COMPILE_OPTIONS_PIE ${CMAKE_C_COMPILE_OPTIONS_PIE})
+ENDIF(NOT CMAKE_Fortran_COMPILE_OPTIONS_PIE)
+
+IF(NOT CMAKE_Fortran_COMPILE_OPTIONS_DLL)
+ SET(CMAKE_Fortran_COMPILE_OPTIONS_DLL ${CMAKE_C_COMPILE_OPTIONS_DLL})
+ENDIF(NOT CMAKE_Fortran_COMPILE_OPTIONS_DLL)
+
# Create a set of shared library variable specific to Fortran
# For 90% of the systems, these are the same flags as the C versions
# so if these are not set just copy the flags from the c version
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index c74c179..6aecf90 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -21,6 +21,10 @@ set(__COMPILER_GNU 1)
macro(__compiler_gnu lang)
# Feature flags.
set(CMAKE_${lang}_VERBOSE_FLAG "-v")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
+ endif()
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
diff --git a/Modules/Compiler/SCO.cmake b/Modules/Compiler/SCO.cmake
index d3deeb1..f673c8f 100644
--- a/Modules/Compiler/SCO.cmake
+++ b/Modules/Compiler/SCO.cmake
@@ -20,6 +20,9 @@ set(__COMPILER_SCO 1)
macro(__compiler_sco lang)
# Feature flags.
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC -Kpic)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE -Kpie)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_DLL -belf)
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-Kpic -belf")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-belf -Wl,-Bexport")
endmacro()
diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake
index 656eea6..a1a3ae1 100644
--- a/Modules/Compiler/SunPro-C.cmake
+++ b/Modules/Compiler/SunPro-C.cmake
@@ -1,5 +1,7 @@
SET(CMAKE_C_VERBOSE_FLAG "-#")
+SET(CMAKE_C_COMPILE_OPTIONS_PIC -KPIC)
+SET(CMAKE_C_COMPILE_OPTIONS_PIE -KPIE)
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-KPIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-R")
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
index 3e07e8e..702e424 100644
--- a/Modules/Compiler/SunPro-CXX.cmake
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -1,5 +1,7 @@
SET(CMAKE_CXX_VERBOSE_FLAG "-v")
+SET(CMAKE_CXX_COMPILE_OPTIONS_PIC -KPIC)
+SET(CMAKE_CXX_COMPILE_OPTIONS_PIE -KPIE)
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R")
diff --git a/Modules/Platform/BeOS.cmake b/Modules/Platform/BeOS.cmake
index 41aa8f7..3ffb67c 100644
--- a/Modules/Platform/BeOS.cmake
+++ b/Modules/Platform/BeOS.cmake
@@ -1,6 +1,8 @@
SET(BEOS 1)
SET(CMAKE_DL_LIBS root be)
+SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
+SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
diff --git a/Modules/Platform/BlueGeneP-base.cmake b/Modules/Platform/BlueGeneP-base.cmake
index 926dbc0..c0241e1 100644
--- a/Modules/Platform/BlueGeneP-base.cmake
+++ b/Modules/Platform/BlueGeneP-base.cmake
@@ -85,11 +85,15 @@ set(CMAKE_DL_LIBS "dl")
macro(__BlueGeneP_set_dynamic_flags compiler_id lang)
if (${compiler_id} STREQUAL XL)
# Flags for XL compilers if we explicitly detected XL
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-qpic")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-qpie")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-qpic")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-qmkshrobj -qnostaticlink")
set(BGP_${lang}_DYNAMIC_EXE_FLAGS "-qnostaticlink -qnostaticlink=libgcc")
else()
# Assume flags for GNU compilers (if the ID is GNU *or* anything else).
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
set(BGP_${lang}_DYNAMIC_EXE_FLAGS "-dynamic")
diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake
index 5aad45b..eae313a 100644
--- a/Modules/Platform/CYGWIN-GNU.cmake
+++ b/Modules/Platform/CYGWIN-GNU.cmake
@@ -35,7 +35,10 @@ macro(__cygwin_compiler_gnu lang)
set(CMAKE_${lang}_LINK_EXECUTABLE
"<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>")
- set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on cygwin
+ # No -fPIC on cygwin
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
# Initialize C link type selection flags. These flags are used when
# building a shared library, shared module, or executable that links
diff --git a/Modules/Platform/FreeBSD.cmake b/Modules/Platform/FreeBSD.cmake
index 033db06..82fe961 100644
--- a/Modules/Platform/FreeBSD.cmake
+++ b/Modules/Platform/FreeBSD.cmake
@@ -1,6 +1,8 @@
IF(EXISTS /usr/include/dlfcn.h)
SET(CMAKE_DL_LIBS "")
- SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
+ SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
+ SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+ 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_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
diff --git a/Modules/Platform/HP-UX-HP.cmake b/Modules/Platform/HP-UX-HP.cmake
index bce0a8b..871ea13 100644
--- a/Modules/Platform/HP-UX-HP.cmake
+++ b/Modules/Platform/HP-UX-HP.cmake
@@ -19,6 +19,7 @@ endif()
set(__HPUX_COMPILER_HP 1)
macro(__hpux_compiler_hp lang)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "+Z")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "+Z")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-Wl,-E,+nodefaultrpath -b -L/usr/lib")
set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,+s,-E,+nodefaultrpath")
diff --git a/Modules/Platform/Haiku.cmake b/Modules/Platform/Haiku.cmake
index 8277a24..9dda3c5 100644
--- a/Modules/Platform/Haiku.cmake
+++ b/Modules/Platform/Haiku.cmake
@@ -1,6 +1,8 @@
SET(BEOS 1)
SET(CMAKE_DL_LIBS root be)
+SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
+SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-nostart")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
diff --git a/Modules/Platform/Linux-Intel.cmake b/Modules/Platform/Linux-Intel.cmake
index dea8b90..47bf246 100644
--- a/Modules/Platform/Linux-Intel.cmake
+++ b/Modules/Platform/Linux-Intel.cmake
@@ -31,6 +31,8 @@ if(NOT XIAR)
endif(NOT XIAR)
macro(__linux_compiler_intel lang)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
diff --git a/Modules/Platform/Linux-PGI.cmake b/Modules/Platform/Linux-PGI.cmake
index ef06acd..3cbb35c 100644
--- a/Modules/Platform/Linux-PGI.cmake
+++ b/Modules/Platform/Linux-PGI.cmake
@@ -20,6 +20,8 @@ set(__LINUX_COMPILER_PGI 1)
macro(__linux_compiler_pgi lang)
# Shared library compile and link flags.
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
endmacro()
diff --git a/Modules/Platform/Linux-PathScale.cmake b/Modules/Platform/Linux-PathScale.cmake
index c131af2..d230ab2 100644
--- a/Modules/Platform/Linux-PathScale.cmake
+++ b/Modules/Platform/Linux-PathScale.cmake
@@ -20,6 +20,8 @@ set(__LINUX_COMPILER_PATHSCALE 1)
macro(__linux_compiler_pathscale lang)
# Shared library compile and link flags.
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "-fPIC")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-fPIC")
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
endmacro()
diff --git a/Modules/Platform/MP-RAS.cmake b/Modules/Platform/MP-RAS.cmake
index 1e3e239..ff22a4f 100644
--- a/Modules/Platform/MP-RAS.cmake
+++ b/Modules/Platform/MP-RAS.cmake
@@ -1,6 +1,10 @@
IF(CMAKE_SYSTEM MATCHES "MP-RAS-02*.")
+ SET(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC)
+ SET(CMAKE_C_COMPILE_OPTIONS_PIE -K PIE)
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
ELSE(CMAKE_SYSTEM MATCHES "MP-RAS-02*.")
+ SET(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC)
+ SET(CMAKE_C_COMPILE_OPTIONS_PIE -K PIE)
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-Bexport")
ENDIF(CMAKE_SYSTEM MATCHES "MP-RAS-02*.")
diff --git a/Modules/Platform/NetBSD.cmake b/Modules/Platform/NetBSD.cmake
index 0fb8636..e1b66b8 100644
--- a/Modules/Platform/NetBSD.cmake
+++ b/Modules/Platform/NetBSD.cmake
@@ -1,6 +1,8 @@
IF(EXISTS /usr/include/dlfcn.h)
SET(CMAKE_DL_LIBS "")
- SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
+ SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
+ SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+ 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_RUNTIME_C_FLAG "-Wl,-rpath,") # -rpath
diff --git a/Modules/Platform/OSF1.cmake b/Modules/Platform/OSF1.cmake
index 076410a..49a30e9 100644
--- a/Modules/Platform/OSF1.cmake
+++ b/Modules/Platform/OSF1.cmake
@@ -4,7 +4,9 @@ IF(CMAKE_SYSTEM MATCHES "OSF1-1.[012]")
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-1.[012]")
IF(CMAKE_SYSTEM MATCHES "OSF1-1.*")
# OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
- SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fpic") # -pic
+ SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fpic")
+ SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fpie")
+ SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fpic") # -pic
SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fpic") # -pic
ENDIF(CMAKE_SYSTEM MATCHES "OSF1-1.*")
diff --git a/Modules/Platform/SINIX.cmake b/Modules/Platform/SINIX.cmake
index 4592fdd..e0809f8 100644
--- a/Modules/Platform/SINIX.cmake
+++ b/Modules/Platform/SINIX.cmake
@@ -1,2 +1,4 @@
+SET(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC)
+SET(CMAKE_C_COMPILE_OPTIONS_PIE "")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/SunOS.cmake b/Modules/Platform/SunOS.cmake
index 2291c34..de287aa 100644
--- a/Modules/Platform/SunOS.cmake
+++ b/Modules/Platform/SunOS.cmake
@@ -1,6 +1,8 @@
IF(CMAKE_SYSTEM MATCHES "SunOS-4.*")
- SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-PIC")
- SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-r")
+ SET(CMAKE_C_COMPILE_OPTIONS_PIC "-PIC")
+ SET(CMAKE_C_COMPILE_OPTIONS_PIE "-PIE")
+ SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-PIC")
+ SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-r")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-R")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
ENDIF(CMAKE_SYSTEM MATCHES "SunOS-4.*")
diff --git a/Modules/Platform/UNIX_SV.cmake b/Modules/Platform/UNIX_SV.cmake
index 3b50e0a..869b3a6 100644
--- a/Modules/Platform/UNIX_SV.cmake
+++ b/Modules/Platform/UNIX_SV.cmake
@@ -1,3 +1,5 @@
+SET(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC)
+SET(CMAKE_C_COMPILE_OPTIONS_PIE "")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,-Bexport")
INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/UnixWare.cmake b/Modules/Platform/UnixWare.cmake
index c324bc8..3112ee1 100644
--- a/Modules/Platform/UnixWare.cmake
+++ b/Modules/Platform/UnixWare.cmake
@@ -1,3 +1,5 @@
+SET(CMAKE_C_COMPILE_OPTIONS_PIC -K PIC)
+SET(CMAKE_C_COMPILE_OPTIONS_PIE "")
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-K PIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-Wl,-Bexport")
INCLUDE(Platform/UnixPaths)
diff --git a/Modules/Platform/Windows-Embarcadero.cmake b/Modules/Platform/Windows-Embarcadero.cmake
index 87b3767..62e8eb7 100644
--- a/Modules/Platform/Windows-Embarcadero.cmake
+++ b/Modules/Platform/Windows-Embarcadero.cmake
@@ -76,7 +76,8 @@ SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_R
macro(__embarcadero_language lang)
- set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "${_tD}")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_DLL "${_tD}") # Note: This variable is a ';' separated list
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "${_tD}") # ... while this is a space separated string.
# compile a source file into an object file
# place <DEFINES> outside the response file because Borland refuses
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index dd47692..1a2ee5e 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -77,7 +77,11 @@ macro(__windows_compiler_gnu lang)
endforeach(type)
endif()
- set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on Windows
+ # No -fPIC on Windows
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIC "")
+ set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "")
+ set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "")
+
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS ${__WINDOWS_GNU_LD_RESPONSE})
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1)
diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake
index e1140df..14b3b81 100644
--- a/Modules/Platform/Windows-wcl386.cmake
+++ b/Modules/Platform/Windows-wcl386.cmake
@@ -20,7 +20,8 @@ SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT "debug all" )
SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" )
SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" )
-set (CMAKE_SHARED_LIBRARY_C_FLAGS "-bd" )
+set(CMAKE_C_COMPILE_OPTIONS_DLL "-bd") # Note: This variable is a ';' separated list
+set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated string.
SET(CMAKE_RC_COMPILER "rc" )
diff --git a/Modules/Platform/syllable.cmake b/Modules/Platform/syllable.cmake
index 3ce42f6..2d11d08 100644
--- a/Modules/Platform/syllable.cmake
+++ b/Modules/Platform/syllable.cmake
@@ -10,7 +10,9 @@
SET(CMAKE_DL_LIBS "dl")
-SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
+SET(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
+SET(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+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,")