diff options
-rw-r--r-- | Help/command/if.rst | 9 | ||||
-rw-r--r-- | Help/release/dev/if-supports-cache-defined.rst | 5 | ||||
-rw-r--r-- | Modules/DeployQt4.cmake | 12 | ||||
-rw-r--r-- | Modules/FindBoost.cmake | 6 | ||||
-rw-r--r-- | Modules/WriteCompilerDetectionHeader.cmake | 9 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 39 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 2 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 43 | ||||
-rw-r--r-- | Source/cmCTest.h | 24 | ||||
-rw-r--r-- | Source/cmConditionEvaluator.cxx | 6 | ||||
-rw-r--r-- | Source/cmVS141CLFlagTable.h | 2 | ||||
-rw-r--r-- | Tests/Unset/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Utilities/Scripts/BoostScanDeps.cmake | 4 |
13 files changed, 133 insertions, 37 deletions
diff --git a/Help/command/if.rst b/Help/command/if.rst index 1cd9965..a682c83 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -187,11 +187,10 @@ Possible conditions are: ``if(<variable|string> IN_LIST <variable>)`` True if the given element is contained in the named list variable. -``if(DEFINED <name>|ENV{<name>})`` - True if a variable or environment variable - with given ``<name>`` is defined. - The value of the variable does not matter. - Note that macro arguments are not variables. +``if(DEFINED <name>|CACHE{<name>}|ENV{<name>})`` + True if a variable, cache variable or environment variable + with given ``<name>`` is defined. The value of the variable + does not matter. Note that macro arguments are not variables. ``if((condition) AND (condition OR (condition)))`` The conditions inside the parenthesis are evaluated first and then diff --git a/Help/release/dev/if-supports-cache-defined.rst b/Help/release/dev/if-supports-cache-defined.rst new file mode 100644 index 0000000..1e700c0 --- /dev/null +++ b/Help/release/dev/if-supports-cache-defined.rst @@ -0,0 +1,5 @@ +if-supports-cache-defined +------------------------- + +* The :command:`if` command gained support for checking if cache variables + are defined with the ``DEFINED CACHE{VAR}`` syntax. diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index c69cd38..4a18927 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -26,13 +26,13 @@ PARENT_SCOPE. Also depends on BundleUtilities.cmake. :: - WRITE_QT4_CONF(<qt_conf_dir> <qt_conf_contents>) + write_qt4_conf(<qt_conf_dir> <qt_conf_contents>) Writes a qt.conf file with the <qt_conf_contents> into <qt_conf_dir>. :: - RESOLVE_QT4_PATHS(<paths_var> [<executable_path>]) + resolve_qt4_paths(<paths_var> [<executable_path>]) Loop through <paths_var> list and if any don't exist resolve them relative to the <executable_path> (if supplied) or the @@ -40,7 +40,7 @@ CMAKE_INSTALL_PREFIX. :: - FIXUP_QT4_EXECUTABLE(<executable> + fixup_qt4_executable(<executable> [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf>]) Copies Qt plugins, writes a Qt configuration file (if needed) and @@ -67,7 +67,7 @@ needed. :: - INSTALL_QT4_PLUGIN_PATH(plugin executable copy installed_plugin_path_var + install_qt4_plugin_path(plugin executable copy installed_plugin_path_var <plugins_dir> <component> <configurations>) Install (or copy) a resolved <plugin> to the default plugins directory @@ -82,7 +82,7 @@ If <component> is set then anything installed will use this COMPONENT. :: - INSTALL_QT4_PLUGIN(plugin executable copy installed_plugin_path_var + install_qt4_plugin(plugin executable copy installed_plugin_path_var <plugins_dir> <component>) Install (or copy) an unresolved <plugin> to the default plugins @@ -92,7 +92,7 @@ INSTALL_QT4_PLUGIN_PATH. :: - INSTALL_QT4_EXECUTABLE(<executable> + install_qt4_executable(<executable> [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf> <component>]) Installs Qt plugins, writes a Qt configuration file (if needed) and diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 7abddbd..ccd245b 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -873,9 +873,8 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_NUMPY_DEPENDENCIES python) - set(_Boost_SYNC_DEPENDENCIES chrono atomic) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) set(_Boost_TIMER_DEPENDENCIES chrono system) set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) @@ -1129,6 +1128,7 @@ else() # _Boost_COMPONENT_HEADERS. See the instructions at the top of # _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} + "1.69.0" "1.69" "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index a556567..21ccd7c 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -7,9 +7,8 @@ WriteCompilerDetectionHeader This module provides the function write_compiler_detection_header(). -The ``WRITE_COMPILER_DETECTION_HEADER`` function can be used to generate -a file suitable for preprocessor inclusion which contains macros to be -used in source code:: +This function can be used to generate a file suitable for preprocessor +inclusion which contains macros to be used in source code:: write_compiler_detection_header( FILE <file> @@ -25,8 +24,8 @@ used in source code:: [ALLOW_UNKNOWN_COMPILER_VERSIONS] ) -The ``write_compiler_detection_header`` function generates the -file ``<file>`` with macros which all have the prefix ``<prefix>``. +This generates the file ``<file>`` with macros which all have the prefix +``<prefix>``. By default, all content is written directly to the ``<file>``. The ``OUTPUT_FILES_VAR`` may be specified to cause the compiler-specific diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index c936910..1d938e6 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -535,11 +535,21 @@ int cmCTestTestHandler::ProcessHandler() percent = 99; } + std::string passColorCode; + std::string failedColorCode; + if (failed.empty()) { + passColorCode = this->CTest->GetColorCode(cmCTest::Color::GREEN); + } else { + failedColorCode = this->CTest->GetColorCode(cmCTest::Color::RED); + } cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl - << static_cast<int>(percent + .5f) << "% tests passed, " - << failed.size() << " tests failed out of " << total - << std::endl); + << passColorCode << static_cast<int>(percent + .5f) + << "% tests passed" + << this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR) + << ", " << failedColorCode << failed.size() << " tests failed" + << this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR) + << " out of " << total << std::endl); if ((!this->CTest->GetLabelsForSubprojects().empty() && this->CTest->GetSubprojectSummary())) { this->PrintLabelOrSubprojectSummary(true); @@ -562,6 +572,8 @@ int cmCTestTestHandler::ProcessHandler() this->StartLogFile("TestsDisabled", ofs); const char* disabled_reason; + cmCTestLog(this->CTest, HANDLER_OUTPUT, + this->CTest->GetColorCode(cmCTest::Color::BLUE)); for (cmCTestTestResult const& dt : disabledTests) { ofs << dt.TestCount << ":" << dt.Name << std::endl; if (dt.CompletionStatus == "Disabled") { @@ -573,6 +585,8 @@ int cmCTestTestHandler::ProcessHandler() "\t" << std::setw(3) << dt.TestCount << " - " << dt.Name << " (" << disabled_reason << ")" << std::endl); } + cmCTestLog(this->CTest, HANDLER_OUTPUT, + this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR)); } if (!failed.empty()) { @@ -587,10 +601,17 @@ int cmCTestTestHandler::ProcessHandler() !cmHasLiteralPrefix(ft.CompletionStatus, "SKIP_RETURN_CODE=") && ft.CompletionStatus != "Disabled") { ofs << ft.TestCount << ":" << ft.Name << std::endl; - cmCTestLog(this->CTest, HANDLER_OUTPUT, - "\t" << std::setw(3) << ft.TestCount << " - " << ft.Name - << " (" << this->GetTestStatus(ft) << ")" - << std::endl); + auto testColor = cmCTest::Color::RED; + if (this->GetTestStatus(ft) == "Not Run") { + testColor = cmCTest::Color::YELLOW; + } + cmCTestLog( + this->CTest, HANDLER_OUTPUT, + "\t" << this->CTest->GetColorCode(testColor) << std::setw(3) + << ft.TestCount << " - " << ft.Name << " (" + << this->GetTestStatus(ft) << ")" + << this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR) + << std::endl); } } } @@ -1725,7 +1746,7 @@ void cmCTestTestHandler::UseExcludeRegExp() this->UseExcludeRegExpFirst = !this->UseIncludeRegExpFlag; } -const char* cmCTestTestHandler::GetTestStatus(cmCTestTestResult const& result) +std::string cmCTestTestHandler::GetTestStatus(cmCTestTestResult const& result) { static const char* statuses[] = { "Not Run", "Timeout", "SEGFAULT", "ILLEGAL", "INTERRUPT", "NUMERICAL", @@ -1737,7 +1758,7 @@ const char* cmCTestTestHandler::GetTestStatus(cmCTestTestResult const& result) return "No Status"; } if (status == cmCTestTestHandler::OTHER_FAULT) { - return result.ExceptionStatus.c_str(); + return result.ExceptionStatus; } return statuses[status]; } diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index d2694a1..bcacf23 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -274,7 +274,7 @@ private: */ std::string FindTheExecutable(const char* exe); - const char* GetTestStatus(cmCTestTestResult const&); + std::string GetTestStatus(cmCTestTestResult const&); void ExpandTestsToRunInformation(size_t numPossibleTests); void ExpandTestsToRunInformationForRerunFailed(); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 9a046db..c2b6575 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -296,6 +296,7 @@ cmCTest::cmCTest() this->DropSiteCDash = false; this->BuildID = ""; this->OutputTestOutputOnTestFailure = false; + this->OutputColorCode = this->ColoredOutputSupportedByConsole(); this->RepeatTests = 1; // default to run each test once this->RepeatUntilFail = false; @@ -2075,7 +2076,18 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, return true; } -bool cmCTest::ProgressOutputSupportedByConsole() const +#if !defined(_WIN32) +bool cmCTest::ConsoleIsNotDumb() +{ + std::string term_env_variable; + if (cmSystemTools::GetEnv("TERM", term_env_variable)) { + return isatty(1) && term_env_variable != "dumb"; + } + return false; +} +#endif + +bool cmCTest::ProgressOutputSupportedByConsole() { #if defined(_WIN32) // On Windows we need a console buffer. @@ -2084,12 +2096,19 @@ bool cmCTest::ProgressOutputSupportedByConsole() const return GetConsoleScreenBufferInfo(console, &csbi); #else // On UNIX we need a non-dumb tty. - std::string term_env_variable; - if (cmSystemTools::GetEnv("TERM", term_env_variable)) { - return isatty(1) && term_env_variable != "dumb"; - } + return ConsoleIsNotDumb(); #endif +} + +bool cmCTest::ColoredOutputSupportedByConsole() +{ +#if defined(_WIN32) + // Not supported on Windows return false; +#else + // On UNIX we need a non-dumb tty. + return ConsoleIsNotDumb(); +#endif } // handle the -S -SR and -SP arguments @@ -2958,6 +2977,20 @@ void cmCTest::Log(int logType, const char* file, int line, const char* msg, } } +std::string cmCTest::GetColorCode(Color color) const +{ + if (this->OutputColorCode) { +#if defined(_WIN32) + // Not supported on Windows + static_cast<void>(color); +#else + return "\033[0;" + std::to_string(static_cast<int>(color)) + "m"; +#endif + } + + return ""; +} + cmDuration cmCTest::GetRemainingTimeAllowed() { if (!this->GetHandler("script")) { diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 1ee002a..427049d 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -405,6 +405,19 @@ public: void Log(int logType, const char* file, int line, const char* msg, bool suppress = false); + /** Color values */ + enum class Color + { + CLEAR_COLOR = 0, + RED = 31, + GREEN = 32, + YELLOW = 33, + BLUE = 34 + }; + + /** Get color code characters for a specific color */ + std::string GetColorCode(Color color) const; + /** Get the version of dart server */ int GetDartVersion() { return this->DartVersion; } int GetDropSiteCDash() { return this->DropSiteCDash; } @@ -575,8 +588,16 @@ private: bool HandleCommandLineArguments(size_t& i, std::vector<std::string>& args, std::string& errormsg); +#if !defined(_WIN32) /** returns true iff the console supports progress output */ - bool ProgressOutputSupportedByConsole() const; + static bool ConsoleIsNotDumb(); +#endif + + /** returns true iff the console supports progress output */ + static bool ProgressOutputSupportedByConsole(); + + /** returns true iff the console supports colored output */ + static bool ColoredOutputSupportedByConsole(); /** handle the -S -SP and -SR arguments */ void HandleScriptArguments(size_t& i, std::vector<std::string>& args, @@ -625,6 +646,7 @@ private: int OutputLogFileLastTag; bool OutputTestOutputOnTestFailure; + bool OutputColorCode; std::map<std::string, std::string> Definitions; }; diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 172ef92..3b4206f 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -495,6 +495,12 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList& newArgs, std::string&, argP1->GetValue().operator[](argP1len - 1) == '}') { std::string env = argP1->GetValue().substr(4, argP1len - 5); bdef = cmSystemTools::HasEnv(env); + } else if (argP1len > 6 && + argP1->GetValue().substr(0, 6) == "CACHE{" && + argP1->GetValue().operator[](argP1len - 1) == '}') { + std::string cache = argP1->GetValue().substr(6, argP1len - 7); + bdef = + this->Makefile.GetState()->GetCacheEntryValue(cache) != nullptr; } else { bdef = this->Makefile.IsDefinitionSet(argP1->GetValue()); } diff --git a/Source/cmVS141CLFlagTable.h b/Source/cmVS141CLFlagTable.h index 2a9944a..7d219be 100644 --- a/Source/cmVS141CLFlagTable.h +++ b/Source/cmVS141CLFlagTable.h @@ -194,6 +194,8 @@ static cmVS7FlagTable cmVS141CLFlagTable[] = { { "EnablePREfast", "analyze", "", "true", 0 }, { "UseFullPaths", "FC", "", "true", 0 }, { "OmitDefaultLibName", "Zl", "", "true", 0 }, + { "SupportJustMyCode", "JMC-", "", "false", 0 }, + { "SupportJustMyCode", "JMC", "", "true", 0 }, // Bool Properties With Argument { "MultiProcessorCompilation", "MP", "", "true", diff --git a/Tests/Unset/CMakeLists.txt b/Tests/Unset/CMakeLists.txt index 07aa68e..a40367b 100644 --- a/Tests/Unset/CMakeLists.txt +++ b/Tests/Unset/CMakeLists.txt @@ -21,17 +21,26 @@ set(x 43) if(NOT x EQUAL 43) message(FATAL_ERROR "x!=43") endif() +if(DEFINED CACHE{x}) + message(FATAL_ERROR "x shouldn't be found in the cache") +endif() + set(x) if(DEFINED x) message(FATAL_ERROR "x should be undefined now!") endif() + # Cache variable set(BAR "test" CACHE STRING "documentation") if(NOT DEFINED BAR) message(FATAL_ERROR "BAR not defined") endif() +if(NOT DEFINED CACHE{BAR}) + message(FATAL_ERROR "BAR could not be found by CACHE{BAR}") +endif() + # Test interaction of cache entries with variables. set(BAR "test-var") if(NOT "$CACHE{BAR}" STREQUAL "test") diff --git a/Utilities/Scripts/BoostScanDeps.cmake b/Utilities/Scripts/BoostScanDeps.cmake index bd2e6a8..28a94ce 100644 --- a/Utilities/Scripts/BoostScanDeps.cmake +++ b/Utilities/Scripts/BoostScanDeps.cmake @@ -51,12 +51,12 @@ function(_Boost_FIND_COMPONENT_DEPENDENCIES component includedir _ret_libs) # Special-case since it is part of mpi; look only in boost/mpi/python* if(component STREQUAL "mpi_python") - set(_boost_DEPS "python") + set(_boost_DEPS "python\${component_python_version}") set(library_component TRUE) set(_boost_unprocessed_headers ${_boost_mpi_python_headers}) # Special-case since it is part of python; look only in boost/python/numpy* elseif(component STREQUAL "numpy") - set(_boost_DEPS "python") + set(_boost_DEPS "python\${component_python_version}") set(library_component TRUE) set(_boost_unprocessed_headers ${_boost_python_numpy_headers}) # Special-case since it is a serialization variant; look in boost/serialization |