diff options
-rw-r--r-- | Modules/CMakePackageConfigHelpers.cmake | 26 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmExtraCodeBlocksGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 29 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 2 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 14 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 4 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmQtAutomoc.cxx | 6 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 29 | ||||
-rw-r--r-- | Source/cmTarget.h | 2 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 4 |
14 files changed, 75 insertions, 57 deletions
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index a92ce7c..393d05c 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -9,6 +9,8 @@ # configure_file() command when creating the <Name>Config.cmake or <Name>-config.cmake # file for installing a project or library. It helps making the resulting package # relocatable by avoiding hardcoded paths in the installed Config.cmake file. +# <Name>Config.cmake files installed under UNIX into /lib(64) or /usr/lib(64) are +# considered system packages and are not relocatable. # # In a FooConfig.cmake file there may be code like this to make the # install destinations know to the using project: @@ -173,17 +175,33 @@ function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) else() set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}") endif() + + # with the /usr-move, /lib(64) is a symlink to /usr/lib on Fedora, ArchLinux, Mageira and others. + # If we are installed to such a location, force using absolute paths. + set(forceAbsolutePaths FALSE) + if("${absInstallDir}" MATCHES "^(/usr)?/lib(64)?/.+") + set(forceAbsolutePaths TRUE) + endif() + file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" ) foreach(var ${CCF_PATH_VARS}) if(NOT DEFINED ${var}) message(FATAL_ERROR "Variable ${var} does not exist") else() - if(IS_ABSOLUTE "${${var}}") - string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}" - PACKAGE_${var} "${${var}}") + if(forceAbsolutePaths) + if(IS_ABSOLUTE "${${var}}") + set(PACKAGE_${var} "${${var}}") + else() + set(PACKAGE_${var} "${CMAKE_INSTALL_PREFIX}/${${var}}") + endif() else() - set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}") + if(IS_ABSOLUTE "${${var}}") + string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}" + PACKAGE_${var} "${${var}}") + else() + set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}") + endif() endif() endif() endforeach() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 059bb6c..608c269 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 10) -set(CMake_VERSION_TWEAK 20130126) +set(CMake_VERSION_TWEAK 20130129) #set(CMake_VERSION_RC 1) diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 0cf9cbb..6d5d5b5 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -621,7 +621,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, ->GetGeneratorTarget(target); // the compilerdefines for this target - std::string cdefs = gtgt->GetCompileDefinitions(); + std::string cdefs = target->GetCompileDefinitions(); if(!cdefs.empty()) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 62ee26a..335ba0f 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -254,32 +254,3 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories( { return this->Target->GetIncludeDirectories(config); } - -//---------------------------------------------------------------------------- -std::string cmGeneratorTarget::GetCompileDefinitions(const char *config) -{ - std::string defPropName = "COMPILE_DEFINITIONS"; - if (config) - { - defPropName += "_" + cmSystemTools::UpperCase(config); - } - - const char *prop = this->Target->GetProperty(defPropName.c_str()); - - if (!prop) - { - return ""; - } - - cmListFileBacktrace lfbt; - cmGeneratorExpression ge(lfbt); - - cmGeneratorExpressionDAGChecker dagChecker(lfbt, - this->GetName(), - defPropName, 0, 0); - return ge.Parse(prop)->Evaluate(this->Makefile, - config, - false, - this->Target, - &dagChecker); -} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 6f5ecb7..cbcd8a5 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -68,8 +68,6 @@ public: /** Get the include directories for this target. */ std::vector<std::string> GetIncludeDirectories(const char *config); - std::string GetCompileDefinitions(const char *config = 0); - private: void ClassifySources(); void LookupObjectLibraries(); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0681ce5..abe60c6 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1681,11 +1681,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, this->AppendDefines(ppDefs, exportMacro); } cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target); - this->AppendDefines(ppDefs, gtgt->GetCompileDefinitions().c_str()); + this->AppendDefines(ppDefs, target.GetCompileDefinitions().c_str()); if(configName) { this->AppendDefines(ppDefs, - gtgt->GetCompileDefinitions(configName).c_str()); + target.GetCompileDefinitions(configName).c_str()); } buildSettings->AddAttribute ("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList()); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 6c78ac4..617eb4e 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1697,25 +1697,21 @@ void cmLocalVisualStudio6Generator std::set<std::string> minsizeDefinesSet; std::set<std::string> debugrelDefinesSet; - - cmGeneratorTarget* gt = - this->GlobalGenerator->GetGeneratorTarget(&target); - this->AppendDefines( definesSet, - gt->GetCompileDefinitions()); + target.GetCompileDefinitions()); this->AppendDefines( debugDefinesSet, - gt->GetCompileDefinitions("DEBUG")); + target.GetCompileDefinitions("DEBUG")); this->AppendDefines( releaseDefinesSet, - gt->GetCompileDefinitions("RELEASE")); + target.GetCompileDefinitions("RELEASE")); this->AppendDefines( minsizeDefinesSet, - gt->GetCompileDefinitions("MINSIZEREL")); + target.GetCompileDefinitions("MINSIZEREL")); this->AppendDefines( debugrelDefinesSet, - gt->GetCompileDefinitions("RELWITHDEBINFO")); + target.GetCompileDefinitions("RELWITHDEBINFO")); std::string defines = " "; std::string debugDefines = " "; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 918b21e..f9df861 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -745,8 +745,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, targetOptions.ParseFinish(); cmGeneratorTarget* gt = this->GlobalGenerator->GetGeneratorTarget(&target); - targetOptions.AddDefines(gt->GetCompileDefinitions().c_str()); - targetOptions.AddDefines(gt->GetCompileDefinitions(configName).c_str()); + targetOptions.AddDefines(target.GetCompileDefinitions().c_str()); + targetOptions.AddDefines(target.GetCompileDefinitions(configName).c_str()); targetOptions.SetVerboseMakefile( this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 64fcfce..d9aa7fe 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -303,10 +303,10 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AppendDefines - (defines, this->GeneratorTarget->GetCompileDefinitions()); + (defines, this->Target->GetCompileDefinitions()); this->LocalGenerator->AppendDefines - (defines, this->GeneratorTarget->GetCompileDefinitions( + (defines, this->Target->GetCompileDefinitions( this->LocalGenerator->ConfigurationName.c_str())); std::string definesString; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 0f484da..f8e4399 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -228,7 +228,7 @@ ComputeDefines(cmSourceFile *source, const std::string& language) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AppendDefines (defines, - this->GeneratorTarget->GetCompileDefinitions()); + this->Target->GetCompileDefinitions()); this->LocalGenerator->AppendDefines (defines, source->GetProperty("COMPILE_DEFINITIONS")); @@ -237,7 +237,7 @@ ComputeDefines(cmSourceFile *source, const std::string& language) defPropName += cmSystemTools::UpperCase(this->GetConfigName()); this->LocalGenerator->AppendDefines (defines, - this->GeneratorTarget->GetCompileDefinitions(this->GetConfigName())); + this->Target->GetCompileDefinitions(this->GetConfigName())); this->LocalGenerator->AppendDefines (defines, source->GetProperty(defPropName.c_str())); diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index bf034cf..cc42175 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -229,7 +229,11 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) } const char* tmp = target->GetProperty("COMPILE_DEFINITIONS"); - std::string _moc_compile_defs = (tmp!=0 ? tmp : ""); + std::string _moc_compile_defs; + if (tmp) + { + _moc_compile_defs = target->GetCompileDefinitions(); + } tmp = makefile->GetProperty("COMPILE_DEFINITIONS"); if (tmp) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e3be510..5669872 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2815,6 +2815,35 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config) } //---------------------------------------------------------------------------- +std::string cmTarget::GetCompileDefinitions(const char *config) +{ + std::string defPropName = "COMPILE_DEFINITIONS"; + if (config) + { + defPropName += "_" + cmSystemTools::UpperCase(config); + } + + const char *prop = this->GetProperty(defPropName.c_str()); + + if (!prop) + { + return ""; + } + + cmListFileBacktrace lfbt; + cmGeneratorExpression ge(lfbt); + + cmGeneratorExpressionDAGChecker dagChecker(lfbt, + this->GetName(), + defPropName, 0, 0); + return ge.Parse(prop)->Evaluate(this->Makefile, + config, + false, + this, + &dagChecker); +} + +//---------------------------------------------------------------------------- void cmTarget::MaybeInvalidatePropertyCache(const char* prop) { // Wipe out maps caching information affected by this property. diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 4457bec..cf2d4c4 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -430,6 +430,8 @@ public: If no macro should be defined null is returned. */ const char* GetExportMacro(); + std::string GetCompileDefinitions(const char *config = 0); + // Compute the set of languages compiled by the target. This is // computed every time it is called because the languages can change // when source file properties are changed and we do not have enough diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 2596d73..171ed9a 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1221,8 +1221,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( clOptions.Parse(flags.c_str()); clOptions.Parse(defineFlags.c_str()); clOptions.AddDefines( - this->GeneratorTarget->GetCompileDefinitions().c_str()); - clOptions.AddDefines(this->GeneratorTarget->GetCompileDefinitions( + this->Target->GetCompileDefinitions().c_str()); + clOptions.AddDefines(this->Target->GetCompileDefinitions( configName.c_str()).c_str()); clOptions.SetVerboseMakefile( this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")); |