Commit 39d0ade0 authored by Brad King's avatar Brad King

Windows-GNU: Support duplicate object names in large archives (#14874)

Since commit v2.6.0~388 (Added build rule variables
CMAKE_<LANG>_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.
parent 1c587198
......@@ -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 "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> cq <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
# Initialize C link type selection flags. These flags are used when
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment