diff options
73 files changed, 440 insertions, 130 deletions
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst index 52c0ae8..8f6a4eb 100644 --- a/Help/command/try_compile.rst +++ b/Help/command/try_compile.rst @@ -18,7 +18,9 @@ Try Compiling Whole Projects SOURCE_DIR <srcdir> [BINARY_DIR <bindir>] [TARGET <targetName>] + [LOG_DESCRIPTION <text>] [NO_CACHE] + [NO_LOG] [CMAKE_FLAGS <flags>...] [OUTPUT_VARIABLE <var>]) @@ -47,7 +49,9 @@ which was present in older versions of CMake: try_compile(<resultVar> <bindir> <srcdir> <projectName> [<targetName>] + [LOG_DESCRIPTION <text>] [NO_CACHE] + [NO_LOG] [CMAKE_FLAGS <flags>...] [OUTPUT_VARIABLE <var>]) @@ -63,7 +67,9 @@ Try Compiling Source Files SOURCE_FROM_CONTENT <name> <content> | SOURCE_FROM_VAR <name> <var> | SOURCE_FROM_FILE <name> <path> >... + [LOG_DESCRIPTION <text>] [NO_CACHE] + [NO_LOG] [CMAKE_FLAGS <flags>...] [COMPILE_DEFINITIONS <defs>...] [LINK_OPTIONS <options>...] @@ -115,7 +121,9 @@ which was present in older versions of CMake: .. code-block:: cmake try_compile(<resultVar> <bindir> <srcfile|SOURCES srcfile...> + [LOG_DESCRIPTION <text>] [NO_CACHE] + [NO_LOG] [CMAKE_FLAGS <flags>...] [COMPILE_DEFINITIONS <defs>...] [LINK_OPTIONS <options>...] @@ -171,6 +179,12 @@ The options are: set the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property in the generated project, depending on the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable. +``LOG_DESCRIPTION <text>`` + .. versionadded:: 3.26 + + Specify a non-empty text description of the purpose of the check. + This is recorded in the :manual:`cmake-configure-log(7)` entry. + ``NO_CACHE`` .. versionadded:: 3.25 @@ -191,6 +205,11 @@ The options are: the test is part of a larger inspection), ``NO_CACHE`` may be useful to avoid leaking the intermediate result variable into the cache. +``NO_LOG`` + .. versionadded:: 3.26 + + Do not record a :manual:`cmake-configure-log(7)` entry for this call. + ``OUTPUT_VARIABLE <var>`` Store the output from the build process in the given variable. diff --git a/Help/command/try_run.rst b/Help/command/try_run.rst index cd41a4b..ef8ec96 100644 --- a/Help/command/try_run.rst +++ b/Help/command/try_run.rst @@ -17,7 +17,9 @@ Try Compiling and Running Source Files SOURCE_FROM_CONTENT <name> <content> | SOURCE_FROM_VAR <name> <var> | SOURCE_FROM_FILE <name> <path> >... + [LOG_DESCRIPTION <text>] [NO_CACHE] + [NO_LOG] [CMAKE_FLAGS <flags>...] [COMPILE_DEFINITIONS <defs>...] [LINK_OPTIONS <options>...] @@ -55,7 +57,9 @@ which was present in older versions of CMake: try_run(<runResultVar> <compileResultVar> <bindir> <srcfile|SOURCES srcfile...> + [LOG_DESCRIPTION <text>] [NO_CACHE] + [NO_LOG] [CMAKE_FLAGS <flags>...] [COMPILE_DEFINITIONS <defs>...] [LINK_OPTIONS <options>...] diff --git a/Help/envvar/CTEST_NO_TESTS_ACTION.rst b/Help/envvar/CTEST_NO_TESTS_ACTION.rst new file mode 100644 index 0000000..2bc86dc --- /dev/null +++ b/Help/envvar/CTEST_NO_TESTS_ACTION.rst @@ -0,0 +1,14 @@ +CTEST_NO_TESTS_ACTION +--------------------- + +.. versionadded:: 3.26 + +.. include:: ENV_VAR.txt + +Environment variable that controls how :manual:`ctest <ctest(1)>` handles +cases when there are no tests to run. Possible values are: ``error``, +``ignore``, empty or unset. + +The :option:`--no-tests=\<action\> <ctest --no-tests>` option to +:manual:`ctest <ctest(1)>` overrides this environment variable if both +are given. diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index 9e467bf..b9d621b 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -1049,7 +1049,7 @@ them to a header set using the :command:`target_sources` command: add_library(Eigen INTERFACE) - target_sources(Eigen INTERFACE + target_sources(Eigen PUBLIC FILE_SET HEADERS BASE_DIRS src FILES src/eigen.h src/vector.h src/matrix.h diff --git a/Help/manual/cmake-configure-log.7.rst b/Help/manual/cmake-configure-log.7.rst index f909717..2620124 100644 --- a/Help/manual/cmake-configure-log.7.rst +++ b/Help/manual/cmake-configure-log.7.rst @@ -106,6 +106,8 @@ Every event kind is represented by a YAML mapping of the form: kind: "<kind>-v<major>" backtrace: - "<file>:<line> (<function>)" + checks: + - "Checking for something" #...event-specific keys... The keys common to all events are: @@ -115,8 +117,16 @@ The keys common to all events are: ``backtrace`` A YAML block sequence reporting the call stack of CMake source - locations at which the event occurred. Each node is a string - specifying one location formatted as ``<file>:<line> (<function>)``. + locations at which the event occurred, from most-recent to + least-recent. Each node is a string specifying one location + formatted as ``<file>:<line> (<function>)``. + +``checks`` + An optional key that is present when the event occurred with + at least one pending :command:`message(CHECK_START)`. Its value + is a YAML block sequence reporting the stack of pending checks, + from most-recent to least-recent. Each node is a string containing + a pending check message. Additional mapping keys are specific to each (versioned) event kind, described below. @@ -140,6 +150,9 @@ A ``try_compile-v1`` event is a YAML mapping: kind: "try_compile-v1" backtrace: - "CMakeLists.txt:123 (try_compile)" + checks: + - "Checking for something" + description: "Explicit LOG_DESCRIPTION" directories: source: "/path/to/.../TryCompile-01234" binary: "/path/to/.../TryCompile-01234" @@ -152,6 +165,10 @@ A ``try_compile-v1`` event is a YAML mapping: The keys specific to ``try_compile-v1`` mappings are: +``description`` + An optional key that is present when the ``LOG_DESCRIPTION <text>`` option + was used. Its value is a string containing the description ``<text>``. + ``directories`` A mapping describing the directories associated with the compilation attempt. It has the following keys: @@ -206,6 +223,9 @@ A ``try_run-v1`` event is a YAML mapping: kind: "try_run-v1" backtrace: - "CMakeLists.txt:456 (try_run)" + checks: + - "Checking for something" + description: "Explicit LOG_DESCRIPTION" directories: source: "/path/to/.../TryCompile-56789" binary: "/path/to/.../TryCompile-56789" diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst index 50fcf75..4c29b80 100644 --- a/Help/manual/cmake-env-variables.7.rst +++ b/Help/manual/cmake-env-variables.7.rst @@ -92,6 +92,7 @@ Environment Variables for CTest /envvar/CMAKE_CONFIG_TYPE /envvar/CTEST_INTERACTIVE_DEBUG_MODE + /envvar/CTEST_NO_TESTS_ACTION /envvar/CTEST_OUTPUT_ON_FAILURE /envvar/CTEST_PARALLEL_LEVEL /envvar/CTEST_PROGRESS_OUTPUT diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 30a9eae..5e82faa 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -435,6 +435,11 @@ Run Tests unifies the behavior of CTest by either returning an error code if no tests were found or by ignoring it. + .. versionadded:: 3.26 + + This option can also be set by setting the :envvar:`CTEST_NO_TESTS_ACTION` + environment variable. + View Help ========= diff --git a/Help/release/dev/configure-log.rst b/Help/release/dev/configure-log.rst index 34b8fb3..f802a8c 100644 --- a/Help/release/dev/configure-log.rst +++ b/Help/release/dev/configure-log.rst @@ -6,3 +6,11 @@ Configure Log * The :manual:`cmake-file-api(7)` gained a new "configureLog" object kind that enables stable access to the :manual:`cmake-configure-log(7)`. + +* The :command:`try_compile` and :command:`try_run` commands gained + a ``LOG_DESCRIPTION`` option specifying text to be recorded in the + :manual:`cmake-configure-log(7)`. + +* The :command:`try_compile` and :command:`try_run` commands gained a + ``NO_LOG`` option to skip recording a :manual:`cmake-configure-log(7)` + entry. diff --git a/Help/release/dev/ctest-no-tests-action-env-var.rst b/Help/release/dev/ctest-no-tests-action-env-var.rst new file mode 100644 index 0000000..8679977 --- /dev/null +++ b/Help/release/dev/ctest-no-tests-action-env-var.rst @@ -0,0 +1,7 @@ +ctest-no-tests-action-env-var +----------------------------- + +* The :envvar:`CTEST_NO_TESTS_ACTION` environment variable was added to + provide a default value for the + :option:`--no-tests=\<action\> <ctest --no-tests>` command line + argument of :manual:`ctest(1)`. diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 19eba95..3159ff7 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -615,7 +615,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") set(wxWidgets_INCLUDE_DIRS ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}) else() - DBG_MSG("wxWidgets_FOUND FALSE because ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h does not exists.") + DBG_MSG("wxWidgets_FOUND FALSE because ${WX_LIB_DIR}/${wxWidgets_CONFIGURATION}/wx/setup.h does not exist.") set(wxWidgets_FOUND FALSE) endif() diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake index 7c10280..8ac1f6b 100644 --- a/Modules/Internal/CPack/CPackRPM.cmake +++ b/Modules/Internal/CPack/CPackRPM.cmake @@ -1200,7 +1200,7 @@ function(cpack_rpm_generate_package) file(READ ${CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE} "CPACK_RPM_SPEC_${RPM_SCRIPT_FILE_TIME_}${RPM_SCRIPT_FILE_TYPE_}") else() - message("CPackRPM:Warning: CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_SCRIPT_FILE <${CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE}> does not exists - ignoring") + message("CPackRPM:Warning: CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_SCRIPT_FILE <${CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE}> does not exist - ignoring") endif() else() # reset SPEC var value if no file has been specified @@ -1217,7 +1217,7 @@ function(cpack_rpm_generate_package) if(EXISTS ${CPACK_RPM_CHANGELOG_FILE}) file(READ ${CPACK_RPM_CHANGELOG_FILE} CPACK_RPM_SPEC_CHANGELOG) else() - message(SEND_ERROR "CPackRPM:Warning: CPACK_RPM_CHANGELOG_FILE <${CPACK_RPM_CHANGELOG_FILE}> does not exists - ignoring") + message(SEND_ERROR "CPackRPM:Warning: CPACK_RPM_CHANGELOG_FILE <${CPACK_RPM_CHANGELOG_FILE}> does not exist - ignoring") endif() else() set(CPACK_RPM_SPEC_CHANGELOG "* Sun Jul 4 2010 Eric Noulard <eric.noulard@gmail.com> - ${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}\n Generated by CPack RPM (no Changelog file were provided)") diff --git a/Modules/SystemInformation.cmake b/Modules/SystemInformation.cmake index 5ecc39a..fbc32a8 100644 --- a/Modules/SystemInformation.cmake +++ b/Modules/SystemInformation.cmake @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION ${CMAKE_VERSION}) project(DumpInformation) -# first get the standard information for th platform -include_directories("This does not exists") +# first get the standard information for the platform +include_directories("This does not exist") get_directory_property(incl INCLUDE_DIRECTORIES) set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${DumpInformation_BINARY_DIR};${DumpInformation_SOURCE_DIR}") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e035983..5a7e54b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 25) -set(CMake_VERSION_PATCH 20230116) +set(CMake_VERSION_PATCH 20230118) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 9dd8fe3..bc14eb4 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -585,7 +585,7 @@ std::string cmCPackIFWGenerator::GetRootPackageName() // Configure from root group cmCPackIFWPackage package; package.Generator = this; - package.ConfigureFromGroup(optIFW_PACKAGE_GROUP); + package.ConfigureFromGroup(*optIFW_PACKAGE_GROUP); name = package.Name; } else if (cmValue optIFW_PACKAGE_NAME = this->GetOption("CPACK_IFW_PACKAGE_NAME")) { diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 2feca75..69440d9 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -77,19 +77,20 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // ApplicationIcon if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_ICON")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->InstallerApplicationIcon = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_ICON", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_ICON", *option); } } // WindowIcon if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_WINDOW_ICON")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->InstallerWindowIcon = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WINDOW_ICON", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WINDOW_ICON", + *option); } } @@ -104,37 +105,37 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // Logo if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_LOGO")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->Logo = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_LOGO", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_LOGO", *option); } } // Watermark if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_WATERMARK")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->Watermark = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WATERMARK", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_WATERMARK", *option); } } // Banner if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_BANNER")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->Banner = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BANNER", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BANNER", *option); } } // Background if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_BACKGROUND")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->Background = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BACKGROUND", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_BACKGROUND", *option); } } @@ -155,10 +156,11 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // StyleSheet if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_STYLE_SHEET")) { - if (cmSystemTools::FileExists(option)) { + if (cmSystemTools::FileExists(*option)) { this->StyleSheet = *option; } else { - this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_STYLE_SHEET", option); + this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_STYLE_SHEET", + *option); } } @@ -276,9 +278,9 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // Control script if (cmValue optIFW_CONTROL_SCRIPT = this->GetOption("CPACK_IFW_PACKAGE_CONTROL_SCRIPT")) { - if (!cmSystemTools::FileExists(optIFW_CONTROL_SCRIPT)) { + if (!cmSystemTools::FileExists(*optIFW_CONTROL_SCRIPT)) { this->printSkippedOptionWarning("CPACK_IFW_PACKAGE_CONTROL_SCRIPT", - optIFW_CONTROL_SCRIPT); + *optIFW_CONTROL_SCRIPT); } else { this->ControlScript = *optIFW_CONTROL_SCRIPT; } @@ -653,9 +655,9 @@ void cmCPackIFWInstaller::GeneratePackageFiles() package.Installer = this; // Check package group if (cmValue option = this->GetOption("CPACK_IFW_PACKAGE_GROUP")) { - package.ConfigureFromGroup(option); + package.ConfigureFromGroup(*option); std::string forcedOption = "CPACK_IFW_COMPONENT_GROUP_" + - cmsys::SystemTools::UpperCase(option) + "_FORCED_INSTALLATION"; + cmsys::SystemTools::UpperCase(*option) + "_FORCED_INSTALLATION"; if (!this->GetOption(forcedOption)) { package.ForcedInstallation = "true"; } diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index c2109c9..1668fb5 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -382,7 +382,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) if (this->IsSetToEmpty(option)) { this->DisplayName.clear(); } else if (cmValue value = this->GetOption(option)) { - cmCPackIFWPackage::ExpandListArgument(value, this->DisplayName); + cmCPackIFWPackage::ExpandListArgument(*value, this->DisplayName); } // Description @@ -390,7 +390,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) if (this->IsSetToEmpty(option)) { this->Description.clear(); } else if (cmValue value = this->GetOption(option)) { - cmCPackIFWPackage::ExpandListArgument(value, this->Description); + cmCPackIFWPackage::ExpandListArgument(*value, this->Description); } // Release date @@ -484,7 +484,7 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) if (this->IsSetToEmpty(option)) { this->Default.clear(); } else if (cmValue value = this->GetOption(option)) { - std::string lowerValue = cmsys::SystemTools::LowerCase(value); + std::string lowerValue = cmsys::SystemTools::LowerCase(*value); if (lowerValue == "true") { this->Default = "true"; } else if (lowerValue == "false") { diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 5dae966..aeb3db3 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -422,9 +422,9 @@ void cmCPackWIXGenerator::CopyDefinition(cmWIXSourceWriter& source, cmValue value = GetOption(name); if (value) { if (type == DefinitionType::PATH) { - AddDefinition(source, name, CMakeToWixPath(value)); + AddDefinition(source, name, CMakeToWixPath(*value)); } else { - AddDefinition(source, name, value); + AddDefinition(source, name, *value); } } } @@ -504,7 +504,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() } featureDefinitions.AddAttribute("Title", featureTitle); if (cmValue desc = GetOption("CPACK_WIX_ROOT_FEATURE_DESCRIPTION")) { - featureDefinitions.AddAttribute("Description", desc); + featureDefinitions.AddAttribute("Description", *desc); } featureDefinitions.AddAttribute("Level", "1"); this->Patch->ApplyFragment("#PRODUCTFEATURE", featureDefinitions); @@ -512,7 +512,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() cmValue package = GetOption("CPACK_WIX_CMAKE_PACKAGE_REGISTRY"); if (package) { featureDefinitions.CreateCMakePackageRegistryEntry( - package, GetOption("CPACK_WIX_UPGRADE_GUID")); + *package, GetOption("CPACK_WIX_UPGRADE_GUID")); } if (!CreateFeatureHierarchy(featureDefinitions)) { diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 894c24b..c9c069c 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -80,10 +80,10 @@ std::string cmCPackArchiveGenerator::GetArchiveComponentFileName( *this->GetOption("CPACK_ARCHIVE_" + componentUpper + "_FILE_NAME"); } else if (this->IsSet("CPACK_ARCHIVE_FILE_NAME")) { packageFileName += this->GetComponentPackageFileName( - this->GetOption("CPACK_ARCHIVE_FILE_NAME"), component, isGroupName); + *this->GetOption("CPACK_ARCHIVE_FILE_NAME"), component, isGroupName); } else { packageFileName += this->GetComponentPackageFileName( - this->GetOption("CPACK_PACKAGE_FILE_NAME"), component, isGroupName); + *this->GetOption("CPACK_PACKAGE_FILE_NAME"), component, isGroupName); } packageFileName += this->GetOutputExtension(); @@ -357,9 +357,9 @@ int cmCPackArchiveGenerator::GetThreadCount() const // CPACK_ARCHIVE_THREADS overrides CPACK_THREADS if (this->IsSet("CPACK_ARCHIVE_THREADS")) { - threads = std::stoi(this->GetOption("CPACK_ARCHIVE_THREADS")); + threads = std::stoi(*this->GetOption("CPACK_ARCHIVE_THREADS")); } else if (this->IsSet("CPACK_THREADS")) { - threads = std::stoi(this->GetOption("CPACK_THREADS")); + threads = std::stoi(*this->GetOption("CPACK_THREADS")); } return threads; diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index a3b9434..6ba28d1 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -124,8 +124,8 @@ DebGenerator::DebGenerator( << debianCompressionType << std::endl); } - if (numThreads != nullptr) { - if (!cmStrToLong(numThreads, &this->NumThreads)) { + if (numThreads) { + if (!cmStrToLong(*numThreads, &this->NumThreads)) { this->NumThreads = 1; cmCPackLogger(cmCPackLog::LOG_ERROR, "Unrecognized number of threads: " << numThreads @@ -703,7 +703,7 @@ bool cmCPackDebGenerator::createDebPackages() &cmCPackDebGenerator::createDeb); cmValue dbgsymdir_path = this->GetOption("GEN_DBGSYMDIR"); if (this->IsOn("GEN_CPACK_DEBIAN_DEBUGINFO_PACKAGE") && dbgsymdir_path) { - retval = make_package(dbgsymdir_path, "GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME", + retval = make_package(*dbgsymdir_path, "GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME", &cmCPackDebGenerator::createDbgsymDDeb) && retval; } diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx index edd8490..4c92592 100644 --- a/Source/CPack/cmCPackExternalGenerator.cxx +++ b/Source/CPack/cmCPackExternalGenerator.cxx @@ -63,7 +63,7 @@ int cmCPackExternalGenerator::PackageFiles() cmValue packageScript = this->GetOption("CPACK_EXTERNAL_PACKAGE_SCRIPT"); if (cmNonempty(packageScript)) { - if (!cmSystemTools::FileIsFullPath(packageScript)) { + if (!cmSystemTools::FileIsFullPath(*packageScript)) { cmCPackLogger( cmCPackLog::LOG_ERROR, "CPACK_EXTERNAL_PACKAGE_SCRIPT does not contain a full file path" @@ -71,7 +71,7 @@ int cmCPackExternalGenerator::PackageFiles() return 0; } - bool res = this->MakefileMap->ReadListFile(packageScript); + bool res = this->MakefileMap->ReadListFile(*packageScript); if (cmSystemTools::GetErrorOccurredFlag() || !res) { return 0; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 90d15f8..2ac5b3d 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -91,7 +91,7 @@ int cmCPackGenerator::PrepareNames() "CPACK_PACKAGE_FILE_NAME not specified" << std::endl); return 0; } - std::string outName = pfname; + std::string outName = *pfname; tempDirectory += "/" + outName; if (!this->GetOutputExtension()) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -106,7 +106,7 @@ int cmCPackGenerator::PrepareNames() return 0; } - std::string destFile = pdir; + std::string destFile = *pdir; this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PREFIX", destFile); destFile += "/" + outName; std::string outFile = topDirectory + "/" + outName; @@ -126,17 +126,17 @@ int cmCPackGenerator::PrepareNames() cmValue descFileName = this->GetOption("CPACK_PACKAGE_DESCRIPTION_FILE"); if (descFileName && !this->GetOption("CPACK_PACKAGE_DESCRIPTION")) { cmCPackLogger(cmCPackLog::LOG_DEBUG, - "Look for: " << descFileName << std::endl); - if (!cmSystemTools::FileExists(descFileName)) { + "Look for: " << *descFileName << std::endl); + if (!cmSystemTools::FileExists(*descFileName)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find description file name: [" - << descFileName << "]" << std::endl); + << *descFileName << "]" << std::endl); return 0; } cmsys::ifstream ifs(descFileName->c_str()); if (!ifs) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Cannot open description file name: " << descFileName + "Cannot open description file name: " << *descFileName << std::endl); return 0; } @@ -144,14 +144,14 @@ int cmCPackGenerator::PrepareNames() std::string line; cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Read description file: " << descFileName << std::endl); + "Read description file: " << *descFileName << std::endl); while (ifs && cmSystemTools::GetLineFromStream(ifs, line)) { ostr << cmXMLSafe(line) << std::endl; } this->SetOption("CPACK_PACKAGE_DESCRIPTION", ostr.str()); cmValue defFileName = this->GetOption("CPACK_DEFAULT_PACKAGE_DESCRIPTION_FILE"); - if (defFileName && (defFileName == descFileName)) { + if (defFileName && (*defFileName == *descFileName)) { this->SetOption("CPACK_USED_DEFAULT_PACKAGE_DESCRIPTION_FILE", "ON"); } } @@ -636,7 +636,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( std::unique_ptr<cmGlobalGenerator> globalGenerator = this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator( - cmakeGenerator); + *cmakeGenerator); if (!globalGenerator) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Specified package generator not found. " @@ -1050,14 +1050,14 @@ int cmCPackGenerator::DoPackage() if (cmIsOn(this->GetOption("CPACK_REMOVE_TOPLEVEL_DIRECTORY"))) { cmValue toplevelDirectory = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); - if (cmSystemTools::FileExists(toplevelDirectory)) { + if (toplevelDirectory && cmSystemTools::FileExists(*toplevelDirectory)) { cmCPackLogger(cmCPackLog::LOG_VERBOSE, - "Remove toplevel directory: " << toplevelDirectory + "Remove toplevel directory: " << *toplevelDirectory << std::endl); - if (!cmSystemTools::RepeatedRemoveDirectory(toplevelDirectory)) { + if (!cmSystemTools::RepeatedRemoveDirectory(*toplevelDirectory)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem removing toplevel directory: " - << toplevelDirectory << std::endl); + << *toplevelDirectory << std::endl); return 0; } } @@ -1091,10 +1091,10 @@ int cmCPackGenerator::DoPackage() "Package files to: " << (tempPackageFileName ? *tempPackageFileName : "(NULL)") << std::endl); - if (cmSystemTools::FileExists(tempPackageFileName)) { + if (tempPackageFileName && cmSystemTools::FileExists(*tempPackageFileName)) { cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Remove old package file" << std::endl); - cmSystemTools::RemoveFile(tempPackageFileName); + cmSystemTools::RemoveFile(*tempPackageFileName); } if (cmIsOn(this->GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY"))) { tempDirectory = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); @@ -1211,7 +1211,7 @@ int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf) // Load the project specific config file cmValue config = this->GetOption("CPACK_PROJECT_CONFIG_FILE"); if (config) { - mf->ReadListFile(config); + mf->ReadListFile(*config); } int result = this->InitializeInternal(); if (cmSystemTools::GetErrorOccurredFlag()) { @@ -1581,7 +1581,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent( cmValue groupName = this->GetOption(macroPrefix + "_GROUP"); if (cmNonempty(groupName)) { - component->Group = this->GetComponentGroup(projectName, groupName); + component->Group = this->GetComponentGroup(projectName, *groupName); component->Group->Components.push_back(component); } else { component->Group = nullptr; @@ -1644,7 +1644,7 @@ cmCPackComponentGroup* cmCPackGenerator::GetComponentGroup( cmValue parentGroupName = this->GetOption(macroPrefix + "_PARENT_GROUP"); if (cmNonempty(parentGroupName)) { group->ParentGroup = - this->GetComponentGroup(projectName, parentGroupName); + this->GetComponentGroup(projectName, *parentGroupName); group->ParentGroup->Subgroups.push_back(group); } else { group->ParentGroup = nullptr; diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 6ca5783..d7119c5 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -473,7 +473,7 @@ int cmCPackNSISGenerator::InitializeInternal() this->SetOptionIfNotSet("CPACK_NSIS_EXECUTABLE", "makensis"); nsisPath = cmSystemTools::FindProgram( - this->GetOption("CPACK_NSIS_EXECUTABLE"), path, false); + *this->GetOption("CPACK_NSIS_EXECUTABLE"), path, false); if (nsisPath.empty()) { cmCPackLogger( diff --git a/Source/CPack/cmCPackPKGGenerator.cxx b/Source/CPack/cmCPackPKGGenerator.cxx index 7b9f6cf..76ef091 100644 --- a/Source/CPack/cmCPackPKGGenerator.cxx +++ b/Source/CPack/cmCPackPKGGenerator.cxx @@ -58,16 +58,17 @@ void cmCPackPKGGenerator::CreateBackground(const char* themeName, ? cmStrCat("CPACK_", genName, "_BACKGROUND") : cmStrCat("CPACK_", genName, "_BACKGROUND_", paramSuffix); cmValue bgFileName = this->GetOption(opt); - if (bgFileName == nullptr) { + if (!bgFileName) { return; } - std::string bgFilePath = cmStrCat(metapackageFile, "/Contents/", bgFileName); + std::string bgFilePath = + cmStrCat(metapackageFile, "/Contents/", *bgFileName); if (!cmSystemTools::FileExists(bgFilePath)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Background image doesn't exist in the resource directory: " - << bgFileName << std::endl); + << *bgFileName << std::endl); return; } @@ -77,16 +78,16 @@ void cmCPackPKGGenerator::CreateBackground(const char* themeName, xout.StartElement(cmStrCat("background-", themeName)); } - xout.Attribute("file", bgFileName); + xout.Attribute("file", *bgFileName); cmValue param = this->GetOption(cmStrCat(opt, "_ALIGNMENT")); if (param != nullptr) { - xout.Attribute("alignment", param); + xout.Attribute("alignment", *param); } param = this->GetOption(cmStrCat(opt, "_SCALING")); if (param != nullptr) { - xout.Attribute("scaling", param); + xout.Attribute("scaling", *param); } // Apple docs say that you must provide either mime-type or uti @@ -94,12 +95,12 @@ void cmCPackPKGGenerator::CreateBackground(const char* themeName, // doesn't have them, so don't make them mandatory. param = this->GetOption(cmStrCat(opt, "_MIME_TYPE")); if (param != nullptr) { - xout.Attribute("mime-type", param); + xout.Attribute("mime-type", *param); } param = this->GetOption(cmStrCat(opt, "_UTI")); if (param != nullptr) { - xout.Attribute("uti", param); + xout.Attribute("uti", *param); } xout.EndElement(); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index da085a6..2bc270e 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -718,7 +718,7 @@ int cmCTestSubmitHandler::ProcessHandler() cmValue cdashUploadFile = this->GetOption("CDashUploadFile"); cmValue cdashUploadType = this->GetOption("CDashUploadType"); if (cdashUploadFile && cdashUploadType) { - return this->HandleCDashUploadFile(cdashUploadFile, cdashUploadType); + return this->HandleCDashUploadFile(*cdashUploadFile, *cdashUploadType); } const std::string& buildDirectory = diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index daaf5fd..1c8c713 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -363,10 +363,10 @@ void cmCTestTestHandler::PopulateCustomVectors(cmMakefile* mf) cmValue dval = mf->GetDefinition("CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION"); if (dval) { - if (!this->SetTestOutputTruncation(dval)) { + if (!this->SetTestOutputTruncation(*dval)) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Invalid value for CTEST_CUSTOM_TEST_OUTPUT_TRUNCATION: " - << dval << std::endl); + << *dval << std::endl); } } } @@ -520,7 +520,7 @@ bool cmCTestTestHandler::ProcessOptions() if (cmValue repeat = this->GetOption("Repeat")) { cmsys::RegularExpression repeatRegex( "^(UNTIL_FAIL|UNTIL_PASS|AFTER_TIMEOUT):([0-9]+)$"); - if (repeatRegex.find(repeat)) { + if (repeatRegex.find(*repeat)) { std::string const& count = repeatRegex.match(2); unsigned long n = 1; cmStrToULong(count, &n); // regex guarantees success @@ -537,12 +537,13 @@ bool cmCTestTestHandler::ProcessOptions() } } else { cmCTestLog(this->CTest, ERROR_MESSAGE, - "Repeat option invalid value: " << repeat << std::endl); + "Repeat option invalid value: " << *repeat << std::endl); return false; } } if (this->GetOption("ParallelLevel")) { - this->CTest->SetParallelLevel(std::stoi(this->GetOption("ParallelLevel"))); + this->CTest->SetParallelLevel( + std::stoi(*this->GetOption("ParallelLevel"))); } if (this->GetOption("StopOnFailure")) { @@ -556,12 +557,12 @@ bool cmCTestTestHandler::ProcessOptions() cmValue val = this->GetOption("IncludeRegularExpression"); if (val) { this->UseIncludeRegExp(); - this->SetIncludeRegExp(val); + this->SetIncludeRegExp(*val); } val = this->GetOption("ExcludeRegularExpression"); if (val) { this->UseExcludeRegExp(); - this->SetExcludeRegExp(val); + this->SetExcludeRegExp(*val); } val = this->GetOption("ExcludeFixtureRegularExpression"); if (val) { @@ -2110,9 +2111,9 @@ void cmCTestTestHandler::SetTestsToRunInformation(cmValue in) this->TestsToRunString = *in; // if the argument is a file, then read it and use the contents as the // string - if (cmSystemTools::FileExists(in)) { + if (cmSystemTools::FileExists(*in)) { cmsys::ifstream fin(in->c_str()); - unsigned long filelen = cmSystemTools::FileLength(in); + unsigned long filelen = cmSystemTools::FileLength(*in); auto buff = cm::make_unique<char[]>(filelen + 1); fin.getline(buff.get(), filelen); buff[fin.gcount()] = 0; diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index d448c76..045eb84 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -123,7 +123,7 @@ int cmCTestUpdateHandler::ProcessHandler() } cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT, - " Updating the repository: " << sourceDirectory + " Updating the repository: " << *sourceDirectory << std::endl, this->Quiet); @@ -163,7 +163,7 @@ int cmCTestUpdateHandler::ProcessHandler() break; } vc->SetCommandLineTool(this->UpdateCommand); - vc->SetSourceDirectory(sourceDirectory); + vc->SetSourceDirectory(*sourceDirectory); // Cleanup the working tree. vc->Cleanup(); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index b00fa73..72cd8cd 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -217,6 +217,7 @@ struct cmCTest::Private std::map<std::string, std::string> Definitions; cmCTest::NoTests NoTestsMode = cmCTest::NoTests::Legacy; + bool NoTestsModeSetInCli = false; }; struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag) @@ -2132,6 +2133,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, } else { this->Impl->NoTestsMode = cmCTest::NoTests::Ignore; } + this->Impl->NoTestsModeSetInCli = true; } // options that control what tests are run @@ -2774,6 +2776,24 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output) } } + // handle CTEST_NO_TESTS_ACTION environment variable + if (!this->Impl->NoTestsModeSetInCli) { + std::string action; + if (cmSystemTools::GetEnv("CTEST_NO_TESTS_ACTION", action) && + !action.empty()) { + if (action == "error"_s) { + this->Impl->NoTestsMode = cmCTest::NoTests::Error; + } else if (action == "ignore"_s) { + this->Impl->NoTestsMode = cmCTest::NoTests::Ignore; + } else { + cmCTestLog(this, ERROR_MESSAGE, + "Unknown value for CTEST_NO_TESTS_ACTION: '" << action + << '\''); + return 1; + } + } + } + // TestProgressOutput only supported if console supports it and not logging // to a file this->Impl->TestProgressOutput = this->Impl->TestProgressOutput && diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 8cbdcaa..8e05fac 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -260,8 +260,8 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target, "LINK_LIBRARY_OVERRIDE", nullptr, nullptr }; auto overrideFeature = cmGeneratorExpression::Evaluate( - feature, this->Target->GetLocalGenerator(), config, this->Target, - &dag, this->Target, linkLanguage); + *feature, this->Target->GetLocalGenerator(), config, + this->Target, &dag, this->Target, linkLanguage); this->LinkLibraryOverride.emplace(item, overrideFeature); } } @@ -274,7 +274,7 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target, "LINK_LIBRARY_OVERRIDE", nullptr, nullptr }; auto overrideValue = cmGeneratorExpression::Evaluate( - linkLibraryOverride, target->GetLocalGenerator(), config, target, &dag, + *linkLibraryOverride, target->GetLocalGenerator(), config, target, &dag, target, linkLanguage); auto overrideList = cmTokenize(overrideValue, ","_s); diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 6cfdf62..cd0a1dc 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -366,7 +366,7 @@ cmComputeLinkInformation::cmComputeLinkInformation( this->LibraryFeatureDescriptors.emplace( "__CMAKE_LINK_EXECUTABLE", LibraryFeatureDescriptor{ "__CMAKE_LINK_EXECUTABLE", - cmStrCat(this->LoaderFlag, "<LIBRARY>") }); + cmStrCat(*this->LoaderFlag, "<LIBRARY>") }); } // To link framework using a full path this->LibraryFeatureDescriptors.emplace( @@ -858,8 +858,8 @@ bool cmComputeLinkInformation::AddLibraryFeature(std::string const& feature) return false; } - auto items = - cmExpandListWithBacktrace(langFeature, this->Target->GetBacktrace(), true); + auto items = cmExpandListWithBacktrace(*langFeature, + this->Target->GetBacktrace(), true); if ((items.size() == 1 && !IsValidFeatureFormat(items.front().Value)) || (items.size() == 3 && !IsValidFeatureFormat(items[1].Value))) { @@ -1016,8 +1016,8 @@ cmComputeLinkInformation::GetGroupFeature(std::string const& feature) .first->second; } - auto items = - cmExpandListWithBacktrace(langFeature, this->Target->GetBacktrace(), true); + auto items = cmExpandListWithBacktrace(*langFeature, + this->Target->GetBacktrace(), true); // replace LINKER: pattern this->Target->ResolveLinkerWrapper(items, this->LinkLanguage, true); diff --git a/Source/cmConfigureLog.cxx b/Source/cmConfigureLog.cxx index c2a5b5e..1b00b4f 100644 --- a/Source/cmConfigureLog.cxx +++ b/Source/cmConfigureLog.cxx @@ -17,6 +17,7 @@ #include "cmListFileCache.h" #include "cmMakefile.h" +#include "cmRange.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmake.h" @@ -78,6 +79,21 @@ void cmConfigureLog::WriteBacktrace(cmMakefile const& mf) this->WriteValue("backtrace"_s, backtrace); } +void cmConfigureLog::WriteChecks(cmMakefile const& mf) +{ + if (!mf.GetCMakeInstance()->HasCheckInProgress()) { + return; + } + this->BeginObject("checks"_s); + for (auto const& value : + cmReverseRange(mf.GetCMakeInstance()->GetCheckInProgressMessages())) { + this->BeginLine() << "- "; + this->Encoder->write(value, &this->Stream); + this->EndLine(); + } + this->EndObject(); +} + void cmConfigureLog::EnsureInit() { if (this->Opened) { diff --git a/Source/cmConfigureLog.h b/Source/cmConfigureLog.h index 9caac66..d672445 100644 --- a/Source/cmConfigureLog.h +++ b/Source/cmConfigureLog.h @@ -29,6 +29,7 @@ public: bool IsAnyLogVersionEnabled(std::vector<unsigned long> const& v) const; void WriteBacktrace(cmMakefile const& mf); + void WriteChecks(cmMakefile const& mf); void EnsureInit(); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 2a4ea80..2084b33 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -151,7 +151,9 @@ cmArgumentParser<Arguments> makeTryRunParser( auto const TryCompileBaseArgParser = cmArgumentParser<Arguments>{} .Bind(0, &Arguments::CompileResultVariable) + .Bind("LOG_DESCRIPTION"_s, &Arguments::LogDescription) .Bind("NO_CACHE"_s, &Arguments::NoCache) + .Bind("NO_LOG"_s, &Arguments::NoLog) .Bind("CMAKE_FLAGS"_s, &Arguments::CMakeFlags) .Bind("__CMAKE_INTERNAL"_s, &Arguments::CMakeInternal) /* keep semicolon on own line */; @@ -1099,23 +1101,35 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode( if ((res == 0) && arguments.CopyFileTo) { std::string const& copyFile = *arguments.CopyFileTo; - if (this->OutputFile.empty() || - !cmSystemTools::CopyFileAlways(this->OutputFile, copyFile)) { - std::ostringstream emsg; + cmsys::SystemTools::CopyStatus status = + cmSystemTools::CopyFileAlways(this->OutputFile, copyFile); + if (!status) { + std::string err = status.GetString(); + switch (status.Path) { + case cmsys::SystemTools::CopyStatus::SourcePath: + err = cmStrCat(err, " (input)"); + break; + case cmsys::SystemTools::CopyStatus::DestPath: + err = cmStrCat(err, " (output)"); + break; + default: + break; + } /* clang-format off */ - emsg << "Cannot copy output executable\n" - << " '" << this->OutputFile << "'\n" - << "to destination specified by COPY_FILE:\n" - << " '" << copyFile << "'\n"; + err = cmStrCat( + "Cannot copy output executable\n", + " '", this->OutputFile, "'\n", + "to destination specified by COPY_FILE:\n", + " '", copyFile, "'\n", + "because:\n", + " ", err, "\n", + this->FindErrorMessage); /* clang-format on */ - if (!this->FindErrorMessage.empty()) { - emsg << this->FindErrorMessage; - } if (!arguments.CopyFileError) { - this->Makefile->IssueMessage(MessageType::FATAL_ERROR, emsg.str()); + this->Makefile->IssueMessage(MessageType::FATAL_ERROR, err); return cm::nullopt; } - copyFileErrorMessage = emsg.str(); + copyFileErrorMessage = std::move(err); } } @@ -1126,6 +1140,9 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode( } cmTryCompileResult result; + if (arguments.LogDescription) { + result.LogDescription = *arguments.LogDescription; + } result.SourceDirectory = sourceDirectory; result.BinaryDirectory = this->BinaryDirectory; result.Variable = *arguments.CompileResultVariable; @@ -1278,6 +1295,9 @@ void cmCoreTryCompile::WriteTryCompileEventFields( cmConfigureLog& log, cmTryCompileResult const& compileResult) { #ifndef CMAKE_BOOTSTRAP + if (compileResult.LogDescription) { + log.WriteValue("description"_s, *compileResult.LogDescription); + } log.BeginObject("directories"_s); log.WriteValue("source"_s, compileResult.SourceDirectory); log.WriteValue("binary"_s, compileResult.BinaryDirectory); diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h index 6d29586..1ec4405 100644 --- a/Source/cmCoreTryCompile.h +++ b/Source/cmCoreTryCompile.h @@ -21,6 +21,8 @@ class cmRange; struct cmTryCompileResult { + cm::optional<std::string> LogDescription; + std::string SourceDirectory; std::string BinaryDirectory; @@ -71,7 +73,9 @@ public: cm::optional<std::string> OutputVariable; cm::optional<std::string> CopyFileTo; cm::optional<std::string> CopyFileError; + cm::optional<ArgumentParser::NonEmpty<std::string>> LogDescription; bool NoCache = false; + bool NoLog = false; // Argument for try_run only. // Keep in sync with warnings in cmCoreTryCompile::ParseArgs. diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index b8d345f..4df81d5 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -344,7 +344,7 @@ struct entry_to_remove { if (cmValue to_skip = makefile->GetDefinition( cmStrCat("_CMAKE_SYSTEM_PREFIX_PATH_", name, "_PREFIX_COUNT"))) { - cmStrToLong(to_skip, &count); + cmStrToLong(*to_skip, &count); } if (cmValue prefix_value = makefile->GetDefinition( cmStrCat("_CMAKE_SYSTEM_PREFIX_PATH_", name, "_PREFIX_VALUE"))) { diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 71c7e13..c1b82ab 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -2204,7 +2204,7 @@ void cmFindPackageCommand::FillPrefixesCMakeSystemVariable() std::string install_path_to_remove; if (cmValue to_skip = this->Makefile->GetDefinition( "_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_COUNT")) { - cmStrToLong(to_skip, &install_prefix_count); + cmStrToLong(*to_skip, &install_prefix_count); } if (cmValue install_value = this->Makefile->GetDefinition( "_CMAKE_SYSTEM_PREFIX_PATH_INSTALL_PREFIX_VALUE")) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index d0d339d..430e4a0 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3572,7 +3572,7 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink, if (ipoEnabled && compileOrLink == cmBuildStep::Link) { if (cmValue cudaIPOFlags = this->Makefile->GetDefinition("CMAKE_CUDA_LINK_OPTIONS_IPO")) { - flags += cudaIPOFlags; + flags += *cudaIPOFlags; } } @@ -5987,7 +5987,7 @@ std::string valueAsString<std::string>(std::string value) template <> std::string valueAsString<cmValue>(cmValue value) { - return value ? value : std::string("(unset)"); + return value ? *value : std::string("(unset)"); } template <> std::string valueAsString<std::nullptr_t>(std::nullptr_t /*unused*/) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 8ca6ee6..40234b1 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -947,7 +947,7 @@ void cmGlobalGenerator::PrintCompilerAdvice(std::ostream& os, // Subclasses override this method if they do not support this advice. os << "Tell CMake where to find the compiler by setting "; if (envVar) { - os << "either the environment variable \"" << envVar << "\" or "; + os << "either the environment variable \"" << *envVar << "\" or "; } os << "the CMake cache entry CMAKE_" << lang << "_COMPILER " diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 18c48d7..3da15f6 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -100,10 +100,10 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts, cmValue prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM"); /* check if the toolset changed from last generate */ - if (cmNonempty(prevTool) && !cmSystemTools::ComparePath(gbuild, prevTool)) { + if (cmNonempty(prevTool) && !cmSystemTools::ComparePath(gbuild, *prevTool)) { std::string const& e = cmStrCat("toolset build tool: ", gbuild, - "\nDoes not match the previously used build tool: ", prevTool, + "\nDoes not match the previously used build tool: ", *prevTool, "\nEither remove the CMakeCache.txt file and CMakeFiles " "directory or choose a different binary directory."); mf->IssueMessage(MessageType::FATAL_ERROR, e); @@ -354,7 +354,7 @@ void cmGlobalGhsMultiGenerator::WriteProjectLine( * unsupported target type and should be skipped. */ if (projFile && projType) { - std::string path = cmSystemTools::RelativePath(rootBinaryDir, projFile); + std::string path = cmSystemTools::RelativePath(rootBinaryDir, *projFile); fout << path; fout << ' ' << *projType << '\n'; diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 06fd61c..de13924 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -168,7 +168,7 @@ void cmGlobalVisualStudio71Generator::WriteExternalProject( cmValue typeGuid, const std::set<BT<std::pair<std::string, bool>>>& depends) { fout << "Project(\"{" - << (typeGuid ? typeGuid + << (typeGuid ? *typeGuid : std::string( cmGlobalVisualStudio71Generator::ExternalProjectType( location))) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index cedb367..9a49af1 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -430,7 +430,7 @@ void cmLocalGenerator::GenerateInstallRules() // Compute the install prefix. cmValue installPrefix = this->Makefile->GetDefinition("CMAKE_INSTALL_PREFIX"); - std::string prefix = installPrefix; + std::string prefix = *installPrefix; #if defined(_WIN32) && !defined(__CYGWIN__) if (!installPrefix) { @@ -869,7 +869,7 @@ std::string cmLocalGenerator::GetIncludeFlags( cmStrCat("CMAKE_INCLUDE_FLAG_SEP_", lang))) { // if there is a separator then the flag is not repeated but is only // given once i.e. -classpath a:b:c - sep = incSep; + sep = *incSep; repeatFlag = false; } @@ -1397,7 +1397,7 @@ void cmLocalGenerator::GetDeviceLinkFlags( if (ipoEnabled) { if (cmValue cudaIPOFlags = this->Makefile->GetDefinition( "CMAKE_CUDA_DEVICE_LINK_OPTIONS_IPO")) { - linkFlags += cudaIPOFlags; + linkFlags += *cudaIPOFlags; } } @@ -1848,7 +1848,7 @@ bool cmLocalGenerator::AllAppleArchSysrootsAreTheSame( [this, sysroot](std::string const& arch) -> bool { std::string const& archSysroot = this->AppleArchSysroots[arch]; - return cmIsOff(archSysroot) || sysroot == archSysroot; + return cmIsOff(archSysroot) || *sysroot == archSysroot; }); } diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index e7a1f93..759ee7b 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -147,7 +147,7 @@ void cmLocalXCodeGenerator::AddXCConfigSources(cmGeneratorTarget* target) for (auto& config : configs) { auto file = cmGeneratorExpression::Evaluate( - xcconfig, + *xcconfig, this, config); if (!file.empty()) { target->AddSource(file); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index db8f785..d26f383 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -983,7 +983,8 @@ void cmMakefile::Generate(cmLocalGenerator& lg) this->DoGenerate(lg); cmValue oldValue = this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY"); if (oldValue && - cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, oldValue, "2.4")) { + cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, *oldValue, + "2.4")) { this->GetCMakeInstance()->IssueMessage( MessageType::FATAL_ERROR, "You have set CMAKE_BACKWARDS_COMPATIBILITY to a CMake version less " diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index 44f37cb..d5f6f0d 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -179,7 +179,7 @@ void cmSearchPath::AddPrefixPaths(const std::vector<std::string>& paths, cmValue arch = this->FC->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE"); if (cmNonempty(arch)) { - std::string archNoUnknown = arch; + std::string archNoUnknown = *arch; auto unknownAtPos = archNoUnknown.find("-unknown-"); bool foundUnknown = unknownAtPos != std::string::npos; if (foundUnknown) { diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx index c70c03e..789ffe9 100644 --- a/Source/cmTryCompileCommand.cxx +++ b/Source/cmTryCompileCommand.cxx @@ -27,6 +27,7 @@ void WriteTryCompileEvent(cmConfigureLog& log, cmMakefile const& mf, if (log.IsAnyLogVersionEnabled(LogVersionsWithTryCompileV1)) { log.BeginEvent("try_compile-v1"); log.WriteBacktrace(mf); + log.WriteChecks(mf); cmCoreTryCompile::WriteTryCompileEventFields(log, compileResult); log.EndEvent(); } @@ -81,14 +82,15 @@ bool cmTryCompileCommand(std::vector<std::string> const& args, return true; } - if (cm::optional<cmTryCompileResult> compileResult = - tc.TryCompileCode(arguments, targetType)) { + cm::optional<cmTryCompileResult> compileResult = + tc.TryCompileCode(arguments, targetType); #ifndef CMAKE_BOOTSTRAP + if (compileResult && !arguments.NoLog) { if (cmConfigureLog* log = mf.GetCMakeInstance()->GetConfigureLog()) { WriteTryCompileEvent(*log, mf, *compileResult); } -#endif } +#endif // if They specified clean then we clean up what we can if (tc.SrcFileSignature) { diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index ef59c32..21bd95a 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -46,6 +46,7 @@ void WriteTryRunEvent(cmConfigureLog& log, cmMakefile const& mf, if (log.IsAnyLogVersionEnabled(LogVersionsWithTryRunV1)) { log.BeginEvent("try_run-v1"); log.WriteBacktrace(mf); + log.WriteChecks(mf); cmCoreTryCompile::WriteTryCompileEventFields(log, compileResult); log.BeginObject("runResult"_s); @@ -246,7 +247,7 @@ bool TryRunCommandImpl::TryRunCode(std::vector<std::string> const& argv) } #ifndef CMAKE_BOOTSTRAP - if (compileResult) { + if (compileResult && !arguments.NoLog) { cmMakefile const& mf = *(this->Makefile); if (cmConfigureLog* log = mf.GetCMakeInstance()->GetConfigureLog()) { WriteTryRunEvent(*log, mf, *compileResult, runResult); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9734414..ce9a842 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -550,7 +550,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( e1.Element("Platform", this->Platform); cmValue projLabel = this->GeneratorTarget->GetProperty("PROJECT_LABEL"); - e1.Element("ProjectName", projLabel ? projLabel : this->Name); + e1.Element("ProjectName", projLabel ? *projLabel : this->Name); { cm::optional<std::string> targetFramework; cm::optional<std::string> targetFrameworkVersion; diff --git a/Source/cmake.h b/Source/cmake.h index 10db87d..d1f388a 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -9,7 +9,6 @@ #include <map> #include <memory> #include <set> -#include <stack> #include <string> #include <unordered_set> #include <utility> @@ -472,13 +471,17 @@ public: } std::string GetTopCheckInProgressMessage() { - auto message = this->CheckInProgressMessages.top(); - this->CheckInProgressMessages.pop(); + auto message = this->CheckInProgressMessages.back(); + this->CheckInProgressMessages.pop_back(); return message; } void PushCheckInProgressMessage(std::string message) { - this->CheckInProgressMessages.emplace(std::move(message)); + this->CheckInProgressMessages.emplace_back(std::move(message)); + } + std::vector<std::string> const& GetCheckInProgressMessages() const + { + return this->CheckInProgressMessages; } //! Should `message` command display context. @@ -773,7 +776,7 @@ private: bool LogLevelWasSetViaCLI = false; bool LogContext = false; - std::stack<std::string> CheckInProgressMessages; + std::vector<std::string> CheckInProgressMessages; std::unique_ptr<cmGlobalGenerator> GlobalGenerator; diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 8c35fe5..bda260a 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -389,6 +389,14 @@ function(run_NoTests) run_cmake_command(no-tests_error ${CMAKE_CTEST_COMMAND} --no-tests=error) run_cmake_command(no-tests_bad ${CMAKE_CTEST_COMMAND} --no-tests=bad) run_cmake_command(no-tests_legacy ${CMAKE_CTEST_COMMAND}) + + run_cmake_command(no-tests_env_ignore ${CMAKE_COMMAND} -E env CTEST_NO_TESTS_ACTION=ignore ${CMAKE_CTEST_COMMAND}) + run_cmake_command(no-tests_env_error ${CMAKE_COMMAND} -E env CTEST_NO_TESTS_ACTION=error ${CMAKE_CTEST_COMMAND}) + run_cmake_command(no-tests_env_bad ${CMAKE_COMMAND} -E env CTEST_NO_TESTS_ACTION=bad ${CMAKE_CTEST_COMMAND}) + run_cmake_command(no-tests_env_empty_legacy ${CMAKE_COMMAND} -E env CTEST_NO_TESTS_ACTION= ${CMAKE_CTEST_COMMAND}) + + run_cmake_command(no-tests_env_bad_with_cli_error ${CMAKE_COMMAND} -E env CTEST_NO_TESTS_ACTION=bad ${CMAKE_CTEST_COMMAND} --no-tests=error) + file(WRITE "${RunCMake_TEST_BINARY_DIR}/NoTestsScript.cmake" " set(CTEST_COMMAND \"${CMAKE_CTEST_COMMAND}\") set(CTEST_SOURCE_DIRECTORY \"${RunCMake_SOURCE_DIR}\") diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_env_bad-result.txt b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_env_bad-stderr.txt b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad-stderr.txt new file mode 100644 index 0000000..97187e6 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad-stderr.txt @@ -0,0 +1 @@ +^Unknown value for CTEST_NO_TESTS_ACTION: 'bad'$ diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_env_bad_with_cli_error-result.txt b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad_with_cli_error-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad_with_cli_error-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_env_bad_with_cli_error-stderr.txt b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad_with_cli_error-stderr.txt new file mode 100644 index 0000000..eafba1c --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_env_bad_with_cli_error-stderr.txt @@ -0,0 +1 @@ +No tests were found!!! diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_env_empty_legacy-stderr.txt b/Tests/RunCMake/CTestCommandLine/no-tests_env_empty_legacy-stderr.txt new file mode 100644 index 0000000..a7c4b11 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_env_empty_legacy-stderr.txt @@ -0,0 +1 @@ +^No tests were found!!!$ diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_env_error-result.txt b/Tests/RunCMake/CTestCommandLine/no-tests_env_error-result.txt new file mode 100644 index 0000000..45a4fb7 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_env_error-result.txt @@ -0,0 +1 @@ +8 diff --git a/Tests/RunCMake/CTestCommandLine/no-tests_env_error-stderr.txt b/Tests/RunCMake/CTestCommandLine/no-tests_env_error-stderr.txt new file mode 100644 index 0000000..eafba1c --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/no-tests_env_error-stderr.txt @@ -0,0 +1 @@ +No tests were found!!! diff --git a/Tests/RunCMake/RunCTest.cmake b/Tests/RunCMake/RunCTest.cmake index 86f5b3a..d46f6ad 100644 --- a/Tests/RunCMake/RunCTest.cmake +++ b/Tests/RunCMake/RunCTest.cmake @@ -3,6 +3,7 @@ include(RunCMake) # Isolate our ctest runs from external environment. unset(ENV{CTEST_PARALLEL_LEVEL}) unset(ENV{CTEST_OUTPUT_ON_FAILURE}) +unset(ENV{CTEST_NO_TESTS_ACTION}) function(run_ctest CASE_NAME) configure_file(${RunCMake_SOURCE_DIR}/test.cmake.in diff --git a/Tests/RunCMake/try_compile/ConfigureLog-bad.c b/Tests/RunCMake/try_compile/ConfigureLog-bad.c new file mode 100644 index 0000000..6508ead --- /dev/null +++ b/Tests/RunCMake/try_compile/ConfigureLog-bad.c @@ -0,0 +1 @@ +#error "This does not compile!" diff --git a/Tests/RunCMake/try_compile/ConfigureLog-config.txt b/Tests/RunCMake/try_compile/ConfigureLog-config.txt new file mode 100644 index 0000000..262ed3c --- /dev/null +++ b/Tests/RunCMake/try_compile/ConfigureLog-config.txt @@ -0,0 +1,52 @@ +^ +--- +events: + - + kind: "try_compile-v1" + backtrace: + - "[^"]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\)" + - "[^"]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)" + - "ConfigureLog.cmake:[0-9]+ \(enable_language\)" + - "CMakeLists.txt:[0-9]+ \(include\)" + checks: + - "Detecting C compiler ABI info" + directories: + source: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" + binary: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" + buildResult: + variable: "CMAKE_C_ABI_COMPILED" + cached: true + stdout: \|.* + exitCode: 0 + - + kind: "try_compile-v1" + backtrace: + - "ConfigureLog.cmake:[0-9]+ \(try_compile\)" + - "CMakeLists.txt:[0-9]+ \(include\)" + description: "Source that should not compile\." + directories: + source: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" + binary: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" + buildResult: + variable: "COMPILE_RESULT" + cached: true + stdout: \|.* + exitCode: [1-9][0-9]* + - + kind: "try_compile-v1" + backtrace: + - "ConfigureLog.cmake:[0-9]+ \(try_compile\)" + - "CMakeLists.txt:[0-9]+ \(include\)" + checks: + - "Check 2" + - "Check 1" + description: "Source that should compile\." + directories: + source: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" + binary: "[^"]*/Tests/RunCMake/try_compile/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" + buildResult: + variable: "COMPILE_RESULT" + cached: true + stdout: \|.* + exitCode: 0 +\.\.\.$ diff --git a/Tests/RunCMake/try_compile/ConfigureLog-stdout.txt b/Tests/RunCMake/try_compile/ConfigureLog-stdout.txt new file mode 100644 index 0000000..ba32642 --- /dev/null +++ b/Tests/RunCMake/try_compile/ConfigureLog-stdout.txt @@ -0,0 +1,4 @@ +-- Check 1 +-- Check 2 +-- Check 2 - passed +-- Check 1 - passed diff --git a/Tests/RunCMake/try_compile/ConfigureLog-test.c b/Tests/RunCMake/try_compile/ConfigureLog-test.c new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/RunCMake/try_compile/ConfigureLog-test.c @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/try_compile/ConfigureLog.cmake b/Tests/RunCMake/try_compile/ConfigureLog.cmake new file mode 100644 index 0000000..294e0f9 --- /dev/null +++ b/Tests/RunCMake/try_compile/ConfigureLog.cmake @@ -0,0 +1,25 @@ +enable_language(C) + +try_compile(COMPILE_RESULT + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-bad.c + LOG_DESCRIPTION "Source that should not compile." + ) + +try_compile(COMPILE_RESULT + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c + NO_LOG + ) + +message(CHECK_START "Check 1") +message(CHECK_START "Check 2") +try_compile(COMPILE_RESULT + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c + LOG_DESCRIPTION "Source that should compile." + ) +if (COMPILE_RESULT) + message(CHECK_PASS "passed") + message(CHECK_PASS "passed") +else() + message(CHECK_FAIL "failed") + message(CHECK_FAIL "failed") +endif() diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt b/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt index b1344bd..b03e0b3 100644 --- a/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt +++ b/Tests/RunCMake/try_compile/EmptyValueArgs-stderr.txt @@ -7,3 +7,11 @@ CMake Error at EmptyValueArgs.cmake:[0-9]+ \(try_compile\): COPY_FILE_ERROR must be followed by a variable name Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at EmptyValueArgs.cmake:[0-9]+ \(try_compile\): + Error after keyword "LOG_DESCRIPTION": + + empty string not allowed + +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/try_compile/EmptyValueArgs.cmake b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake index fda4f10..f0052c5 100644 --- a/Tests/RunCMake/try_compile/EmptyValueArgs.cmake +++ b/Tests/RunCMake/try_compile/EmptyValueArgs.cmake @@ -5,3 +5,6 @@ try_compile(RESULT ${try_compile_bindir_or_SOURCES} try_compile(RESULT ${try_compile_bindir_or_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/src.c COPY_FILE "x" COPY_FILE_ERROR "") +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + LOG_DESCRIPTION "") diff --git a/Tests/RunCMake/try_compile/Inspect-config.txt b/Tests/RunCMake/try_compile/Inspect-config.txt index 47169cf..e09fe55 100644 --- a/Tests/RunCMake/try_compile/Inspect-config.txt +++ b/Tests/RunCMake/try_compile/Inspect-config.txt @@ -8,6 +8,8 @@ events: - "[^"]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)" - "Inspect.cmake:[0-9]+ \(enable_language\)" - "CMakeLists.txt:[0-9]+ \(include\)" + checks: + - "Detecting C compiler ABI info" directories: source: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" binary: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" @@ -23,6 +25,8 @@ events: - "[^"]*/Modules/CMakeTestCXXCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)" - "Inspect.cmake:[0-9]+ \(enable_language\)" - "CMakeLists.txt:[0-9]+ \(include\)" + checks: + - "Detecting CXX compiler ABI info" directories: source: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" binary: "[^"]*/Tests/RunCMake/try_compile/Inspect-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" diff --git a/Tests/RunCMake/try_compile/NoLogDescription-result.txt b/Tests/RunCMake/try_compile/NoLogDescription-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/NoLogDescription-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/NoLogDescription-stderr.txt b/Tests/RunCMake/try_compile/NoLogDescription-stderr.txt new file mode 100644 index 0000000..9005bcd --- /dev/null +++ b/Tests/RunCMake/try_compile/NoLogDescription-stderr.txt @@ -0,0 +1,7 @@ +CMake Error at NoLogDescription.cmake:[0-9]+ \(try_compile\): + Error after keyword "LOG_DESCRIPTION": + + missing required value + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoLogDescription.cmake b/Tests/RunCMake/try_compile/NoLogDescription.cmake new file mode 100644 index 0000000..904763f --- /dev/null +++ b/Tests/RunCMake/try_compile/NoLogDescription.cmake @@ -0,0 +1,4 @@ +include(${CMAKE_CURRENT_SOURCE_DIR}/${try_compile_DEFS}) +try_compile(RESULT ${try_compile_bindir_or_SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src.c + LOG_DESCRIPTION) diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index ad1cc29..51ccac8 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -15,6 +15,7 @@ run_cmake_with_options(Inspect ) include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake") +run_cmake(ConfigureLog) run_cmake(NoArgs) run_cmake(OneArg) run_cmake(TwoArgs) diff --git a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake index 3158e32..0e4cc20 100644 --- a/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake +++ b/Tests/RunCMake/try_compile/old_and_new_signature_tests.cmake @@ -12,6 +12,7 @@ run_cmake(NoCopyFile) run_cmake(NoCopyFile2) run_cmake(NoCopyFileError) run_cmake(NoCStandard) +run_cmake(NoLogDescription) run_cmake(NoOutputVariable) run_cmake(NoOutputVariable2) run_cmake(BadLinkLibraries) diff --git a/Tests/RunCMake/try_run/ConfigureLog-config.txt b/Tests/RunCMake/try_run/ConfigureLog-config.txt index 602437e..ba396e0 100644 --- a/Tests/RunCMake/try_run/ConfigureLog-config.txt +++ b/Tests/RunCMake/try_run/ConfigureLog-config.txt @@ -7,6 +7,8 @@ events: - "[^"]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\)" - "[^"]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)" - "CMakeLists.txt:[0-9]+ \(project\)" + checks: + - "Detecting C compiler ABI info" directories: source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" @@ -20,6 +22,7 @@ events: backtrace: - "ConfigureLog.cmake:[0-9]+ \(try_run\)" - "CMakeLists.txt:[0-9]+ \(include\)" + description: "Source that should not compile\." directories: source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" @@ -36,6 +39,9 @@ events: backtrace: - "ConfigureLog.cmake:[0-9]+ \(try_run\)" - "CMakeLists.txt:[0-9]+ \(include\)" + checks: + - "Check 1" + description: "Source that should compile\." directories: source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" @@ -57,6 +63,9 @@ events: backtrace: - "ConfigureLog.cmake:[0-9]+ \(try_run\)" - "CMakeLists.txt:[0-9]+ \(include\)" + checks: + - "Check 2" + - "Check 1" directories: source: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" binary: "[^"]*/Tests/RunCMake/try_run/ConfigureLog-build/CMakeFiles/CMakeScratch/TryCompile-[^/]+" diff --git a/Tests/RunCMake/try_run/ConfigureLog-stdout.txt b/Tests/RunCMake/try_run/ConfigureLog-stdout.txt new file mode 100644 index 0000000..ba32642 --- /dev/null +++ b/Tests/RunCMake/try_run/ConfigureLog-stdout.txt @@ -0,0 +1,4 @@ +-- Check 1 +-- Check 2 +-- Check 2 - passed +-- Check 1 - passed diff --git a/Tests/RunCMake/try_run/ConfigureLog.cmake b/Tests/RunCMake/try_run/ConfigureLog.cmake index 4b5c7cb..6635d73 100644 --- a/Tests/RunCMake/try_run/ConfigureLog.cmake +++ b/Tests/RunCMake/try_run/ConfigureLog.cmake @@ -1,15 +1,31 @@ try_run(RUN_RESULT COMPILE_RESULT SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-bad.c + LOG_DESCRIPTION "Source that should not compile." ) try_run(RUN_RESULT COMPILE_RESULT SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c + NO_LOG ) +message(CHECK_START "Check 1") +try_run(RUN_RESULT COMPILE_RESULT + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c + LOG_DESCRIPTION "Source that should compile." + ) + +message(CHECK_START "Check 2") try_run(RUN_RESULT COMPILE_RESULT SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c RUN_OUTPUT_VARIABLE RUN_OUTPUT ) +if (RUN_RESULT) + message(CHECK_PASS "passed") + message(CHECK_PASS "passed") +else() + message(CHECK_FAIL "failed") + message(CHECK_FAIL "failed") +endif() try_run(RUN_RESULT COMPILE_RESULT SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/ConfigureLog-test.c diff --git a/Tests/SystemInformation/CMakeLists.txt b/Tests/SystemInformation/CMakeLists.txt index db54612..9a2c4eb 100644 --- a/Tests/SystemInformation/CMakeLists.txt +++ b/Tests/SystemInformation/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required (VERSION 3.0) project(SystemInformation) -include_directories("This does not exists") +include_directories("This does not exist") get_directory_property(incl INCLUDE_DIRECTORIES) set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${SystemInformation_BINARY_DIR};${SystemInformation_SOURCE_DIR}") |