summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/GNU.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/Compiler/GNU.cmake')
-rw-r--r--Modules/Compiler/GNU.cmake4
1 files changed, 4 insertions, 0 deletions
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")