summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CMakeCInformation.cmake12
-rw-r--r--Modules/CMakeCXXInformation.cmake12
-rw-r--r--Modules/CMakeFortranInformation.cmake12
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx4
4 files changed, 19 insertions, 21 deletions
diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake
index e3a8d93..a2ad460 100644
--- a/Modules/CMakeCInformation.cmake
+++ b/Modules/CMakeCInformation.cmake
@@ -98,7 +98,6 @@ INCLUDE(CMakeCommonLanguageInclude)
# CMAKE_C_CREATE_SHARED_LIBRARY
# CMAKE_C_CREATE_SHARED_MODULE
-# CMAKE_C_CREATE_STATIC_LIBRARY
# CMAKE_C_COMPILE_OBJECT
# CMAKE_C_LINK_EXECUTABLE
@@ -133,12 +132,11 @@ IF(NOT CMAKE_C_CREATE_SHARED_MODULE)
SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_LIBRARY})
ENDIF(NOT CMAKE_C_CREATE_SHARED_MODULE)
-# create a C static library
-IF(NOT CMAKE_C_CREATE_STATIC_LIBRARY)
- SET(CMAKE_C_CREATE_STATIC_LIBRARY
- "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
- "<CMAKE_RANLIB> <TARGET> ")
-ENDIF(NOT CMAKE_C_CREATE_STATIC_LIBRARY)
+# Create a static archive incrementally for large object file counts.
+# If CMAKE_C_CREATE_STATIC_LIBRARY is set it will override these.
+SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
+SET(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
+SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
# compile a C file into an object file
IF(NOT CMAKE_C_COMPILE_OBJECT)
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index 65c5902..c5608e0 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -176,7 +176,6 @@ INCLUDE(CMakeCommonLanguageInclude)
# now define the following rules:
# CMAKE_CXX_CREATE_SHARED_LIBRARY
# CMAKE_CXX_CREATE_SHARED_MODULE
-# CMAKE_CXX_CREATE_STATIC_LIBRARY
# CMAKE_CXX_COMPILE_OBJECT
# CMAKE_CXX_LINK_EXECUTABLE
@@ -212,12 +211,11 @@ IF(NOT CMAKE_CXX_CREATE_SHARED_MODULE)
ENDIF(NOT CMAKE_CXX_CREATE_SHARED_MODULE)
-# create a C++ static library
-IF(NOT CMAKE_CXX_CREATE_STATIC_LIBRARY)
- SET(CMAKE_CXX_CREATE_STATIC_LIBRARY
- "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
- "<CMAKE_RANLIB> <TARGET> ")
-ENDIF(NOT CMAKE_CXX_CREATE_STATIC_LIBRARY)
+# Create a static archive incrementally for large object file counts.
+# If CMAKE_CXX_CREATE_STATIC_LIBRARY is set it will override these.
+SET(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
+SET(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
+SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
# compile a C++ file into an object file
IF(NOT CMAKE_CXX_COMPILE_OBJECT)
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index d760de3..4615737 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -119,7 +119,6 @@ INCLUDE(CMakeCommonLanguageInclude)
# now define the following rule variables
# CMAKE_Fortran_CREATE_SHARED_LIBRARY
# CMAKE_Fortran_CREATE_SHARED_MODULE
-# CMAKE_Fortran_CREATE_STATIC_LIBRARY
# CMAKE_Fortran_COMPILE_OBJECT
# CMAKE_Fortran_LINK_EXECUTABLE
@@ -134,12 +133,11 @@ IF(NOT CMAKE_Fortran_CREATE_SHARED_MODULE)
SET(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY})
ENDIF(NOT CMAKE_Fortran_CREATE_SHARED_MODULE)
-# create a Fortran static library
-IF(NOT CMAKE_Fortran_CREATE_STATIC_LIBRARY)
- SET(CMAKE_Fortran_CREATE_STATIC_LIBRARY
- "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
- "<CMAKE_RANLIB> <TARGET> ")
-ENDIF(NOT CMAKE_Fortran_CREATE_STATIC_LIBRARY)
+# Create a static archive incrementally for large object file counts.
+# If CMAKE_Fortran_CREATE_STATIC_LIBRARY is set it will override these.
+SET(CMAKE_Fortran_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
+SET(CMAKE_Fortran_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
+SET(CMAKE_Fortran_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
# compile a Fortran file into an object file
IF(NOT CMAKE_Fortran_COMPILE_OBJECT)
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 03b9622..7bd12a0 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -612,12 +612,15 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
}
// For static libraries there might be archiving rules.
+ bool haveStaticLibraryRule = false;
std::vector<std::string> archiveCreateCommands;
std::vector<std::string> archiveAppendCommands;
std::vector<std::string> archiveFinishCommands;
std::string::size_type archiveCommandLimit = std::string::npos;
if(this->Target->GetType() == cmTarget::STATIC_LIBRARY)
{
+ haveStaticLibraryRule =
+ this->Makefile->GetDefinition(linkRuleVar)? true:false;
std::string arCreateVar = "CMAKE_";
arCreateVar += linkLanguage;
arCreateVar += "_ARCHIVE_CREATE";
@@ -643,6 +646,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
// Decide whether to use archiving rules.
bool useArchiveRules =
+ !haveStaticLibraryRule &&
!archiveCreateCommands.empty() && !archiveAppendCommands.empty();
if(useArchiveRules)
{