remove additional -fPIC switch because
authorGeorg Sauthoff <mail@georg.so>
Sat, 27 Aug 2016 08:56:08 +0000 (10:56 +0200)
committerGeorg Sauthoff <mail@georg.so>
Sat, 27 Aug 2016 13:24:50 +0000 (15:24 +0200)
- cmake is smart enough to add this flag on its own (for object files
  that it links into a shared library)
- cmake contains two sets of oject files - the position-dependent ones
  and the position-independent ones - and uses each set accordingly
  (for linking the executable, static library, shared library)
- having an executable that unnecessarily contains position-independent
  code has performance implications

cmake_unofficial/CMakeLists.txt

index af39cb0..4c82f78 100644 (file)
@@ -22,11 +22,6 @@ IF("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR
   SET(GNU_COMPATIBLE_COMPILER 1)
 ENDIF()
 
-if(GNU_COMPATIBLE_COMPILER)
-if(UNIX AND BUILD_LIBS)
-    add_definitions(-fPIC)
-endif()
-endif()
 
 set(LZ4_DIR ../lib/)
 set(PRG_DIR ../programs/)
@@ -45,15 +40,15 @@ endif()
 if(BUILD_LIBS)
 
 
-       SET(LIBS_TARGETS "")
-       IF(NOT WIN32)
-       add_library(liblz4 SHARED ${LZ4_SRCS_LIB})
-    add_library(liblz4_static STATIC ${LZ4_SRCS_LIB})
-    SET_TARGET_PROPERTIES(liblz4_static PROPERTIES OUTPUT_NAME lz4)
-       SET(LIBS_TARGETS liblz4 liblz4_static)
-       ELSE(NOT WIN32)
-       add_library(liblz4 STATIC ${LZ4_SRCS_LIB})
-       SET(LIBS_TARGETS liblz4)
+    SET(LIBS_TARGETS "")
+    IF(NOT WIN32)
+        add_library(liblz4 SHARED ${LZ4_SRCS_LIB})
+        add_library(liblz4_static STATIC ${LZ4_SRCS_LIB})
+        SET_TARGET_PROPERTIES(liblz4_static PROPERTIES OUTPUT_NAME lz4)
+        SET(LIBS_TARGETS liblz4 liblz4_static)
+    ELSE(NOT WIN32)
+        add_library(liblz4 STATIC ${LZ4_SRCS_LIB})
+        SET(LIBS_TARGETS liblz4)
     ENDIF(NOT WIN32)
 
     set_target_properties(liblz4 PROPERTIES