diff options
-rw-r--r-- | Modules/Platform/Linux-Intel-C.cmake | 4 | ||||
-rw-r--r-- | Modules/Platform/Linux-Intel-CXX.cmake | 4 | ||||
-rw-r--r-- | Modules/Platform/Linux-Intel-Fortran.cmake | 4 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 13 | ||||
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 13 |
7 files changed, 46 insertions, 3 deletions
diff --git a/Modules/Platform/Linux-Intel-C.cmake b/Modules/Platform/Linux-Intel-C.cmake index 554945e..7be331e 100644 --- a/Modules/Platform/Linux-Intel-C.cmake +++ b/Modules/Platform/Linux-Intel-C.cmake @@ -1,6 +1,8 @@ INCLUDE(Platform/Linux-Intel) IF(XIAR) - SET(CMAKE_C_CREATE_STATIC_LIBRARY + # INTERPROCEDURAL_OPTIMIZATION + SET(CMAKE_C_COMPILE_OPTIONS_IPO -ipo) + SET(CMAKE_C_CREATE_STATIC_LIBRARY_IPO "${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> " "${XIAR} -s <TARGET> ") ENDIF(XIAR) diff --git a/Modules/Platform/Linux-Intel-CXX.cmake b/Modules/Platform/Linux-Intel-CXX.cmake index faa19e3..cedb196 100644 --- a/Modules/Platform/Linux-Intel-CXX.cmake +++ b/Modules/Platform/Linux-Intel-CXX.cmake @@ -1,6 +1,8 @@ INCLUDE(Platform/Linux-Intel) IF(XIAR) - SET(CMAKE_CXX_CREATE_STATIC_LIBRARY + # INTERPROCEDURAL_OPTIMIZATION + SET(CMAKE_CXX_COMPILE_OPTIONS_IPO -ipo) + SET(CMAKE_CXX_CREATE_STATIC_LIBRARY_IPO "${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> " "${XIAR} -s <TARGET> ") ENDIF(XIAR) diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake index 1db5ba6..27a98ed 100644 --- a/Modules/Platform/Linux-Intel-Fortran.cmake +++ b/Modules/Platform/Linux-Intel-Fortran.cmake @@ -1,6 +1,8 @@ INCLUDE(Platform/Linux-Intel) IF(XIAR) - SET(CMAKE_Fortran_CREATE_STATIC_LIBRARY + # INTERPROCEDURAL_OPTIMIZATION + SET(CMAKE_Fortran_COMPILE_OPTIONS_IPO -ipo) + SET(CMAKE_Fortran_CREATE_STATIC_LIBRARY_IPO "${XIAR} cr <TARGET> <LINK_FLAGS> <OBJECTS> " "${XIAR} -s <TARGET> ") ENDIF(XIAR) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index afe5324..ce425d0 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3555,6 +3555,19 @@ void cmMakefile::DefineProperties(cmake *cm) "be followed. See the include_regular_expression command.", false); cm->DefineProperty + ("INTERPROCEDURAL_OPTIMIZATION", cmProperty::DIRECTORY, + "Enable interprocedural optimization for targets in a directory.", + "If set to true, enables interprocedural optimizations " + "if they are known to be supported by the compiler."); + + cm->DefineProperty + ("INTERPROCEDURAL_OPTIMIZATION_<CONFIG>", cmProperty::DIRECTORY, + "Per-configuration interprocedural optimization for a directory.", + "This is a per-configuration version of INTERPROCEDURAL_OPTIMIZATION. " + "If set, this property overrides the generic property " + "for the named configuration."); + + cm->DefineProperty ("VARIABLES", cmProperty::DIRECTORY, "List of variables defined in the current directory.", "This read-only property specifies the list of CMake variables " diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 24b037f..4070a3b 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -113,6 +113,12 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() } linkRuleVar += "_CREATE_STATIC_LIBRARY"; + if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION") && + this->Makefile->GetDefinition((linkRuleVar+"_IPO").c_str())) + { + linkRuleVar += "_IPO"; + } + std::string extraFlags; this->LocalGenerator->AppendFlags (extraFlags,this->Target->GetProperty("STATIC_LIBRARY_FLAGS")); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index e353c3d..7ccccee 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1780,4 +1780,9 @@ void cmMakefileTargetGenerator::AddFeatureFlags( { // Add language-specific flags. this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName); + + if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION")) + { + this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO"); + } } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 9233a1d..63a1ae5 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -421,6 +421,19 @@ void cmTarget::DefineProperties(cmake *cm) "created."); cm->DefineProperty + ("INTERPROCEDURAL_OPTIMIZATION", cmProperty::TARGET, + "Enable interprocedural optimization for a target.", + "If set to true, enables interprocedural optimizations " + "if they are known to be supported by the compiler."); + + cm->DefineProperty + ("INTERPROCEDURAL_OPTIMIZATION_<CONFIG>", cmProperty::TARGET, + "Per-configuration interprocedural optimization for a target.", + "This is a per-configuration version of INTERPROCEDURAL_OPTIMIZATION. " + "If set, this property overrides the generic property " + "for the named configuration."); + + cm->DefineProperty ("LABELS", cmProperty::TARGET, "Specify a list of text labels associated with a target.", "Target label semantics are currently unspecified."); |