hedgewars/CMakeLists.txt
branch0.9.20
changeset 9899 5b8bde62a8ef
parent 9897 f705dc750df2
child 9916 e244445d0750
--- a/hedgewars/CMakeLists.txt	Wed Jan 01 00:45:28 2014 +0400
+++ b/hedgewars/CMakeLists.txt	Sat Jan 04 02:18:57 2014 +0100
@@ -12,6 +12,13 @@
 add_flag_append(CMAKE_Pascal_FLAGS "-Cs2000000")
 add_flag_append(CMAKE_Pascal_FLAGS_DEBUG "-gv")
 add_flag_append(CMAKE_Pascal_FLAGS_RELEASE "-Xs")
+if(UNIX)
+    include(TargetArch)
+    target_architecture(CMAKE_TARGET_ARCHITECTURES)
+    if(${CMAKE_Pascal_COMPILER_VERSION} VERSION_GREATER 2.7 OR ${CMAKE_TARGET_ARCHITECTURES} MATCHES "x86_64" OR ${CMAKE_TARGET_ARCHITECTURES} MATCHES "i386")
+        add_flag_append(CMAKE_Pascal_FLAGS "-fPIC")
+    endif()
+endif(UNIX)
 
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
 include_directories(${CMAKE_CURRENT_BINARY_DIR})