diff Resources/CMake/Compiler.cmake @ 2456:cbb8deaacdf7

Fix static build on CentOS 6
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 03 Jan 2018 20:25:35 +0100
parents ade8b4ddd8a6
children 2a211c0fc7ca
line wrap: on
line diff
--- a/Resources/CMake/Compiler.cmake	Wed Jan 03 16:56:52 2018 +0100
+++ b/Resources/CMake/Compiler.cmake	Wed Jan 03 20:25:35 2018 +0100
@@ -195,6 +195,16 @@
 endif()
 
 
+if (CMAKE_COMPILER_IS_GNUCXX)
+  # "When creating a static library using binutils (ar) and there
+  # exist a duplicate object name (e.g. a/Foo.cpp.o, b/Foo.cpp.o), the
+  # resulting static library can end up having only one of the
+  # duplicate objects. [...] This bug only happens if there are many
+  # objects." https://cmake.org/Bug/view.php?id=14874
+  set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> <LINK_FLAGS> q <TARGET> <OBJECTS>")
+endif()
+
+
 if (STATIC_BUILD)
   add_definitions(-DORTHANC_STATIC=1)
 else()