enable -fPIC on UNIX only
authorkoda
Sun, 03 Nov 2013 22:53:16 +0100
changeset 9673 5be4de0eb4b0
parent 9672 8663d299ba62
child 9674 8f2b0b925513
enable -fPIC on UNIX only
CMakeLists.txt
cmake_modules/platform.cmake
--- a/CMakeLists.txt	Sun Nov 03 14:45:07 2013 -0500
+++ b/CMakeLists.txt	Sun Nov 03 22:53:16 2013 +0100
@@ -72,13 +72,13 @@
 include(${CMAKE_MODULE_PATH}/compilerchecks.cmake)
 
 #set default compiler flags
-add_flag_append(CMAKE_C_FLAGS "-Wall -pipe -fPIC")
+add_flag_append(CMAKE_C_FLAGS "-Wall -pipe")
 add_flag_append(CMAKE_C_FLAGS_RELEASE "-Os")
 add_flag_append(CMAKE_C_FLAGS_DEBUG "-Wextra -O0")
-add_flag_append(CMAKE_CXX_FLAGS "-Wall -pipe -fPIC")
+add_flag_append(CMAKE_CXX_FLAGS "-Wall -pipe")
 add_flag_append(CMAKE_CXX_FLAGS_RELEASE "-Os")
 add_flag_append(CMAKE_CXX_FLAGS_DEBUG "-Wextra -O0")
-add_flag_append(CMAKE_Pascal_FLAGS "-Cs2000000 -fPIC")
+add_flag_append(CMAKE_Pascal_FLAGS "-Cs2000000")
 add_flag_append(CMAKE_Pascal_FLAGS_DEBUG "-O- -gv")
 add_flag_append(CMAKE_Pascal_FLAGS_RELEASE "-Os -Xs")
 
--- a/cmake_modules/platform.cmake	Sun Nov 03 14:45:07 2013 -0500
+++ b/cmake_modules/platform.cmake	Sun Nov 03 22:53:16 2013 +0100
@@ -110,3 +110,9 @@
         message(FATAL_ERROR "Static linking is not supported on Windows")
     endif()
 endif(WIN32)
+
+if(UNIX)
+    add_flag_append(CMAKE_C_FLAGS "-fPIC")
+    add_flag_append(CMAKE_CXX_FLAGS "-fPIC")
+    add_flag_append(CMAKE_Pascal_FLAGS "-fPIC")
+endif(UNIX)