diff options
-rw-r--r-- | Source/cmTarget.cxx | 169 | ||||
-rw-r--r-- | Source/cmTarget.h | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CompatibleInterface/AutoUic-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CompatibleInterface/AutoUic-stderr.txt | 11 | ||||
-rw-r--r-- | Tests/RunCMake/CompatibleInterface/AutoUic.cmake | 22 | ||||
-rw-r--r-- | Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/CompatibleInterface/empty.cpp | 1 |
8 files changed, 69 insertions, 144 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 7c0cdc3ce4..28de89707b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -135,7 +135,6 @@ public: }; std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries; std::vector<TargetPropertyEntry*> CompileOptionsEntries; - std::vector<TargetPropertyEntry*> AutoUicOptionsEntries; std::vector<TargetPropertyEntry*> CompileDefinitionsEntries; std::vector<cmValueWithOrigin> LinkInterfacePropertyEntries; @@ -144,14 +143,11 @@ public: mutable std::map<std::string, std::vector<TargetPropertyEntry*> > CachedLinkInterfaceCompileOptionsEntries; mutable std::map<std::string, std::vector<TargetPropertyEntry*> > - CachedLinkInterfaceAutoUicOptionsEntries; - mutable std::map<std::string, std::vector<TargetPropertyEntry*> > CachedLinkInterfaceCompileDefinitionsEntries; mutable std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone; mutable std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone; mutable std::map<std::string, bool> CacheLinkInterfaceCompileOptionsDone; - mutable std::map<std::string, bool> CacheLinkInterfaceAutoUicOptionsDone; }; //---------------------------------------------------------------------------- @@ -186,7 +182,6 @@ cmTargetInternals::~cmTargetInternals() { deleteAndClear(this->CachedLinkInterfaceIncludeDirectoriesEntries); deleteAndClear(this->CachedLinkInterfaceCompileOptionsEntries); - deleteAndClear(this->CachedLinkInterfaceAutoUicOptionsEntries); deleteAndClear(this->CachedLinkInterfaceCompileDefinitionsEntries); } @@ -1478,17 +1473,6 @@ void cmTarget::SetProperty(const char* prop, const char* value) new cmTargetInternals::TargetPropertyEntry(cge)); return; } - if(strcmp(prop,"AUTOUIC_OPTIONS") == 0) - { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmGeneratorExpression ge(lfbt); - deleteAndClear(this->Internal->AutoUicOptionsEntries); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); - this->Internal->AutoUicOptionsEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(cge)); - return; - } if(strcmp(prop,"COMPILE_DEFINITIONS") == 0) { cmListFileBacktrace lfbt; @@ -1563,15 +1547,6 @@ void cmTarget::AppendProperty(const char* prop, const char* value, new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); return; } - if(strcmp(prop,"AUTOUIC_OPTIONS") == 0) - { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmGeneratorExpression ge(lfbt); - this->Internal->AutoUicOptionsEntries.push_back( - new cmTargetInternals::TargetPropertyEntry(ge.Parse(value))); - return; - } if(strcmp(prop,"COMPILE_DEFINITIONS") == 0) { cmListFileBacktrace lfbt; @@ -2071,100 +2046,26 @@ static void processCompileOptions(cmTarget const* tgt, void cmTarget::GetAutoUicOptions(std::vector<std::string> &result, const char *config) const { - std::set<std::string> uniqueOptions; - cmListFileBacktrace lfbt; - - cmGeneratorExpressionDAGChecker dagChecker(lfbt, - this->GetName(), - "AUTOUIC_OPTIONS", 0, 0); - - std::vector<std::string> debugProperties; - const char *debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) - { - cmSystemTools::ExpandListArgument(debugProp, debugProperties); - } - - bool debugOptions = !this->DebugCompileOptionsDone - && std::find(debugProperties.begin(), - debugProperties.end(), - "AUTOUIC_OPTIONS") - != debugProperties.end(); - - if (this->Makefile->IsGeneratingBuildSystem()) - { - this->DebugAutoUicOptionsDone = true; - } - - processCompileOptions(this, - this->Internal->AutoUicOptionsEntries, - result, - uniqueOptions, - &dagChecker, - config, - debugOptions); - - std::string configString = config ? config : ""; - if (!this->Internal->CacheLinkInterfaceAutoUicOptionsDone[configString]) + const char *prop + = this->GetLinkInterfaceDependentStringProperty("AUTOUIC_OPTIONS", + config); + if (!prop) { - for (std::vector<cmValueWithOrigin>::const_iterator - it = this->Internal->LinkInterfacePropertyEntries.begin(), - end = this->Internal->LinkInterfacePropertyEntries.end(); - it != end; ++it) - { - if (!cmGeneratorExpression::IsValidTargetName(it->Value) - && cmGeneratorExpression::Find(it->Value) == std::string::npos) - { - continue; - } - { - cmGeneratorExpression ge(lfbt); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(it->Value); - std::string targetResult = cge->Evaluate(this->Makefile, config, - false, this, 0, 0); - if (!this->Makefile->FindTargetToUse(targetResult.c_str())) - { - continue; - } - } - std::string optionGenex = "$<TARGET_PROPERTY:" + - it->Value + ",INTERFACE_AUTOUIC_OPTIONS>"; - if (cmGeneratorExpression::Find(it->Value) != std::string::npos) - { - // Because it->Value is a generator expression, ensure that it - // evaluates to the non-empty string before being used in the - // TARGET_PROPERTY expression. - optionGenex = "$<$<BOOL:" + it->Value + ">:" + optionGenex + ">"; - } - cmGeneratorExpression ge(it->Backtrace); - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse( - optionGenex); - - this->Internal - ->CachedLinkInterfaceAutoUicOptionsEntries[configString].push_back( - new cmTargetInternals::TargetPropertyEntry(cge, - it->Value)); - } + return; } + cmListFileBacktrace lfbt; + cmGeneratorExpression ge(lfbt); - processCompileOptions(this, - this->Internal->CachedLinkInterfaceAutoUicOptionsEntries[configString], - result, - uniqueOptions, - &dagChecker, - config, - debugOptions); - - if (!this->Makefile->IsGeneratingBuildSystem()) - { - deleteAndClear(this->Internal->CachedLinkInterfaceAutoUicOptionsEntries); - } - else - { - this->Internal->CacheLinkInterfaceAutoUicOptionsDone[configString] = true; - } + cmGeneratorExpressionDAGChecker dagChecker(lfbt, + this->GetName(), + "AUTOUIC_OPTIONS", 0, 0); + cmSystemTools::ExpandListArgument(ge.Parse(prop) + ->Evaluate(this->Makefile, + config, + false, + this, + &dagChecker), + result); } //---------------------------------------------------------------------------- @@ -2874,24 +2775,6 @@ const char *cmTarget::GetProperty(const char* prop, } return output.c_str(); } - if(strcmp(prop,"AUTOUIC_OPTIONS") == 0) - { - static std::string output; - output = ""; - std::string sep; - typedef cmTargetInternals::TargetPropertyEntry - TargetPropertyEntry; - for (std::vector<TargetPropertyEntry*>::const_iterator - it = this->Internal->AutoUicOptionsEntries.begin(), - end = this->Internal->AutoUicOptionsEntries.end(); - it != end; ++it) - { - output += sep; - output += (*it)->ge->GetInput(); - sep = ";"; - } - return output.c_str(); - } if(strcmp(prop,"COMPILE_DEFINITIONS") == 0) { static std::string output; @@ -4503,7 +4386,7 @@ std::string compatibilityAgree(CompatibleType t, bool dominant) { case BoolType: case StringType: - return "(Agree)\n"; + return dominant ? "(Disagree)\n" : "(Agree)\n"; case NumberMaxType: case NumberMinType: return dominant ? "(Dominant)\n" : "(Ignored)\n"; @@ -4594,6 +4477,8 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, { PropertyType consistent = consistentProperty(propContent, ifacePropContent, t); + report += reportEntry; + report += compatibilityAgree(t, propContent != consistent); if (!consistent) { cmOStringStream e; @@ -4606,8 +4491,6 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, } else { - report += reportEntry; - report += compatibilityAgree(t, propContent != consistent); propContent = consistent; continue; } @@ -4632,6 +4515,8 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, { PropertyType consistent = consistentProperty(propContent, ifacePropContent, t); + report += reportEntry; + report += compatibilityAgree(t, propContent != consistent); if (!consistent) { cmOStringStream e; @@ -4645,8 +4530,6 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, } else { - report += reportEntry; - report += compatibilityAgree(t, propContent != consistent); propContent = consistent; continue; } @@ -4665,6 +4548,8 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, { PropertyType consistent = consistentProperty(propContent, ifacePropContent, t); + report += reportEntry; + report += compatibilityAgree(t, propContent != consistent); if (!consistent) { cmOStringStream e; @@ -4677,8 +4562,6 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, } else { - report += reportEntry; - report += compatibilityAgree(t, propContent != consistent); propContent = consistent; continue; } @@ -4813,7 +4696,8 @@ bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p, { return false; } - return isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_STRING", + return (p == "AUTOUIC_OPTIONS") || + isLinkDependentProperty(this, p, "COMPATIBLE_INTERFACE_STRING", config); } @@ -6232,7 +6116,6 @@ cmTargetInternalPointer::~cmTargetInternalPointer() { deleteAndClear(this->Pointer->IncludeDirectoriesEntries); deleteAndClear(this->Pointer->CompileOptionsEntries); - deleteAndClear(this->Pointer->AutoUicOptionsEntries); deleteAndClear(this->Pointer->CompileDefinitionsEntries); delete this->Pointer; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 2f4be845f5..3f5a5d12f4 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -698,7 +698,6 @@ private: mutable bool DebugIncludesDone; mutable std::map<std::string, bool> DebugCompatiblePropertiesDone; mutable bool DebugCompileOptionsDone; - mutable bool DebugAutoUicOptionsDone; mutable bool DebugCompileDefinitionsDone; mutable std::set<std::string> LinkImplicitNullProperties; bool BuildInterfaceIncludesAppended; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 593921f7ed..96b054382e 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -94,6 +94,9 @@ if(NOT WIN32) add_RunCMake_test(VisibilityPreset) endif() endif() +if (QT4_FOUND) + set(CompatibleInterface_ARGS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}) +endif() add_RunCMake_test(CompatibleInterface) add_RunCMake_test(Syntax) diff --git a/Tests/RunCMake/CompatibleInterface/AutoUic-result.txt b/Tests/RunCMake/CompatibleInterface/AutoUic-result.txt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/AutoUic-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CompatibleInterface/AutoUic-stderr.txt b/Tests/RunCMake/CompatibleInterface/AutoUic-stderr.txt new file mode 100644 index 0000000000..09f9461daa --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/AutoUic-stderr.txt @@ -0,0 +1,11 @@ +CMake Error: The INTERFACE_AUTOUIC_OPTIONS property of "OtherI18n" does +not agree with the value of AUTOUIC_OPTIONS already determined +for "LibWidget". + +CMake Debug Log: + String compatibility of property "AUTOUIC_OPTIONS" for target "LibWidget" + \(result: "-tr;ki18n"\): + + \* Target "LibWidget" property not set. + \* Target "KI18n" property value "-tr;ki18n" \(Interface set\) + \* Target "OtherI18n" property value "-tr;otheri18n" \(Disagree\) diff --git a/Tests/RunCMake/CompatibleInterface/AutoUic.cmake b/Tests/RunCMake/CompatibleInterface/AutoUic.cmake new file mode 100644 index 0000000000..86bd5a0db3 --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/AutoUic.cmake @@ -0,0 +1,22 @@ + +find_package(Qt4 REQUIRED) + +set(QT_CORE_TARGET Qt4::QtCore) +set(QT_GUI_TARGET Qt4::QtGui) + +set(CMAKE_AUTOUIC ON) + +set(CMAKE_DEBUG_TARGET_PROPERTIES AUTOUIC_OPTIONS) + +add_library(KI18n INTERFACE) +set_property(TARGET KI18n APPEND PROPERTY + INTERFACE_AUTOUIC_OPTIONS -tr ki18n +) + +add_library(OtherI18n INTERFACE) +set_property(TARGET OtherI18n APPEND PROPERTY + INTERFACE_AUTOUIC_OPTIONS -tr otheri18n +) + +add_library(LibWidget empty.cpp) +target_link_libraries(LibWidget KI18n OtherI18n ${QT_GUI_TARGET}) diff --git a/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake b/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake index ff2fe8d753..b87adc89f6 100644 --- a/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake +++ b/Tests/RunCMake/CompatibleInterface/RunCMakeTest.cmake @@ -10,3 +10,8 @@ run_cmake(InterfaceString-mismatched-use) run_cmake(InterfaceString-builtin-prop) run_cmake(InterfaceString-Bool-Conflict) run_cmake(DebugProperties) + +if (QT_QMAKE_EXECUTABLE}) + set(RunCMake_TEST_OPTIONS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}) + run_cmake(AutoUic) +endif() diff --git a/Tests/RunCMake/CompatibleInterface/empty.cpp b/Tests/RunCMake/CompatibleInterface/empty.cpp new file mode 100644 index 0000000000..00323299cb --- /dev/null +++ b/Tests/RunCMake/CompatibleInterface/empty.cpp @@ -0,0 +1 @@ +// no content |