changeset 2457:2a211c0fc7ca

note about ar
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 Jan 2018 09:27:16 +0100
parents cbb8deaacdf7
children 99e9482b4afc
files Resources/CMake/Compiler.cmake
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/Compiler.cmake	Wed Jan 03 20:25:35 2018 +0100
+++ b/Resources/CMake/Compiler.cmake	Thu Jan 04 09:27:16 2018 +0100
@@ -200,7 +200,12 @@
   # 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
+  # objects." The trick consists in replacing the "r" argument
+  # ("replace") provided to "ar" (as used in CMake < 3.1) by the "q"
+  # argument ("quick append"). This is because of the fact that CMake
+  # will invoke "ar" several times with several batches of ".o"
+  # objects, and using "r" would overwrite symbols defined in
+  # preceding batches. https://cmake.org/Bug/view.php?id=14874
   set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> <LINK_FLAGS> q <TARGET> <OBJECTS>")
 endif()