diff options
33 files changed, 783 insertions, 112 deletions
diff --git a/Help/command/if.rst b/Help/command/if.rst index 56e618c..0941029 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -30,10 +30,12 @@ else and endif clause is optional. Long expressions can be used and there is a traditional order of precedence. Parenthetical expressions are evaluated first followed by unary tests such as ``EXISTS``, ``COMMAND``, and ``DEFINED``. Then any binary tests such as -``EQUAL``, ``LESS``, ``GREATER``, ``STRLESS``, ``STRGREATER``, -``STREQUAL``, and ``MATCHES`` will be evaluated. Then boolean ``NOT`` -operators and finally boolean ``AND`` and then ``OR`` operators will -be evaluated. +``EQUAL``, ``LESS``, ``LESS_EQUAL, ``GREATER``, ``GREATER_EQUAL``, +``STREQUAL``, ``STRLESS``, ``STRLESS_EQUAL``, ``STRGREATER``, +``STRGREATER_EQUAL``, ``VERSION_EQUAL``, ``VERSION_LESS``, +``VERSION_LESS_EQUAL``, ``VERSION_GREATER``, ``VERSION_GREATER_EQUAL``, +and ``MATCHES`` will be evaluated. Then boolean ``NOT`` operators and +finally boolean ``AND`` and then ``OR`` operators will be evaluated. Possible expressions are: @@ -115,6 +117,14 @@ Possible expressions are: True if the given string or variable's value is a valid number and equal to that on the right. +``if(<variable|string> LESS_EQUAL <variable|string>)`` + True if the given string or variable's value is a valid number and less + than or equal to that on the right. + +``if(<variable|string> GREATER_EQUAL <variable|string>)`` + True if the given string or variable's value is a valid number and greater + than or equal to that on the right. + ``if(<variable|string> STRLESS <variable|string>)`` True if the given string or variable's value is lexicographically less than the string or variable on the right. @@ -127,15 +137,31 @@ Possible expressions are: True if the given string or variable's value is lexicographically equal to the string or variable on the right. +``if(<variable|string> STRLESS_EQUAL <variable|string>)`` + True if the given string or variable's value is lexicographically less + than or equal to the string or variable on the right. + +``if(<variable|string> STRGREATER_EQUAL <variable|string>)`` + True if the given string or variable's value is lexicographically greater + than or equal to the string or variable on the right. + ``if(<variable|string> VERSION_LESS <variable|string>)`` Component-wise integer version number comparison (version format is ``major[.minor[.patch[.tweak]]]``). +``if(<variable|string> VERSION_GREATER <variable|string>)`` + Component-wise integer version number comparison (version format is + ``major[.minor[.patch[.tweak]]]``). + ``if(<variable|string> VERSION_EQUAL <variable|string>)`` Component-wise integer version number comparison (version format is ``major[.minor[.patch[.tweak]]]``). -``if(<variable|string> VERSION_GREATER <variable|string>)`` +``if(<variable|string> VERSION_LESS_EQUAL <variable|string>)`` + Component-wise integer version number comparison (version format is + ``major[.minor[.patch[.tweak]]]``). + +``if(<variable|string> VERSION_GREATER_EQUAL <variable|string>)`` Component-wise integer version number comparison (version format is ``major[.minor[.patch[.tweak]]]``). @@ -186,20 +212,21 @@ above-documented signature accepts ``<variable|string>``: * If the left hand argument to ``MATCHES`` is missing it returns false without error -* Both left and right hand arguments to ``LESS``, ``GREATER``, and - ``EQUAL`` are independently tested to see if they are defined - variables, if so their defined values are used otherwise the original - value is used. +* Both left and right hand arguments to ``LESS``, ``GREATER``, ``EQUAL``, + ``LESS_EQUAL``, and ``GREATER_EQUAL``, are independently tested to see if + they are defined variables, if so their defined values are used otherwise + the original value is used. -* Both left and right hand arguments to ``STRLESS``, ``STREQUAL``, and - ``STRGREATER`` are independently tested to see if they are defined - variables, if so their defined values are used otherwise the original - value is used. +* Both left and right hand arguments to ``STRLESS``, ``STRGREATER``, + ``STREQUAL``, ``STRLESS_EQUAL``, and ``STRGREATER_EQUAL`` are independently + tested to see if they are defined variables, if so their defined values are + used otherwise the original value is used. * Both left and right hand arguments to ``VERSION_LESS``, - ``VERSION_EQUAL``, and ``VERSION_GREATER`` are independently tested - to see if they are defined variables, if so their defined values are - used otherwise the original value is used. + ``VERSION_GREATER``, ``VERSION_EQUAL``, ``VERSION_LESS_EQUAL``, and + ``VERSION_GREATER_EQUAL`` are independently tested to see if they are defined + variables, if so their defined values are used otherwise the original value + is used. * The right hand argument to ``NOT`` is tested to see if it is a boolean constant, if so the value is used, otherwise it is assumed to be a diff --git a/Help/command/string.rst b/Help/command/string.rst index 3f4050e..19a095a 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -197,10 +197,12 @@ Comparison :: - string(COMPARE EQUAL <string1> <string2> <output variable>) - string(COMPARE NOTEQUAL <string1> <string2> <output variable>) string(COMPARE LESS <string1> <string2> <output variable>) string(COMPARE GREATER <string1> <string2> <output variable>) + string(COMPARE EQUAL <string1> <string2> <output variable>) + string(COMPARE NOTEQUAL <string1> <string2> <output variable>) + string(COMPARE LESS_EQUAL <string1> <string2> <output variable>) + string(COMPARE GREATER_EQUAL <string1> <string2> <output variable>) Compare the strings and store true or false in the output variable. diff --git a/Help/generator/Ninja.rst b/Help/generator/Ninja.rst index d94e5f6..ef0e28b 100644 --- a/Help/generator/Ninja.rst +++ b/Help/generator/Ninja.rst @@ -7,6 +7,17 @@ A build.ninja file is generated into the build tree. Recent versions of the ninja program can build the project through the "all" target. An "install" target is also provided. -For each subdirectory ``sub/dir`` of the project an additional target -named ``sub/dir/all`` is generated that depends on all targets required -by that subdirectory. +For each subdirectory ``sub/dir`` of the project, additional targets +are generated: + +``sub/dir/all`` + Depends on all targets required by the subdirectory. + +``sub/dir/install`` + Runs the install step in the subdirectory, if any. + +``sub/dir/test`` + Runs the test step in the subdirectory, if any. + +``sub/dir/package`` + Runs the package step in the subdirectory, if any. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index d4f47dd..64d15a9 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -66,12 +66,16 @@ Available logical expressions are: ``1`` if the CMake-id of the C compiler matches ``comp``, otherwise ``0``. ``$<CXX_COMPILER_ID:comp>`` ``1`` if the CMake-id of the CXX compiler matches ``comp``, otherwise ``0``. -``$<VERSION_GREATER:v1,v2>`` - ``1`` if ``v1`` is a version greater than ``v2``, else ``0``. ``$<VERSION_LESS:v1,v2>`` ``1`` if ``v1`` is a version less than ``v2``, else ``0``. +``$<VERSION_GREATER:v1,v2>`` + ``1`` if ``v1`` is a version greater than ``v2``, else ``0``. ``$<VERSION_EQUAL:v1,v2>`` ``1`` if ``v1`` is the same version as ``v2``, else ``0``. +``$<VERSION_LESS_EQUAL:v1,v2>`` + ``1`` if ``v1`` is a version less than or equal to ``v2``, else ``0``. +``$<VERSION_GREATER_EQUAL:v1,v2>`` + ``1`` if ``v1`` is a version greater than or equal to ``v2``, else ``0``. ``$<C_COMPILER_VERSION:ver>`` ``1`` if the version of the C compiler matches ``ver``, otherwise ``0``. ``$<CXX_COMPILER_VERSION:ver>`` diff --git a/Help/release/dev/add-extra-boolean-comparisons.rst b/Help/release/dev/add-extra-boolean-comparisons.rst new file mode 100644 index 0000000..a928994 --- /dev/null +++ b/Help/release/dev/add-extra-boolean-comparisons.rst @@ -0,0 +1,6 @@ +add-extra-boolean-comparisons +----------------------------- + +* The :command:`if` command gained new boolean comparison operations + ``LESS_EQUAL``, ``GREATER_EQUAL``, ``STRLESS_EQUAL``, ``STRGREATER_EQUAL``, + ``VERSION_LESS_EQUAL``, and ``VERSION_GREATER_EQUAL``. diff --git a/Help/release/dev/ninja-directory-targets.rst b/Help/release/dev/ninja-directory-targets.rst new file mode 100644 index 0000000..c4269d8 --- /dev/null +++ b/Help/release/dev/ninja-directory-targets.rst @@ -0,0 +1,8 @@ +ninja-directory-targets +----------------------- + +* The :generator:`Ninja` generator learned to produce phony targets + of the form ``sub/dir/{test,install,package}`` to drive the build + of a subdirectory installation, test or packaging target. + This is equivalent to ``cd sub/dir; make {test,install,package}`` + with :ref:`Makefile Generators`. diff --git a/Help/variable/CMAKE_VERSION.rst b/Help/variable/CMAKE_VERSION.rst index bbb1d91..872e2fa 100644 --- a/Help/variable/CMAKE_VERSION.rst +++ b/Help/variable/CMAKE_VERSION.rst @@ -26,11 +26,11 @@ Individual component values are also available in variables: * :variable:`CMAKE_PATCH_VERSION` * :variable:`CMAKE_TWEAK_VERSION` -Use the :command:`if` command ``VERSION_LESS``, ``VERSION_EQUAL``, or -``VERSION_GREATER`` operators to compare version string values against -``CMAKE_VERSION`` using a component-wise test. Version component -values may be 10 or larger so do not attempt to compare version -strings as floating-point numbers. +Use the :command:`if` command ``VERSION_LESS``, ``VERSION_GREATER``, +``VERSION_EQUAL``, ``VERSION_LESS_EQUAL``, or ``VERSION_GREATER_EQUAL`` +operators to compare version string values against ``CMAKE_VERSION`` using a +component-wise test. Version component values may be 10 or larger so do not +attempt to compare version strings as floating-point numbers. .. note:: diff --git a/Modules/Compiler/NAG-Fortran.cmake b/Modules/Compiler/NAG-Fortran.cmake index 18f141e..39aae18 100644 --- a/Modules/Compiler/NAG-Fortran.cmake +++ b/Modules/Compiler/NAG-Fortran.cmake @@ -33,3 +33,4 @@ set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-PIC") set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-fixed") set(CMAKE_Fortran_FORMAT_FREE_FLAG "-free") set(CMAKE_Fortran_COMPILE_OPTIONS_PIC "-PIC") +set(CMAKE_Fortran_COMPILE_OPTIONS_PIE "-PIC") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 55a9958..f354b57 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160809) +set(CMake_VERSION_PATCH 20160810) #set(CMake_VERSION_RC 1) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 0101049..8a856a8 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -366,11 +366,8 @@ bool cmCTest::ShouldCompressTestOutput() if (!this->ComputedCompressTestOutput) { std::string cdashVersion = this->GetCDashVersion(); // version >= 1.6? - bool cdashSupportsGzip = - cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, - cdashVersion.c_str(), "1.6") || - cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, - cdashVersion.c_str(), "1.6"); + bool cdashSupportsGzip = cmSystemTools::VersionCompare( + cmSystemTools::OP_GREATER_EQUAL, cdashVersion.c_str(), "1.6"); this->CompressTestOutput &= cdashSupportsGzip; this->ComputedCompressTestOutput = true; } diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index e02221c..d7532b3 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -21,12 +21,14 @@ static std::string const keyDEFINED = "DEFINED"; static std::string const keyEQUAL = "EQUAL"; static std::string const keyEXISTS = "EXISTS"; static std::string const keyGREATER = "GREATER"; +static std::string const keyGREATER_EQUAL = "GREATER_EQUAL"; static std::string const keyIN_LIST = "IN_LIST"; static std::string const keyIS_ABSOLUTE = "IS_ABSOLUTE"; static std::string const keyIS_DIRECTORY = "IS_DIRECTORY"; static std::string const keyIS_NEWER_THAN = "IS_NEWER_THAN"; static std::string const keyIS_SYMLINK = "IS_SYMLINK"; static std::string const keyLESS = "LESS"; +static std::string const keyLESS_EQUAL = "LESS_EQUAL"; static std::string const keyMATCHES = "MATCHES"; static std::string const keyNOT = "NOT"; static std::string const keyOR = "OR"; @@ -35,12 +37,16 @@ static std::string const keyParenR = ")"; static std::string const keyPOLICY = "POLICY"; static std::string const keySTREQUAL = "STREQUAL"; static std::string const keySTRGREATER = "STRGREATER"; +static std::string const keySTRGREATER_EQUAL = "STRGREATER_EQUAL"; static std::string const keySTRLESS = "STRLESS"; +static std::string const keySTRLESS_EQUAL = "STRLESS_EQUAL"; static std::string const keyTARGET = "TARGET"; static std::string const keyTEST = "TEST"; static std::string const keyVERSION_EQUAL = "VERSION_EQUAL"; static std::string const keyVERSION_GREATER = "VERSION_GREATER"; +static std::string const keyVERSION_GREATER_EQUAL = "VERSION_GREATER_EQUAL"; static std::string const keyVERSION_LESS = "VERSION_LESS"; +static std::string const keyVERSION_LESS_EQUAL = "VERSION_LESS_EQUAL"; cmConditionEvaluator::cmConditionEvaluator(cmMakefile& makefile, const cmListFileContext& context, @@ -559,7 +565,9 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, if (argP1 != newArgs.end() && argP2 != newArgs.end() && (this->IsKeyword(keyLESS, *argP1) || + this->IsKeyword(keyLESS_EQUAL, *argP1) || this->IsKeyword(keyGREATER, *argP1) || + this->IsKeyword(keyGREATER_EQUAL, *argP1) || this->IsKeyword(keyEQUAL, *argP1))) { def = this->GetVariableOrString(*arg); def2 = this->GetVariableOrString(*argP2); @@ -570,8 +578,12 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, result = false; } else if (*(argP1) == keyLESS) { result = (lhs < rhs); + } else if (*(argP1) == keyLESS_EQUAL) { + result = (lhs <= rhs); } else if (*(argP1) == keyGREATER) { result = (lhs > rhs); + } else if (*(argP1) == keyGREATER_EQUAL) { + result = (lhs >= rhs); } else { result = (lhs == rhs); } @@ -580,16 +592,22 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, if (argP1 != newArgs.end() && argP2 != newArgs.end() && (this->IsKeyword(keySTRLESS, *argP1) || - this->IsKeyword(keySTREQUAL, *argP1) || - this->IsKeyword(keySTRGREATER, *argP1))) { + this->IsKeyword(keySTRLESS_EQUAL, *argP1) || + this->IsKeyword(keySTRGREATER, *argP1) || + this->IsKeyword(keySTRGREATER_EQUAL, *argP1) || + this->IsKeyword(keySTREQUAL, *argP1))) { def = this->GetVariableOrString(*arg); def2 = this->GetVariableOrString(*argP2); int val = strcmp(def, def2); bool result; if (*(argP1) == keySTRLESS) { result = (val < 0); + } else if (*(argP1) == keySTRLESS_EQUAL) { + result = (val <= 0); } else if (*(argP1) == keySTRGREATER) { result = (val > 0); + } else if (*(argP1) == keySTRGREATER_EQUAL) { + result = (val >= 0); } else // strequal { result = (val == 0); @@ -599,15 +617,23 @@ bool cmConditionEvaluator::HandleLevel2(cmArgumentList& newArgs, if (argP1 != newArgs.end() && argP2 != newArgs.end() && (this->IsKeyword(keyVERSION_LESS, *argP1) || + this->IsKeyword(keyVERSION_LESS_EQUAL, *argP1) || this->IsKeyword(keyVERSION_GREATER, *argP1) || + this->IsKeyword(keyVERSION_GREATER_EQUAL, *argP1) || this->IsKeyword(keyVERSION_EQUAL, *argP1))) { def = this->GetVariableOrString(*arg); def2 = this->GetVariableOrString(*argP2); - cmSystemTools::CompareOp op = cmSystemTools::OP_EQUAL; + cmSystemTools::CompareOp op; if (*argP1 == keyVERSION_LESS) { op = cmSystemTools::OP_LESS; + } else if (*argP1 == keyVERSION_LESS_EQUAL) { + op = cmSystemTools::OP_LESS_EQUAL; } else if (*argP1 == keyVERSION_GREATER) { op = cmSystemTools::OP_GREATER; + } else if (*argP1 == keyVERSION_GREATER_EQUAL) { + op = cmSystemTools::OP_GREATER_EQUAL; + } else { // version_equal + op = cmSystemTools::OP_EQUAL; } bool result = cmSystemTools::VersionCompare(op, def, def2); this->HandleBinaryOp(result, reducible, arg, newArgs, argP1, argP2); diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index ca7250b..6e2b16a 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -545,6 +545,25 @@ static const struct VersionGreaterNode : public cmGeneratorExpressionNode } } versionGreaterNode; +static const struct VersionGreaterEqNode : public cmGeneratorExpressionNode +{ + VersionGreaterEqNode() {} + + int NumExpectedParameters() const CM_OVERRIDE { return 2; } + + std::string Evaluate(const std::vector<std::string>& parameters, + cmGeneratorExpressionContext*, + const GeneratorExpressionContent*, + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + { + return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER_EQUAL, + parameters.front().c_str(), + parameters[1].c_str()) + ? "1" + : "0"; + } +} versionGreaterEqNode; + static const struct VersionLessNode : public cmGeneratorExpressionNode { VersionLessNode() {} @@ -564,6 +583,25 @@ static const struct VersionLessNode : public cmGeneratorExpressionNode } } versionLessNode; +static const struct VersionLessEqNode : public cmGeneratorExpressionNode +{ + VersionLessEqNode() {} + + int NumExpectedParameters() const CM_OVERRIDE { return 2; } + + std::string Evaluate(const std::vector<std::string>& parameters, + cmGeneratorExpressionContext*, + const GeneratorExpressionContent*, + cmGeneratorExpressionDAGChecker*) const CM_OVERRIDE + { + return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS_EQUAL, + parameters.front().c_str(), + parameters[1].c_str()) + ? "1" + : "0"; + } +} versionLessEqNode; + static const struct VersionEqualNode : public cmGeneratorExpressionNode { VersionEqualNode() {} @@ -1641,7 +1679,9 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( nodeMap["C_COMPILER_ID"] = &cCompilerIdNode; nodeMap["CXX_COMPILER_ID"] = &cxxCompilerIdNode; nodeMap["VERSION_GREATER"] = &versionGreaterNode; + nodeMap["VERSION_GREATER_EQUAL"] = &versionGreaterEqNode; nodeMap["VERSION_LESS"] = &versionLessNode; + nodeMap["VERSION_LESS_EQUAL"] = &versionLessEqNode; nodeMap["VERSION_EQUAL"] = &versionEqualNode; nodeMap["C_COMPILER_VERSION"] = &cCompilerVersionNode; nodeMap["CXX_COMPILER_VERSION"] = &cxxCompilerVersionNode; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 44418f2..3b8aaa6 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -867,6 +867,7 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs( break; } case cmState::OBJECT_LIBRARY: + case cmState::GLOBAL_TARGET: case cmState::UTILITY: { std::string path = target->GetLocalGenerator()->GetCurrentBinaryDirectory() + @@ -875,12 +876,6 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs( break; } - case cmState::GLOBAL_TARGET: - // Always use the target in HOME instead of an unused duplicate in a - // subdirectory. - outputs.push_back(this->NinjaOutputPath(target->GetName())); - break; - default: return; } @@ -890,10 +885,15 @@ void cmGlobalNinjaGenerator::AppendTargetDepends( cmGeneratorTarget const* target, cmNinjaDeps& outputs) { if (target->GetType() == cmState::GLOBAL_TARGET) { - // Global targets only depend on other utilities, which may not appear in - // the TargetDepends set (e.g. "all"). + // These depend only on other CMake-provided targets, e.g. "all". std::set<std::string> const& utils = target->GetUtilities(); - std::copy(utils.begin(), utils.end(), std::back_inserter(outputs)); + for (std::set<std::string>::const_iterator i = utils.begin(); + i != utils.end(); ++i) { + std::string d = + target->GetLocalGenerator()->GetCurrentBinaryDirectory() + + std::string("/") + *i; + outputs.push_back(this->ConvertToNinjaPath(d)); + } } else { cmNinjaDeps outs; cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target); diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 6250012..0fcd8ba 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -74,9 +74,12 @@ void cmInstallExportGenerator::ComputeTempDir() #else std::string::size_type const max_total_len = 1000; #endif - if (this->TempDir.size() < max_total_len) { + // Will generate files of the form "<temp-dir>/<base>-<config>.<ext>". + std::string::size_type const len = this->TempDir.size() + 1 + + this->FileName.size() + 1 + this->GetMaxConfigLength(); + if (len < max_total_len) { // Keep the total path length below the limit. - std::string::size_type max_len = max_total_len - this->TempDir.size(); + std::string::size_type const max_len = max_total_len - len; if (this->Destination.size() > max_len) { useMD5 = true; } @@ -102,6 +105,26 @@ void cmInstallExportGenerator::ComputeTempDir() } } +size_t cmInstallExportGenerator::GetMaxConfigLength() const +{ + // Always use at least 8 for "noconfig". + size_t len = 8; + if (this->ConfigurationTypes->empty()) { + if (this->ConfigurationName.size() > 8) { + len = this->ConfigurationName.size(); + } + } else { + for (std::vector<std::string>::const_iterator ci = + this->ConfigurationTypes->begin(); + ci != this->ConfigurationTypes->end(); ++ci) { + if (ci->size() > len) { + len = ci->size(); + } + } + } + return len; +} + void cmInstallExportGenerator::GenerateScript(std::ostream& os) { // Skip empty sets. diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index 4435f53..22e661b 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -53,6 +53,7 @@ protected: void GenerateImportFile(cmExportSet const* exportSet); void GenerateImportFile(const char* config, cmExportSet const* exportSet); void ComputeTempDir(); + size_t GetMaxConfigLength() const; cmExportSet* ExportSet; std::string FilePermissions; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 1466f8a..9030e05 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -38,19 +38,8 @@ cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target) return new cmNinjaNormalTargetGenerator(target); case cmState::UTILITY: + case cmState::GLOBAL_TARGET: return new cmNinjaUtilityTargetGenerator(target); - ; - - case cmState::GLOBAL_TARGET: { - // We only want to process global targets that live in the home - // (i.e. top-level) directory. CMake creates copies of these targets - // in every directory, which we don't need. - if (strcmp(target->GetLocalGenerator()->GetCurrentSourceDirectory(), - target->GetLocalGenerator()->GetSourceDirectory()) == 0) { - return new cmNinjaUtilityTargetGenerator(target); - } - // else fallthrough - } default: return CM_NULLPTR; diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index c549646..96a17ff 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -31,10 +31,12 @@ cmNinjaUtilityTargetGenerator::~cmNinjaUtilityTargetGenerator() void cmNinjaUtilityTargetGenerator::Generate() { - std::string utilCommandName = cmake::GetCMakeFilesDirectoryPostSlash(); + std::string utilCommandName = + this->GetLocalGenerator()->GetCurrentBinaryDirectory(); + utilCommandName += cmake::GetCMakeFilesDirectory(); + utilCommandName += "/"; utilCommandName += this->GetTargetName() + ".util"; - utilCommandName = - this->GetGlobalGenerator()->NinjaOutputPath(utilCommandName); + utilCommandName = this->ConvertToNinjaPath(utilCommandName); std::vector<std::string> commands; cmNinjaDeps deps, outputs, util_outputs(1, utilCommandName); @@ -144,6 +146,11 @@ void cmNinjaUtilityTargetGenerator::Generate() cmNinjaDeps(1, utilCommandName)); } - this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(), - this->GetGeneratorTarget()); + // Add an alias for the logical target name regardless of what directory + // contains it. Skip this for GLOBAL_TARGET because they are meant to + // be per-directory and have one at the top-level anyway. + if (this->GetGeneratorTarget()->GetType() != cmState::GLOBAL_TARGET) { + this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(), + this->GetGeneratorTarget()); + } } diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index dce4687..3c913ee 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -485,7 +485,8 @@ bool cmStringCommand::HandleCompareCommand( } std::string mode = args[1]; if ((mode == "EQUAL") || (mode == "NOTEQUAL") || (mode == "LESS") || - (mode == "GREATER")) { + (mode == "LESS_EQUAL") || (mode == "GREATER") || + (mode == "GREATER_EQUAL")) { if (args.size() < 5) { std::string e = "sub-command COMPARE, mode "; e += mode; @@ -500,8 +501,12 @@ bool cmStringCommand::HandleCompareCommand( bool result; if (mode == "LESS") { result = (left < right); + } else if (mode == "LESS_EQUAL") { + result = (left <= right); } else if (mode == "GREATER") { result = (left > right); + } else if (mode == "GREATER_EQUAL") { + result = (left >= right); } else if (mode == "EQUAL") { result = (left == right); } else // if(mode == "NOTEQUAL") diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 9740ef7..5745a01 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2380,10 +2380,10 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op, if (lhs < rhs) { // lhs < rhs, so true if operation is LESS - return op == cmSystemTools::OP_LESS; + return (op & cmSystemTools::OP_LESS) != 0; } else if (lhs > rhs) { // lhs > rhs, so true if operation is GREATER - return op == cmSystemTools::OP_GREATER; + return (op & cmSystemTools::OP_GREATER) != 0; } if (*endr == '.') { @@ -2395,7 +2395,7 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op, } } // lhs == rhs, so true if operation is EQUAL - return op == cmSystemTools::OP_EQUAL; + return (op & cmSystemTools::OP_EQUAL) != 0; } bool cmSystemTools::VersionCompareEqual(std::string const& lhs, @@ -2412,6 +2412,13 @@ bool cmSystemTools::VersionCompareGreater(std::string const& lhs, rhs.c_str()); } +bool cmSystemTools::VersionCompareGreaterEq(std::string const& lhs, + std::string const& rhs) +{ + return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER_EQUAL, + lhs.c_str(), rhs.c_str()); +} + bool cmSystemTools::RemoveRPath(std::string const& file, std::string* emsg, bool* removed) { diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 39e7994..d0a28e1 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -284,9 +284,11 @@ public: enum CompareOp { - OP_LESS, - OP_GREATER, - OP_EQUAL + OP_EQUAL = 1, + OP_LESS = 2, + OP_GREATER = 4, + OP_LESS_EQUAL = OP_LESS | OP_EQUAL, + OP_GREATER_EQUAL = OP_GREATER | OP_EQUAL }; /** @@ -297,6 +299,8 @@ public: std::string const& rhs); static bool VersionCompareGreater(std::string const& lhs, std::string const& rhs); + static bool VersionCompareGreaterEq(std::string const& lhs, + std::string const& rhs); /** * Determine the file type based on the extension diff --git a/Tests/CMakeTests/VersionTest.cmake.in b/Tests/CMakeTests/VersionTest.cmake.in index 4e946ab..f045605 100644 --- a/Tests/CMakeTests/VersionTest.cmake.in +++ b/Tests/CMakeTests/VersionTest.cmake.in @@ -83,10 +83,24 @@ foreach(v IN LISTS LESSV) message(FATAL_ERROR "${CMAKE_MATCH_2} is less than ${CMAKE_MATCH_1}?") endif() + # check greater or equal (same as less negative) + if(CMAKE_MATCH_2 VERSION_GREATER_EQUAL CMAKE_MATCH_1) + message(STATUS "${CMAKE_MATCH_2} is not less than ${CMAKE_MATCH_1}") + else() + message(FATAL_ERROR "${CMAKE_MATCH_2} is less than ${CMAKE_MATCH_1}?") + endif() + # check greater negative case if(NOT CMAKE_MATCH_1 VERSION_GREATER CMAKE_MATCH_2) message(STATUS "${CMAKE_MATCH_1} is not greater than ${CMAKE_MATCH_2}") else() message(FATAL_ERROR "${CMAKE_MATCH_1} is greater than ${CMAKE_MATCH_2}?") endif() + + # check less or equal (same as greater negative) case + if(CMAKE_MATCH_1 VERSION_LESS_EQUAL CMAKE_MATCH_2) + message(STATUS "${CMAKE_MATCH_1} is not greater than ${CMAKE_MATCH_2}") + else() + message(FATAL_ERROR "${CMAKE_MATCH_1} is greater than ${CMAKE_MATCH_2}?") + endif() endforeach() diff --git a/Tests/CTestTestStopTime/GetDate.cmake b/Tests/CTestTestStopTime/GetDate.cmake index edc6519..1f4cb24 100644 --- a/Tests/CTestTestStopTime/GetDate.cmake +++ b/Tests/CTestTestStopTime/GetDate.cmake @@ -106,11 +106,11 @@ macro(ADD_SECONDS sec) set(new_min ${${GD_PREFIX}MINUTE}) set(new_hr ${${GD_PREFIX}HOUR}) math(EXPR new_sec "${sec} + ${${GD_PREFIX}SECOND}") - while(${new_sec} GREATER 60 OR ${new_sec} EQUAL 60) + while(${new_sec} GREATER_EQUAL 60) math(EXPR new_sec "${new_sec} - 60") math(EXPR new_min "${${GD_PREFIX}MINUTE} + 1") endwhile() - while(${new_min} GREATER 60 OR ${new_min} EQUAL 60) + while(${new_min} GREATER_EQUAL 60) math(EXPR new_min "${new_min} - 60") math(EXPR new_hr "${${GD_PREFIX}HOUR} + 1") endwhile() diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index 80cc2e3..075faa7 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -92,6 +92,12 @@ endif() if(NOT 2.4 EQUAL 2.4) message(FATAL_ERROR "Failed: NOT 2.4 EQUAL 2.4") endif() +if(NOT 2.4 LESS_EQUAL 2.4) + message(FATAL_ERROR "Failed: NOT 2.4 LESS_EQUAL 2.4") +endif() +if(NOT 2.4 GREATER_EQUAL 2.4) + message(FATAL_ERROR "Failed: NOT 2.4 GREATER_EQUAL 2.4") +endif() if(CMAKE_SYSTEM MATCHES "OSF1-V") if(NOT CMAKE_COMPILER_IS_GNUCXX) diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index 5f79ac0..3b09229 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -455,7 +455,7 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_LESS - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS is not defined.\n"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS is not defined."); #else cmPassed("SHOULD_BE_DEFINED_LESS is defined."); #endif @@ -467,7 +467,7 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_LESS2 - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS2 is not defined.\n"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_LESS2 is not defined."); #else cmPassed("SHOULD_BE_DEFINED_LESS2 is defined."); #endif @@ -478,6 +478,24 @@ int main() cmPassed("SHOULD_NOT_BE_DEFINED_GREATER is not defined."); #endif +#ifndef SHOULD_BE_DEFINED_GREATER + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_GREATER is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_GREATER2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_GREATER2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_GREATER2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER2 is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_GREATER2 is defined."); +#endif + #ifdef SHOULD_NOT_BE_DEFINED_EQUAL cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_EQUAL is defined."); #else @@ -485,28 +503,93 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_EQUAL - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_EQUAL is not defined.\n"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_EQUAL is not defined."); #else cmPassed("SHOULD_BE_DEFINED_EQUAL is defined."); #endif -#ifndef SHOULD_BE_DEFINED_GREATER - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER is not defined.\n"); +#ifdef SHOULD_NOT_BE_DEFINED_LESS_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS_EQUAL is defined."); #else - cmPassed("SHOULD_BE_DEFINED_GREATER is defined."); + cmPassed("SHOULD_NOT_BE_DEFINED_LESS_EQUAL is not defined."); #endif -#ifdef SHOULD_NOT_BE_DEFINED_GREATER2 - cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER2 is defined."); +#ifndef SHOULD_BE_DEFINED_LESS_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_LESS_EQUAL is not defined."); #else - cmPassed("SHOULD_NOT_BE_DEFINED_GREATER2 is not defined."); + cmPassed("SHOULD_BE_DEFINED_LESS_EQUAL is defined."); #endif -#ifndef SHOULD_BE_DEFINED_GREATER2 +#ifdef SHOULD_NOT_BE_DEFINED_LESS_EQUAL2 cmFailed( - "IF or SET is broken, SHOULD_BE_DEFINED_GREATER2 is not defined.\n"); + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS_EQUAL2 is defined."); #else - cmPassed("SHOULD_BE_DEFINED_GREATER2 is defined."); + cmPassed("SHOULD_NOT_BE_DEFINED_LESS_EQUAL2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_LESS_EQUAL2 + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_LESS_EQUAL2 is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_LESS_EQUAL2 is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_LESS_EQUAL3 + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS_EQUAL3 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_LESS_EQUAL3 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_LESS_EQUAL3 + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_LESS_EQUAL3 is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_LESS_EQUAL3 is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_GREATER_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER_EQUAL is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_GREATER_EQUAL is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_GREATER_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_GREATER_EQUAL is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_GREATER_EQUAL is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_GREATER_EQUAL2 + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER_EQUAL2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_GREATER_EQUAL2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_GREATER_EQUAL2 + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_GREATER_EQUAL2 is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_GREATER_EQUAL2 is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_GREATER_EQUAL3 + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER_EQUAL3 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_GREATER_EQUAL3 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_GREATER_EQUAL3 + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_GREATER_EQUAL3 is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_GREATER_EQUAL3 is defined."); #endif #ifdef SHOULD_NOT_BE_DEFINED_STRLESS @@ -516,7 +599,7 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_STRLESS - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS is not defined.\n"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS is not defined."); #else cmPassed("SHOULD_BE_DEFINED_STRLESS is defined."); #endif @@ -528,8 +611,7 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_STRLESS2 - cmFailed( - "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS2 is not defined.\n"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS2 is not defined."); #else cmPassed("SHOULD_BE_DEFINED_STRLESS2 is defined."); #endif @@ -543,7 +625,7 @@ int main() #ifndef SHOULD_BE_DEFINED_STRGREATER cmFailed( - "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER is not defined.\n"); + "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER is not defined."); #else cmPassed("SHOULD_BE_DEFINED_STRGREATER is defined."); #endif @@ -557,11 +639,95 @@ int main() #ifndef SHOULD_BE_DEFINED_STRGREATER2 cmFailed( - "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER2 is not defined.\n"); + "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER2 is not defined."); #else cmPassed("SHOULD_BE_DEFINED_STRGREATER2 is defined."); #endif +#ifdef SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_STRLESS_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS_EQUAL is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_STRLESS_EQUAL is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2 + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_STRLESS_EQUAL2 + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS_EQUAL2 is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_STRLESS_EQUAL2 is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3 + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_STRLESS_EQUAL3 + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS_EQUAL3 is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_STRLESS_EQUAL3 is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_STRGREATER_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER_EQUAL is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_STRGREATER_EQUAL is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2 is " + "defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_STRGREATER_EQUAL2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER_EQUAL2 is not " + "defined."); +#else + cmPassed("SHOULD_BE_DEFINED_STRGREATER_EQUAL2 is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3 is " + "defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_STRGREATER_EQUAL3 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER_EQUAL3 is not " + "defined."); +#else + cmPassed("SHOULD_BE_DEFINED_STRGREATER_EQUAL3 is defined."); +#endif + // ---------------------------------------------------------------------- // Test FOREACH diff --git a/Tests/Complex/VarTests.cmake b/Tests/Complex/VarTests.cmake index 9d35949..8be59be 100644 --- a/Tests/Complex/VarTests.cmake +++ b/Tests/Complex/VarTests.cmake @@ -126,6 +126,12 @@ else () add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER) endif () +if (SNUM1_VAR GREATER SNUM2_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER2) +else () + add_definitions(-DSHOULD_BE_DEFINED_GREATER2) +endif () + if (SNUM2_VAR EQUAL SNUM1_VAR) add_definitions(-DSHOULD_NOT_BE_DEFINED_EQUAL) else () @@ -138,10 +144,40 @@ else () add_definitions(-DSHOULD_NOT_BE_DEFINED_EQUAL) endif () -if (SNUM1_VAR GREATER SNUM2_VAR) - add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER2) +if (SNUM1_VAR LESS_EQUAL SNUM2_VAR) + add_definitions(-DSHOULD_BE_DEFINED_LESS_EQUAL) else () - add_definitions(-DSHOULD_BE_DEFINED_GREATER2) + add_definitions(-DSHOULD_NOT_BE_DEFINED_LESS_EQUAL) +endif () + +if (SNUM2_VAR LESS_EQUAL SNUM1_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_LESS_EQUAL2) +else () + add_definitions(-DSHOULD_BE_DEFINED_LESS_EQUAL2) +endif () + +if (SNUM1_VAR LESS_EQUAL SNUM3_VAR) + add_definitions(-DSHOULD_BE_DEFINED_LESS_EQUAL3) +else () + add_definitions(-DSHOULD_BE_DEFINED_LESS_EQUAL3) +endif () + +if (SNUM2_VAR GREATER_EQUAL SNUM1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_GREATER_EQUAL) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER_EQUAL) +endif () + +if (SNUM1_VAR GREATER_EQUAL SNUM2_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER_EQUAL2) +else () + add_definitions(-DSHOULD_BE_DEFINED_GREATER_EQUAL2) +endif () + +if (SNUM1_VAR GREATER_EQUAL SNUM3_VAR) + add_definitions(-DSHOULD_BE_DEFINED_GREATER_EQUAL3) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER_EQUAL3) endif () set (SSTR1_VAR "abc") @@ -171,6 +207,42 @@ else () add_definitions(-DSHOULD_BE_DEFINED_STRGREATER2) endif () +if (SSTR1_VAR STRLESS_EQUAL SSTR2_VAR) + add_definitions(-DSHOULD_BE_DEFINED_STRLESS_EQUAL) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRLESS_EQUAL) +endif () + +if (SSTR2_VAR STRLESS_EQUAL SSTR1_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2) +else () + add_definitions(-DSHOULD_BE_DEFINED_STRLESS_EQUAL2) +endif () + +if (SSTR1_VAR STRLESS_EQUAL SSTR1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_STRLESS_EQUAL3) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3) +endif () + +if (SSTR2_VAR STRGREATER_EQUAL SSTR1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_STRGREATER_EQUAL) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL) +endif () + +if (SSTR1_VAR STRGREATER_EQUAL SSTR2_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2) +else () + add_definitions(-DSHOULD_BE_DEFINED_STRGREATER_EQUAL2) +endif () + +if (SSTR1_VAR STRGREATER_EQUAL SSTR1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_STRGREATER_EQUAL3) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3) +endif () + # # Test FOREACH # diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index 5f79ac0..9e4eaad 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -478,6 +478,24 @@ int main() cmPassed("SHOULD_NOT_BE_DEFINED_GREATER is not defined."); #endif +#ifndef SHOULD_BE_DEFINED_GREATER + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER is not defined.\n"); +#else + cmPassed("SHOULD_BE_DEFINED_GREATER is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_GREATER2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_GREATER2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_GREATER2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER2 is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_GREATER2 is defined."); +#endif + #ifdef SHOULD_NOT_BE_DEFINED_EQUAL cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_EQUAL is defined."); #else @@ -490,23 +508,88 @@ int main() cmPassed("SHOULD_BE_DEFINED_EQUAL is defined."); #endif -#ifndef SHOULD_BE_DEFINED_GREATER - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_GREATER is not defined.\n"); +#ifdef SHOULD_NOT_BE_DEFINED_LESS_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS_EQUAL is defined."); #else - cmPassed("SHOULD_BE_DEFINED_GREATER is defined."); + cmPassed("SHOULD_NOT_BE_DEFINED_LESS_EQUAL is not defined."); #endif -#ifdef SHOULD_NOT_BE_DEFINED_GREATER2 - cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER2 is defined."); +#ifndef SHOULD_BE_DEFINED_LESS_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_LESS_EQUAL is not defined."); #else - cmPassed("SHOULD_NOT_BE_DEFINED_GREATER2 is not defined."); + cmPassed("SHOULD_BE_DEFINED_LESS_EQUAL is defined."); #endif -#ifndef SHOULD_BE_DEFINED_GREATER2 +#ifdef SHOULD_NOT_BE_DEFINED_LESS_EQUAL2 cmFailed( - "IF or SET is broken, SHOULD_BE_DEFINED_GREATER2 is not defined.\n"); + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS_EQUAL2 is defined."); #else - cmPassed("SHOULD_BE_DEFINED_GREATER2 is defined."); + cmPassed("SHOULD_NOT_BE_DEFINED_LESS_EQUAL2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_LESS_EQUAL2 + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_LESS_EQUAL2 is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_LESS_EQUAL2 is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_LESS_EQUAL3 + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_LESS_EQUAL3 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_LESS_EQUAL3 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_LESS_EQUAL3 + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_LESS_EQUAL3 is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_LESS_EQUAL3 is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_GREATER_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER_EQUAL is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_GREATER_EQUAL is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_GREATER_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_GREATER_EQUAL is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_GREATER_EQUAL is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_GREATER_EQUAL2 + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER_EQUAL2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_GREATER_EQUAL2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_GREATER_EQUAL2 + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_GREATER_EQUAL2 is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_GREATER_EQUAL2 is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_GREATER_EQUAL3 + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_GREATER_EQUAL3 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_GREATER_EQUAL3 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_GREATER_EQUAL3 + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_GREATER_EQUAL3 is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_GREATER_EQUAL3 is defined."); #endif #ifdef SHOULD_NOT_BE_DEFINED_STRLESS @@ -516,7 +599,7 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_STRLESS - cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS is not defined.\n"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS is not defined."); #else cmPassed("SHOULD_BE_DEFINED_STRLESS is defined."); #endif @@ -528,8 +611,7 @@ int main() #endif #ifndef SHOULD_BE_DEFINED_STRLESS2 - cmFailed( - "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS2 is not defined.\n"); + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRLESS2 is not defined."); #else cmPassed("SHOULD_BE_DEFINED_STRLESS2 is defined."); #endif @@ -543,7 +625,7 @@ int main() #ifndef SHOULD_BE_DEFINED_STRGREATER cmFailed( - "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER is not defined.\n"); + "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER is not defined."); #else cmPassed("SHOULD_BE_DEFINED_STRGREATER is defined."); #endif @@ -557,11 +639,95 @@ int main() #ifndef SHOULD_BE_DEFINED_STRGREATER2 cmFailed( - "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER2 is not defined.\n"); + "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER2 is not defined."); #else cmPassed("SHOULD_BE_DEFINED_STRGREATER2 is defined."); #endif +#ifdef SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_STRLESS_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS_EQUAL is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_STRLESS_EQUAL is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2 + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_STRLESS_EQUAL2 + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS_EQUAL2 is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_STRLESS_EQUAL2 is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3 + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3 is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_STRLESS_EQUAL3 + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_STRLESS_EQUAL3 is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_STRLESS_EQUAL3 is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL is defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_STRGREATER_EQUAL + cmFailed( + "IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER_EQUAL is not defined."); +#else + cmPassed("SHOULD_BE_DEFINED_STRGREATER_EQUAL is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2 is " + "defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_STRGREATER_EQUAL2 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER_EQUAL2 is not " + "defined."); +#else + cmPassed("SHOULD_BE_DEFINED_STRGREATER_EQUAL2 is defined."); +#endif + +#ifdef SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3 + cmFailed("IF or SET is broken, SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3 is " + "defined."); +#else + cmPassed("SHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3 is not defined."); +#endif + +#ifndef SHOULD_BE_DEFINED_STRGREATER_EQUAL3 + cmFailed("IF or SET is broken, SHOULD_BE_DEFINED_STRGREATER_EQUAL3 is not " + "defined."); +#else + cmPassed("SHOULD_BE_DEFINED_STRGREATER_EQUAL3 is defined."); +#endif + // ---------------------------------------------------------------------- // Test FOREACH diff --git a/Tests/ComplexOneConfig/VarTests.cmake b/Tests/ComplexOneConfig/VarTests.cmake index 9d35949..7dd8519 100644 --- a/Tests/ComplexOneConfig/VarTests.cmake +++ b/Tests/ComplexOneConfig/VarTests.cmake @@ -126,6 +126,12 @@ else () add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER) endif () +if (SNUM1_VAR GREATER SNUM2_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER2) +else () + add_definitions(-DSHOULD_BE_DEFINED_GREATER2) +endif () + if (SNUM2_VAR EQUAL SNUM1_VAR) add_definitions(-DSHOULD_NOT_BE_DEFINED_EQUAL) else () @@ -138,10 +144,40 @@ else () add_definitions(-DSHOULD_NOT_BE_DEFINED_EQUAL) endif () -if (SNUM1_VAR GREATER SNUM2_VAR) - add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER2) +if (SNUM1_VAR LESS_EQUAL SNUM2_VAR) + add_definitions(-DSHOULD_BE_DEFINED_LESS_EQUAL) else () - add_definitions(-DSHOULD_BE_DEFINED_GREATER2) + add_definitions(-DSHOULD_NOT_BE_DEFINED_LESS_EQUAL) +endif () + +if (SNUM2_VAR LESS_EQUAL SNUM1_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_LESS_EQUAL2) +else () + add_definitions(-DSHOULD_BE_DEFINED_LESS_EQUAL2) +endif () + +if (SNUM1_VAR LESS_EQUAL SNUM3_VAR) + add_definitions(-DSHOULD_BE_DEFINED_LESS_EQUAL3) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_LESS_EQUAL3) +endif () + +if (SNUM2_VAR GREATER_EQUAL SNUM1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_GREATER_EQUAL) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER_EQUAL) +endif () + +if (SNUM1_VAR GREATER_EQUAL SNUM2_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER_EQUAL2) +else () + add_definitions(-DSHOULD_BE_DEFINED_GREATER_EQUAL2) +endif () + +if (SNUM1_VAR GREATER_EQUAL SNUM3_VAR) + add_definitions(-DSHOULD_BE_DEFINED_GREATER_EQUAL3) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_GREATER_EQUAL3) endif () set (SSTR1_VAR "abc") @@ -171,6 +207,42 @@ else () add_definitions(-DSHOULD_BE_DEFINED_STRGREATER2) endif () +if (SSTR1_VAR STRLESS_EQUAL SSTR2_VAR) + add_definitions(-DSHOULD_BE_DEFINED_STRLESS_EQUAL) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRLESS_EQUAL) +endif () + +if (SSTR2_VAR STRLESS_EQUAL SSTR1_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRLESS_EQUAL2) +else () + add_definitions(-DSHOULD_BE_DEFINED_STRLESS_EQUAL2) +endif () + +if (SSTR1_VAR STRLESS_EQUAL SSTR1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_STRLESS_EQUAL3) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRLESS_EQUAL3) +endif () + +if (SSTR2_VAR STRGREATER_EQUAL SSTR1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_STRGREATER_EQUAL) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL) +endif () + +if (SSTR1_VAR STRGREATER_EQUAL SSTR2_VAR) + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL2) +else () + add_definitions(-DSHOULD_BE_DEFINED_STRGREATER_EQUAL2) +endif () + +if (SSTR1_VAR STRGREATER_EQUAL SSTR1_VAR) + add_definitions(-DSHOULD_BE_DEFINED_STRGREATER_EQUAL3) +else () + add_definitions(-DSHOULD_NOT_BE_DEFINED_STRGREATER_EQUAL3) +endif () + # # Test FOREACH # diff --git a/Tests/RunCMake/Framework/RunCMakeTest.cmake b/Tests/RunCMake/Framework/RunCMakeTest.cmake index d810283..eeea6f1 100644 --- a/Tests/RunCMake/Framework/RunCMakeTest.cmake +++ b/Tests/RunCMake/Framework/RunCMakeTest.cmake @@ -20,7 +20,7 @@ unset(RunCMake_TEST_OPTIONS) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/OSXFrameworkLayout-build) set(RunCMake_TEST_NO_CLEAN 1) -set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/OSX.cmake") +set(RunCMake_TEST_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/osx.cmake") file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index c73f852..622c327 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -41,10 +41,16 @@ function(run_SubDir) run_cmake(SubDir) if(WIN32) set(SubDir_all [[SubDir\all]]) + set(SubDir_test [[SubDir\test]]) + set(SubDir_install [[SubDir\install]]) else() set(SubDir_all [[SubDir/all]]) + set(SubDir_test [[SubDir/test]]) + set(SubDir_install [[SubDir/install]]) endif() run_cmake_command(SubDir-build ${CMAKE_COMMAND} --build . --target ${SubDir_all}) + run_cmake_command(SubDir-test ${CMAKE_COMMAND} --build . --target ${SubDir_test}) + run_cmake_command(SubDir-install ${CMAKE_COMMAND} --build . --target ${SubDir_install}) endfunction() run_SubDir() diff --git a/Tests/RunCMake/Ninja/SubDir-install-stdout.txt b/Tests/RunCMake/Ninja/SubDir-install-stdout.txt new file mode 100644 index 0000000..4261b0e --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDir-install-stdout.txt @@ -0,0 +1 @@ +-- Installing SubDir diff --git a/Tests/RunCMake/Ninja/SubDir-test-stdout.txt b/Tests/RunCMake/Ninja/SubDir-test-stdout.txt new file mode 100644 index 0000000..9c493ac --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDir-test-stdout.txt @@ -0,0 +1 @@ +1/1 Test #1: SubDirTest diff --git a/Tests/RunCMake/Ninja/SubDir.cmake b/Tests/RunCMake/Ninja/SubDir.cmake index 7224ec3..d227753 100644 --- a/Tests/RunCMake/Ninja/SubDir.cmake +++ b/Tests/RunCMake/Ninja/SubDir.cmake @@ -1,2 +1,7 @@ +include(CTest) add_subdirectory(SubDir) add_custom_target(TopFail ALL COMMAND does_not_exist) +add_test(NAME TopTest COMMAND ${CMAKE_COMMAND} -E echo "Running TopTest") +install(CODE [[ + message(FATAL_ERROR "Installing Top") +]]) diff --git a/Tests/RunCMake/Ninja/SubDir/CMakeLists.txt b/Tests/RunCMake/Ninja/SubDir/CMakeLists.txt index 73ae431..456c1db 100644 --- a/Tests/RunCMake/Ninja/SubDir/CMakeLists.txt +++ b/Tests/RunCMake/Ninja/SubDir/CMakeLists.txt @@ -1,2 +1,6 @@ add_custom_target(SubFail COMMAND does_not_exist) add_custom_target(InAll ALL COMMAND ${CMAKE_COMMAND} -E echo "Building InAll") +add_test(NAME SubDirTest COMMAND ${CMAKE_COMMAND} -E echo "Running SubDirTest") +install(CODE [[ + message(STATUS "Installing SubDir") +]]) |