From c2d73c938abc726df985058aa771a5b1710d96f2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 10 Jan 2011 09:58:55 -0500 Subject: [PATCH] Allow platform files to set large archive rules (#11674) Commit aaa88d33 (Build large archives incrementally, 2008-08-04) hard-coded rules to create static archives incrementally in each language information file. Set each rule conditionally to allow compiler and platform information files to override the language default rules. Inspired-by: Harald Pohl --- Modules/CMakeCInformation.cmake | 12 +++++++++--- Modules/CMakeCXXInformation.cmake | 12 +++++++++--- Modules/CMakeFortranInformation.cmake | 12 +++++++++--- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index 86a824a76c..668119fd64 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -164,9 +164,15 @@ ENDIF(NOT CMAKE_C_CREATE_SHARED_MODULE) # 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 " cr ") -SET(CMAKE_C_ARCHIVE_APPEND " r ") -SET(CMAKE_C_ARCHIVE_FINISH " ") +IF(NOT DEFINED CMAKE_C_ARCHIVE_CREATE) + SET(CMAKE_C_ARCHIVE_CREATE " cr ") +ENDIF() +IF(NOT DEFINED CMAKE_C_ARCHIVE_APPEND) + SET(CMAKE_C_ARCHIVE_APPEND " r ") +ENDIF() +IF(NOT DEFINED CMAKE_C_ARCHIVE_FINISH) + SET(CMAKE_C_ARCHIVE_FINISH " ") +ENDIF() # 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 680f8fdbdd..163a7eff95 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -241,9 +241,15 @@ ENDIF(NOT CMAKE_CXX_CREATE_SHARED_MODULE) # 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 " cr ") -SET(CMAKE_CXX_ARCHIVE_APPEND " r ") -SET(CMAKE_CXX_ARCHIVE_FINISH " ") +IF(NOT DEFINED CMAKE_CXX_ARCHIVE_CREATE) + SET(CMAKE_CXX_ARCHIVE_CREATE " cr ") +ENDIF() +IF(NOT DEFINED CMAKE_CXX_ARCHIVE_APPEND) + SET(CMAKE_CXX_ARCHIVE_APPEND " r ") +ENDIF() +IF(NOT DEFINED CMAKE_CXX_ARCHIVE_FINISH) + SET(CMAKE_CXX_ARCHIVE_FINISH " ") +ENDIF() # 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 1e9b4e09b9..d18353a087 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -163,9 +163,15 @@ ENDIF(NOT CMAKE_Fortran_CREATE_SHARED_MODULE) # 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 " cr ") -SET(CMAKE_Fortran_ARCHIVE_APPEND " r ") -SET(CMAKE_Fortran_ARCHIVE_FINISH " ") +IF(NOT DEFINED CMAKE_Fortran_ARCHIVE_CREATE) + SET(CMAKE_Fortran_ARCHIVE_CREATE " cr ") +ENDIF() +IF(NOT DEFINED CMAKE_Fortran_ARCHIVE_APPEND) + SET(CMAKE_Fortran_ARCHIVE_APPEND " r ") +ENDIF() +IF(NOT DEFINED CMAKE_Fortran_ARCHIVE_FINISH) + SET(CMAKE_Fortran_ARCHIVE_FINISH " ") +ENDIF() # compile a Fortran file into an object file IF(NOT CMAKE_Fortran_COMPILE_OBJECT)