From 39d0ade07ee9034b2e0469fc270e0aa55fc34135 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 14 Apr 2014 13:58:03 -0400 Subject: [PATCH] Windows-GNU: Support duplicate object names in large archives (#14874) Since commit v2.6.0~388 (Added build rule variables CMAKE__ARCHIVE_..., 2008-01-29) we use separate "ar cr ..." and "ar r ..." steps to incrementally add a large list of object files to an archive. Since the "r" command replaces existing objects of the same name in an archive, if multiple objects have the same file name and appear in separate append steps then one overwrites the other. Instead, use "ar cq ..." and "ar q ..." to always append to the archive. We already remove the archive before creating it so this will not cause objects to be appended to existing archives on incremental rebuilds. --- Modules/Platform/Windows-GNU.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index 2bb7a2076..903824367 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -67,8 +67,8 @@ macro(__windows_compiler_gnu lang) if(MSYS OR MINGW) # Create archiving rules to support large object file lists for static libraries. - set(CMAKE_${lang}_ARCHIVE_CREATE " cr ") - set(CMAKE_${lang}_ARCHIVE_APPEND " r ") + set(CMAKE_${lang}_ARCHIVE_CREATE " cq ") + set(CMAKE_${lang}_ARCHIVE_APPEND " q ") set(CMAKE_${lang}_ARCHIVE_FINISH " ") # Initialize C link type selection flags. These flags are used when