From 5187580bcd36aabb7518004b85756d944e7b531a Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 14 Dec 2013 15:40:29 +0100 Subject: Help: Add missing period. --- Help/policy/CMP0024.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/policy/CMP0024.rst b/Help/policy/CMP0024.rst index 4c8c714..abfcc75 100644 --- a/Help/policy/CMP0024.rst +++ b/Help/policy/CMP0024.rst @@ -11,7 +11,7 @@ until later at generate-time, such as the link language and complete list of link libraries. Future refactoring will change the effect of the export() command to be executed at generate-time. Use ALIAS targets instead in cases where the goal is to refer to targets by -another name +another name. The OLD behavior for this policy is to allow including the result of an export() command. The NEW behavior for this policy is to not to -- cgit v0.12 From 4cb7d792af6bb64d40ed96f028e7df69f2062947 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 14 Dec 2013 23:29:13 +0100 Subject: Help: Fix CMP0037 docs. INTERFACE libraries may not use double-colons, but IMPORTED targets may. --- Help/policy/CMP0037.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Help/policy/CMP0037.rst b/Help/policy/CMP0037.rst index 059b2e6..f4d2f4e 100644 --- a/Help/policy/CMP0037.rst +++ b/Help/policy/CMP0037.rst @@ -11,7 +11,7 @@ diagnostics expect target names to match a restricted pattern. Target names may contain upper and lower case letters, numbers, the underscore character (_), dot(.), plus(+) and minus(-). As a special case, ALIAS -targets and INTERFACE library targets may contain two consequtive colons. +targets and IMPORTED targets may contain two consequtive colons. Target names reserved by one or more CMake generators are not allowed. Among others these include "all", "help" and "test". -- cgit v0.12 From 218ad35f96e89dc1c311ff52445c8ec03b828d5b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Dec 2013 00:00:57 +0100 Subject: Constify cmStrCmp. --- Source/cmStandardIncludes.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 7369fe6..eb6e52f 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -423,19 +423,19 @@ struct cmStrCmp { cmStrCmp(const char *test) : m_test(test) {} cmStrCmp(std::string &test) : m_test(test.c_str()) {} - bool operator()(const char * input) + bool operator()(const char * input) const { return strcmp(input, m_test) == 0; } // For use with binary_search - bool operator()(const char *str1, const char *str2) + bool operator()(const char *str1, const char *str2) const { return strcmp(str1, str2) < 0; } private: - const char *m_test; + const char * const m_test; }; #endif -- cgit v0.12 From d36b48940114c7cc33f5592f06c372084a6b48f0 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Dec 2013 00:32:35 +0100 Subject: Genex: Allow single param expressions to accept arbirary input. Existing single-parameter expressions work due to special casing which assumes that if there is only one parameter, and the node accepts arbitrary content, then the result is the input. This is true for the existing expressions matching that pattern - namely the "1" and "TARGET_NAME" expressions. However, the LOWER_CASE, and UPPER_CASE expressions should also accept arbitrary content, and in their case, the result is not the input. Refactor the cmGeneratorExpressionEvaluator to allow that extension. Actually evaluate the "1" and "0" nodes. --- Source/cmGeneratorExpressionEvaluator.cxx | 54 +++++++++++++------------------ 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 0f8c4e3..34d4434 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -82,7 +82,6 @@ static const struct ZeroNode : public cmGeneratorExpressionNode const GeneratorExpressionContent *, cmGeneratorExpressionDAGChecker *) const { - // Unreachable return std::string(); } } zeroNode; @@ -94,13 +93,12 @@ static const struct OneNode : public cmGeneratorExpressionNode virtual bool AcceptsArbitraryContentParameter() const { return true; } - std::string Evaluate(const std::vector &, + std::string Evaluate(const std::vector ¶meters, cmGeneratorExpressionContext *, const GeneratorExpressionContent *, cmGeneratorExpressionDAGChecker *) const { - // Unreachable - return std::string(); + return parameters.front(); } } oneNode; @@ -1634,14 +1632,6 @@ std::string GeneratorExpressionContent::Evaluate( return std::string(); } - if (node->NumExpectedParameters() == 1 - && node->AcceptsArbitraryContentParameter()) - { - return this->ProcessArbitraryContent(node, identifier, context, - dagChecker, - this->ParamChildren.begin()); - } - std::vector parameters; this->EvaluateParameters(node, identifier, context, dagChecker, parameters); if (context->HadError) @@ -1669,33 +1659,35 @@ std::string GeneratorExpressionContent::EvaluateParameters( pend = this->ParamChildren.end(); const bool acceptsArbitraryContent = node->AcceptsArbitraryContentParameter(); - for ( ; pit != pend; ++pit) + int counter = 1; + for ( ; pit != pend; ++pit, ++counter) { - std::string parameter; - std::vector::const_iterator it = - pit->begin(); - const std::vector::const_iterator end = - pit->end(); - for ( ; it != end; ++it) - { - parameter += (*it)->Evaluate(context, dagChecker); - if (context->HadError) - { - return std::string(); - } - } - parameters.push_back(parameter); - if (acceptsArbitraryContent - && parameters.size() == (unsigned int)numExpected - 1) + if (acceptsArbitraryContent && counter == numExpected) { - assert(pit != pend); std::string lastParam = this->ProcessArbitraryContent(node, identifier, context, dagChecker, - pit + 1); + pit); parameters.push_back(lastParam); return std::string(); } + else + { + std::string parameter; + std::vector::const_iterator it = + pit->begin(); + const std::vector::const_iterator end = + pit->end(); + for ( ; it != end; ++it) + { + parameter += (*it)->Evaluate(context, dagChecker); + if (context->HadError) + { + return std::string(); + } + } + parameters.push_back(parameter); + } } } -- cgit v0.12 From f4d9466130c28d4d9f24885f9183a95ee115bb3c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 15 Dec 2013 11:02:56 +0100 Subject: Genex: Accept arbitrary content in *_CASE and MAKE_C_IDENTIFIER. --- Source/cmGeneratorExpressionEvaluator.cxx | 6 ++++++ Tests/GeneratorExpression/CMakeLists.txt | 6 +++--- Tests/GeneratorExpression/check-part3.cmake | 6 +++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 34d4434..c1d1086 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -201,6 +201,8 @@ static const struct LowerCaseNode : public cmGeneratorExpressionNode { LowerCaseNode() {} + bool AcceptsArbitraryContentParameter() const { return true; } + std::string Evaluate(const std::vector ¶meters, cmGeneratorExpressionContext *, const GeneratorExpressionContent *, @@ -215,6 +217,8 @@ static const struct UpperCaseNode : public cmGeneratorExpressionNode { UpperCaseNode() {} + bool AcceptsArbitraryContentParameter() const { return true; } + std::string Evaluate(const std::vector ¶meters, cmGeneratorExpressionContext *, const GeneratorExpressionContent *, @@ -229,6 +233,8 @@ static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode { MakeCIdentifierNode() {} + bool AcceptsArbitraryContentParameter() const { return true; } + std::string Evaluate(const std::vector ¶meters, cmGeneratorExpressionContext *, const GeneratorExpressionContent *, diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index edadb87..892f80f 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -193,9 +193,9 @@ add_custom_target(check-part3 ALL -Dtest_platform_id_Linux=$ -Dtest_platform_id_Windows=$ -Dtest_platform_id_Darwin=$ - -Dlower_case=$ - -Dupper_case=$ - -Dmake_c_identifier=$ + -Dlower_case=$ + -Dupper_case=$ + -Dmake_c_identifier=$ -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part3.cmake COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)" VERBATIM diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index a86db31..3361eeb 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -34,6 +34,6 @@ foreach(system Linux Windows Darwin) check(test_platform_id_${system} 0) endif() endforeach() -check(lower_case "mixed") -check(upper_case "MIXED") -check(make_c_identifier "_4foo__bar__") +check(lower_case "mi,xed") +check(upper_case "MIX,ED") +check(make_c_identifier "_4f_oo__bar__") -- cgit v0.12 From 20a06d01f7d29f58a0ec79aeede174121b901f73 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Dec 2013 18:45:50 +0100 Subject: Export: Clean up comment. Introduced in commit a4263c9f (export(): Handle multiple dependent export sets., 2013-10-10) --- Source/cmExportBuildFileGenerator.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 0d0d05b..c10f86f 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -229,10 +229,8 @@ cmExportBuildFileGenerator::HandleMissingTarget( // Append it with the export namespace. link_libs += this->Namespace; link_libs += dependee->GetExportName(); -// if generate time {} } - //---------------------------------------------------------------------------- std::vector cmExportBuildFileGenerator -- cgit v0.12 From 9436353f9475a6a18e078000d0bb57abea2f395f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Dec 2013 18:47:37 +0100 Subject: Genex: Always return immediately on error. --- Source/cmGeneratorExpressionEvaluator.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index c1d1086..1f30d73 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -354,6 +354,7 @@ static const struct CCompilerIdNode : public CompilerIdNode reportError(context, content->GetOriginalExpression(), "$ may only be used with targets. It may not " "be used with add_custom_command."); + return std::string(); } return this->EvaluateWithLanguage(parameters, context, content, dagChecker, "C"); @@ -381,6 +382,7 @@ static const struct CXXCompilerIdNode : public CompilerIdNode reportError(context, content->GetOriginalExpression(), "$ may only be used with targets. It may not " "be used with add_custom_command."); + return std::string(); } return this->EvaluateWithLanguage(parameters, context, content, dagChecker, "CXX"); @@ -448,6 +450,7 @@ static const struct CCompilerVersionNode : public CompilerVersionNode reportError(context, content->GetOriginalExpression(), "$ may only be used with targets. It may not " "be used with add_custom_command."); + return std::string(); } return this->EvaluateWithLanguage(parameters, context, content, dagChecker, "C"); @@ -476,6 +479,7 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode reportError(context, content->GetOriginalExpression(), "$ may only be used with targets. It may " "not be used with add_custom_command."); + return std::string(); } return this->EvaluateWithLanguage(parameters, context, content, dagChecker, "CXX"); -- cgit v0.12 From 2eda9243891f1df420ac55b9b2ebc88081c731ae Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Dec 2013 18:48:07 +0100 Subject: Genex: Use case-sensitive comparison in PLATFORM_ID. --- Source/cmGeneratorExpressionEvaluator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 1f30d73..c8010d0 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -512,7 +512,7 @@ struct PlatformIdNode : public cmGeneratorExpressionNode return parameters.front().empty() ? "1" : "0"; } - if (cmsysString_strcasecmp(parameters.begin()->c_str(), platformId) == 0) + if (strcmp(parameters.begin()->c_str(), platformId) == 0) { return "1"; } -- cgit v0.12 From 08e72a34e9201f099015df086e33749733261d18 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Dec 2013 18:48:44 +0100 Subject: Automoc: Fix style Insert whitespace before operators. --- Source/cmQtAutoGenerators.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 2b4bb8a..a561aab 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1379,18 +1379,18 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) if (this->RunMocFailed) { - std::cerr << "moc failed..."<< std::endl; + std::cerr << "moc failed..." << std::endl; return false; } if (this->RunUicFailed) { - std::cerr << "uic failed..."<< std::endl; + std::cerr << "uic failed..." << std::endl; return false; } if (this->RunRccFailed) { - std::cerr << "rcc failed..."<< std::endl; + std::cerr << "rcc failed..." << std::endl; return false; } outStream.flush(); -- cgit v0.12 From cad5c79e6c125e93e2c4f9e494ffdb7c18358bb8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 18 Dec 2013 18:49:41 +0100 Subject: cmTarget: Fix typo 'a ALIAS' -> 'an ALIAS' --- Source/cmTarget.cxx | 2 +- Tests/RunCMake/CMP0028/CMP0028-NEW-stderr.txt | 2 +- Tests/RunCMake/CMP0028/CMP0028-WARN-stderr.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a44cda1..a0177fb 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -5614,7 +5614,7 @@ void cmTarget::ComputeLinkImplementation(const char* config, { e << "Target \"" << this->GetName() << "\" links to target \"" << item << "\" but the target was not found. Perhaps a find_package() " - "call is missing for an IMPORTED target, or a ALIAS target is " + "call is missing for an IMPORTED target, or an ALIAS target is " "missing?"; this->Makefile->GetCMakeInstance()->IssueMessage(messageType, e.str(), diff --git a/Tests/RunCMake/CMP0028/CMP0028-NEW-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-NEW-stderr.txt index a7b0799..711ad0e 100644 --- a/Tests/RunCMake/CMP0028/CMP0028-NEW-stderr.txt +++ b/Tests/RunCMake/CMP0028/CMP0028-NEW-stderr.txt @@ -1,6 +1,6 @@ CMake Error at CMP0028-NEW.cmake:4 \(add_library\): Target "foo" links to target "External::Library" but the target was not found. Perhaps a find_package\(\) call is missing for an IMPORTED target, or - a ALIAS target is missing\? + an ALIAS target is missing\? Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/CMP0028/CMP0028-WARN-stderr.txt b/Tests/RunCMake/CMP0028/CMP0028-WARN-stderr.txt index 2ff6927..41d7560 100644 --- a/Tests/RunCMake/CMP0028/CMP0028-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0028/CMP0028-WARN-stderr.txt @@ -5,7 +5,7 @@ CMake Warning \(dev\) at CMP0028-WARN.cmake:2 \(add_library\): Target "foo" links to target "External::Library" but the target was not found. Perhaps a find_package\(\) call is missing for an IMPORTED target, or - a ALIAS target is missing\? + an ALIAS target is missing\? Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. -- cgit v0.12 From b51b6e97a26b604f184646003adb7d5fb6077131 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 19 Dec 2013 14:24:46 +0100 Subject: Export: Skip INTERFACE libraries when generating -config files. The properties object has just been created, so is always empty, which means the if block is never entered. The following lines do not have any effect because an INTERFACE library has no LOCATION. At the end, no code is generated for INTERFACE libraries in config-specific exported files, so skip them early. --- Source/cmExportInstallFileGenerator.cxx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 79e78df..1025dc0 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -297,16 +297,14 @@ cmExportInstallFileGenerator { // Collect import properties for this target. cmTargetExport const* te = *tei; - ImportPropertyMap properties; - std::set importedLocations; - if (!properties.empty() - && te->Target->GetType() == cmTarget::INTERFACE_LIBRARY) + if (te->Target->GetType() == cmTarget::INTERFACE_LIBRARY) { - this->GenerateImportPropertyCode(os, config, te->Target, properties); - this->GenerateImportedFileChecksCode(os, te->Target, properties, - importedLocations); continue; } + + ImportPropertyMap properties; + std::set importedLocations; + this->SetImportLocationProperty(config, suffix, te->ArchiveGenerator, properties, importedLocations); this->SetImportLocationProperty(config, suffix, te->LibraryGenerator, -- cgit v0.12