From 9a372f80f7c14242ad113fddbea3da1c20c02f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20R=C3=B6hling?= Date: Fri, 29 Jul 2022 21:54:54 +0200 Subject: [PATCH] New upstream version 3.23.3 --- .../tutorial/Adding System Introspection.rst | 8 ++-- .../Step6/MathFunctions/CMakeLists.txt | 28 ++++++------ .../tutorial/Step6/MathFunctions/mysqrt.cxx | 2 +- Help/release/3.21.rst | 4 +- Help/release/3.22.rst | 6 +-- Help/release/3.23.rst | 7 +++ Modules/CMakeDetermineCompilerId.cmake | 2 + Modules/CompilerId/Xcode-3.pbxproj.in | 3 +- Modules/ExternalProject.cmake | 4 +- Modules/ExternalProject/mkdirs.cmake.in | 3 ++ Modules/FindLAPACK.cmake | 9 +++- Modules/Platform/Linux-LCC-Fortran.cmake | 6 ++- Source/CMakeVersion.cmake | 4 +- Source/QtDialog/CMakeSetup.cxx | 14 ++++++ Source/cmExportSet.cxx | 31 ++++++++++++- Source/cmExportSet.h | 2 +- Source/cmGlobalGenerator.cxx | 4 +- Source/cmInstallExportGenerator.cxx | 3 +- Source/cmake.cxx | 27 ++++-------- Tests/RunCMake/CommandLine/P_args-stdout.txt | 6 +++ Tests/RunCMake/CommandLine/P_args.cmake | 6 +++ Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 1 + Tests/RunCMake/RunCMake.cmake | 2 + Tests/RunCMake/export/RunCMakeTest.cmake | 1 + Tests/RunCMake/export/TryCompileExport.cmake | 9 ++++ ...tMissingSetsInterfacePostExport-result.txt | 1 + ...tMissingSetsInterfacePostExport-stderr.txt | 6 +++ ...ExportMissingSetsInterfacePostExport.cmake | 6 +++ ...MissingSetsInterfacePostInstall-result.txt | 1 + ...MissingSetsInterfacePostInstall-stderr.txt | 6 +++ ...stallMissingSetsInterfacePostInstall.cmake | 6 +++ .../target_sources/RunCMakeTest.cmake | 2 + Utilities/Release/macos/sign-notarize.bash | 43 +++++++++++-------- 33 files changed, 191 insertions(+), 72 deletions(-) create mode 100644 Tests/RunCMake/CommandLine/P_args-stdout.txt create mode 100644 Tests/RunCMake/CommandLine/P_args.cmake create mode 100644 Tests/RunCMake/export/TryCompileExport.cmake create mode 100644 Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-result.txt create mode 100644 Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-stderr.txt create mode 100644 Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport.cmake create mode 100644 Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-result.txt create mode 100644 Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-stderr.txt create mode 100644 Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall.cmake diff --git a/Help/guide/tutorial/Adding System Introspection.rst b/Help/guide/tutorial/Adding System Introspection.rst index e14911008..8db0cb8f3 100644 --- a/Help/guide/tutorial/Adding System Introspection.rst +++ b/Help/guide/tutorial/Adding System Introspection.rst @@ -9,17 +9,15 @@ tutorial assume that they are not common. If the platform has ``log`` and ``exp`` then we will use them to compute the square root in the ``mysqrt`` function. We first test for the availability of -these functions using the :module:`CheckSymbolExists` module in -``MathFunctions/CMakeLists.txt``. On some platforms, we will need to link to -the ``m`` library. If ``log`` and ``exp`` are not initially found, require the -``m`` library and try again. +these functions using the :module:`CheckCXXSourceCompiles` module in +``MathFunctions/CMakeLists.txt``. Add the checks for ``log`` and ``exp`` to ``MathFunctions/CMakeLists.txt``, after the call to :command:`target_include_directories`: .. literalinclude:: Step6/MathFunctions/CMakeLists.txt :caption: MathFunctions/CMakeLists.txt - :name: MathFunctions/CMakeLists.txt-check_symbol_exists + :name: MathFunctions/CMakeLists.txt-check_cxx_source_compiles :language: cmake :start-after: # to find MathFunctions.h, while we don't. :end-before: # add compile definitions diff --git a/Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt index f64c6ac54..42e098af8 100644 --- a/Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step6/MathFunctions/CMakeLists.txt @@ -7,19 +7,21 @@ target_include_directories(MathFunctions ) # does this system provide the log and exp functions? -include(CheckSymbolExists) -check_symbol_exists(log "math.h" HAVE_LOG) -check_symbol_exists(exp "math.h" HAVE_EXP) -if(NOT (HAVE_LOG AND HAVE_EXP)) - unset(HAVE_LOG CACHE) - unset(HAVE_EXP CACHE) - set(CMAKE_REQUIRED_LIBRARIES "m") - check_symbol_exists(log "math.h" HAVE_LOG) - check_symbol_exists(exp "math.h" HAVE_EXP) - if(HAVE_LOG AND HAVE_EXP) - target_link_libraries(MathFunctions PRIVATE m) - endif() -endif() +include(CheckCXXSourceCompiles) +check_cxx_source_compiles(" + #include + int main() { + std::log(1.0); + return 0; + } +" HAVE_LOG) +check_cxx_source_compiles(" + #include + int main() { + std::exp(1.0); + return 0; + } +" HAVE_EXP) # add compile definitions if(HAVE_LOG AND HAVE_EXP) diff --git a/Help/guide/tutorial/Step6/MathFunctions/mysqrt.cxx b/Help/guide/tutorial/Step6/MathFunctions/mysqrt.cxx index 063706365..7eecd26b5 100644 --- a/Help/guide/tutorial/Step6/MathFunctions/mysqrt.cxx +++ b/Help/guide/tutorial/Step6/MathFunctions/mysqrt.cxx @@ -12,7 +12,7 @@ double mysqrt(double x) // if we have both log and exp then use them #if defined(HAVE_LOG) && defined(HAVE_EXP) - double result = exp(log(x) * 0.5); + double result = std::exp(std::log(x) * 0.5); std::cout << "Computing sqrt of " << x << " to be " << result << " using log and exp" << std::endl; #else diff --git a/Help/release/3.21.rst b/Help/release/3.21.rst index 847f82d2c..462d2be81 100644 --- a/Help/release/3.21.rst +++ b/Help/release/3.21.rst @@ -335,8 +335,8 @@ Changes made since CMake 3.21.0 include the following. "Visual Studio 2022" release candidates. Previously it was based on preview versions. -3.21.5, 3.21.6 --------------- +3.21.5, 3.21.6, 3.21.7 +---------------------- These versions made no changes to documented features or interfaces. Some implementation updates were made to support ecosystem changes diff --git a/Help/release/3.22.rst b/Help/release/3.22.rst index 00e93f62a..eba5d66c3 100644 --- a/Help/release/3.22.rst +++ b/Help/release/3.22.rst @@ -170,9 +170,9 @@ Changes made since CMake 3.22.0 include the following. compatibility. The fix may be restored in a future version of CMake via a policy. -3.22.4 ------- +3.22.4, 3.22.5, 3.22.6 +---------------------- -* This version made no changes to documented features or interfaces. +* These versions made no changes to documented features or interfaces. Some implementation updates were made to support ecosystem changes and/or fix regressions. diff --git a/Help/release/3.23.rst b/Help/release/3.23.rst index 47c424351..18fd83bd3 100644 --- a/Help/release/3.23.rst +++ b/Help/release/3.23.rst @@ -309,3 +309,10 @@ Changes made since CMake 3.23.0 include the following. expected the ``CPACK_PACKAGEMAKER_CHOICES`` variable to be defined. The old ``CPACK_PACKAGEMAKER_CHOICES`` variable is now also set to the same content as it was before, but it is formally deprecated. + +3.23.3 +------ + +* This version made no changes to documented features or interfaces. + Some implementation updates were made to support ecosystem changes + and/or fix regressions. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 567050955..c2e0fa841 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -617,6 +617,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} endif() endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_OSX_SYSROOT MATCHES "^$|[Mm][Aa][Cc][Oo][Ss]") + set(id_code_sign_identity "-") # When targeting macOS, use only the host architecture. if (_CMAKE_APPLE_ARCHS_DEFAULT) set(id_archs "ARCHS = \"${_CMAKE_APPLE_ARCHS_DEFAULT}\";") @@ -626,6 +627,7 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_arch_active "ONLY_ACTIVE_ARCH = YES;") endif() else() + set(id_code_sign_identity "") set(id_archs "") set(id_arch_active "ONLY_ACTIVE_ARCH = YES;") endif() diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in index aab357a1e..43e8cc8cb 100644 --- a/Modules/CompilerId/Xcode-3.pbxproj.in +++ b/Modules/CompilerId/Xcode-3.pbxproj.in @@ -49,6 +49,7 @@ }; 2C8FEB8E15DC1A1A00E56A5D = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -72,7 +73,7 @@ 1DEB928608733DD80010E9CD = { isa = XCBuildConfiguration; buildSettings = { - CODE_SIGN_IDENTITY = ""; + CODE_SIGN_IDENTITY = "@id_code_sign_identity@"; PRODUCT_NAME = CompilerId@id_lang@; }; name = Debug; diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 7f16fdc87..cb62c9984 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1651,6 +1651,7 @@ function(_ep_set_directories name) ${script_filename} @ONLY ) + unset(cfgdir) # do not leak into mkdirs.cmake script include(${script_filename}) endfunction() @@ -2419,11 +2420,12 @@ endfunction() function(_ep_add_mkdir_command name) ExternalProject_Get_Property(${name} tmp_dir) set(script_filename "${tmp_dir}/${name}-mkdirs.cmake") + _ep_get_configuration_subdir_suffix(cfgdir) ExternalProject_Add_Step(${name} mkdir INDEPENDENT TRUE COMMENT "Creating directories for '${name}'" - COMMAND ${CMAKE_COMMAND} -P ${script_filename} + COMMAND ${CMAKE_COMMAND} -Dcfgdir=${cfgdir} -P ${script_filename} ) endfunction() diff --git a/Modules/ExternalProject/mkdirs.cmake.in b/Modules/ExternalProject/mkdirs.cmake.in index d30a2e7b6..bb835cf4c 100644 --- a/Modules/ExternalProject/mkdirs.cmake.in +++ b/Modules/ExternalProject/mkdirs.cmake.in @@ -17,3 +17,6 @@ set(configSubDirs @CMAKE_CONFIGURATION_TYPES@) foreach(subDir IN LISTS configSubDirs) file(MAKE_DIRECTORY "@stamp_dir@/${subDir}") endforeach() +if(cfgdir) + file(MAKE_DIRECTORY "@stamp_dir@${cfgdir}") # cfgdir has leading slash +endif() diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 5540965e5..91086a3e8 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -663,6 +663,10 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) elseif(_lapack_sizeof_integer EQUAL 4) string(APPEND _lapack_nvhpc_lib "_lp64") endif() + set(_lapack_nvhpc_flags) + if(";${CMAKE_C_COMPILER_ID};${CMAKE_CXX_COMPILER_ID};${CMAKE_Fortran_COMPILER_ID};" MATCHES ";(NVHPC|PGI);") + set(_lapack_nvhpc_flags "-fortranlibs") + endif() check_lapack_libraries( LAPACK_LIBRARIES @@ -670,7 +674,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) cheev "" "${_lapack_nvhpc_lib}" - "-fortranlibs" + "${_lapack_nvhpc_flags}" "" "" "${BLAS_LIBRARIES}" @@ -688,7 +692,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) cheev "" "${_lapack_nvhpc_lib}" - "-fortranlibs" + "${_lapack_nvhpc_flags}" "" "" "${BLAS_LIBRARIES}" @@ -696,6 +700,7 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) endif() unset(_lapack_nvhpc_lib) + unset(_lapack_nvhpc_flags) endif() # Generic LAPACK library? diff --git a/Modules/Platform/Linux-LCC-Fortran.cmake b/Modules/Platform/Linux-LCC-Fortran.cmake index d3a4cf47a..bf2a1c2d6 100644 --- a/Modules/Platform/Linux-LCC-Fortran.cmake +++ b/Modules/Platform/Linux-LCC-Fortran.cmake @@ -1,3 +1,7 @@ include(Platform/Linux-LCC) __linux_compiler_lcc(Fortran) -set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-llfortran") +if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS "1.26.03") + set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-llfortran") +else() + set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-lgfortran") +endif() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 26dff05ce..f6786592f 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 23) -set(CMake_VERSION_PATCH 2) +set(CMake_VERSION_PATCH 3) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) @@ -21,7 +21,7 @@ endif() if(NOT CMake_VERSION_NO_GIT) # If this source was exported by 'git archive', use its commit info. - set(git_info [==[a8bd06dfd4 CMake 3.23.2]==]) + set(git_info [==[d566bd962d CMake 3.23.3]==]) # Otherwise, try to identify the current development source version. if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* " diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 8ffa3e728..c55604980 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -10,6 +10,15 @@ #include #include +// FIXME(#23565): Qt6 has QTextCodec in Core5Compat, but using its +// `setCodecForLocale` does not make cmake-gui support non-ASCII chars +// on Windows. For now we only support them with Qt5. How do we support +// them with Qt6, preferably without Core5Compat? +#if defined(Q_OS_WIN) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) +# include +# define CMAKE_HAVE_QTEXTCODEC +#endif + #include "cmsys/CommandLineArguments.hxx" #include "cmsys/Encoding.hxx" #include "cmsys/SystemTools.hxx" @@ -124,6 +133,11 @@ int main(int argc, char** argv) setlocale(LC_NUMERIC, "C"); +#ifdef CMAKE_HAVE_QTEXTCODEC + QTextCodec* utf8_codec = QTextCodec::codecForName("UTF-8"); + QTextCodec::setCodecForLocale(utf8_codec); +#endif + // tell the cmake library where cmake is QDir cmExecDir(QApplication::applicationDirPath()); #if defined(Q_OS_MAC) diff --git a/Source/cmExportSet.cxx b/Source/cmExportSet.cxx index a20aa9a8a..3d4ef0a2c 100644 --- a/Source/cmExportSet.cxx +++ b/Source/cmExportSet.cxx @@ -2,10 +2,15 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmExportSet.h" +#include #include #include +#include "cmGeneratorTarget.h" #include "cmLocalGenerator.h" +#include "cmMessageType.h" +#include "cmStringAlgorithms.h" +#include "cmTarget.h" #include "cmTargetExport.h" cmExportSet::cmExportSet(std::string name) @@ -15,11 +20,35 @@ cmExportSet::cmExportSet(std::string name) cmExportSet::~cmExportSet() = default; -void cmExportSet::Compute(cmLocalGenerator* lg) +bool cmExportSet::Compute(cmLocalGenerator* lg) { for (std::unique_ptr& tgtExport : this->TargetExports) { tgtExport->Target = lg->FindGeneratorTargetToUse(tgtExport->TargetName); + + auto const interfaceFileSets = + tgtExport->Target->Target->GetAllInterfaceFileSets(); + auto const fileSetInTargetExport = + [&tgtExport, lg](const std::string& fileSetName) -> bool { + auto* fileSet = tgtExport->Target->Target->GetFileSet(fileSetName); + + if (!tgtExport->FileSetGenerators.count(fileSet)) { + lg->IssueMessage(MessageType::FATAL_ERROR, + cmStrCat("File set \"", fileSetName, + "\" is listed in interface file sets of ", + tgtExport->Target->GetName(), + " but has not been exported")); + return false; + } + return true; + }; + + if (!std::all_of(interfaceFileSets.begin(), interfaceFileSets.end(), + fileSetInTargetExport)) { + return false; + } } + + return true; } void cmExportSet::AddTargetExport(std::unique_ptr te) diff --git a/Source/cmExportSet.h b/Source/cmExportSet.h index 07deb1124..b75a26d9c 100644 --- a/Source/cmExportSet.h +++ b/Source/cmExportSet.h @@ -25,7 +25,7 @@ public: cmExportSet(const cmExportSet&) = delete; cmExportSet& operator=(const cmExportSet&) = delete; - void Compute(cmLocalGenerator* lg); + bool Compute(cmLocalGenerator* lg); void AddTargetExport(std::unique_ptr tgt); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 156ecce8a..c75198db6 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1361,7 +1361,9 @@ void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes) this->CheckTargetProperties(); } this->CreateGeneratorTargets(targetTypes); - this->ComputeBuildFileGenerators(); + if (targetTypes == TargetTypes::AllTargets) { + this->ComputeBuildFileGenerators(); + } } void cmGlobalGenerator::CreateImportedGenerationObjects( diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 820f24a8f..9cb376d60 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -49,8 +49,7 @@ cmInstallExportGenerator::~cmInstallExportGenerator() = default; bool cmInstallExportGenerator::Compute(cmLocalGenerator* lg) { this->LocalGenerator = lg; - this->ExportSet->Compute(lg); - return true; + return this->ExportSet->Compute(lg); } void cmInstallExportGenerator::ComputeTempDir() diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 7de488b37..b47155ebd 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -405,9 +405,6 @@ void cmake::PrintPresetEnvironment() // Parse the args bool cmake::SetCacheArgs(const std::vector& args) { - auto findPackageMode = false; - auto seenScriptOption = false; - auto DefineLambda = [](std::string const& entry, cmake* state) -> bool { std::string var; std::string value; @@ -498,10 +495,10 @@ bool cmake::SetCacheArgs(const std::vector& args) GetProjectCommandsInScriptMode(state->GetState()); // Documented behavior of CMAKE{,_CURRENT}_{SOURCE,BINARY}_DIR is to be // set to $PWD for -P mode. + state->SetWorkingMode(SCRIPT_MODE); state->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); state->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); state->ReadListFile(args, path); - seenScriptOption = true; return true; }; @@ -565,15 +562,12 @@ bool cmake::SetCacheArgs(const std::vector& args) "No install directory specified for --install-prefix", CommandArgument::Values::One, PrefixLambda }, CommandArgument{ "--find-package", CommandArgument::Values::Zero, - [&](std::string const&, cmake*) -> bool { - findPackageMode = true; - return true; - } }, + IgnoreAndTrueLambda }, }; for (decltype(args.size()) i = 1; i < args.size(); ++i) { std::string const& arg = args[i]; - if (arg == "--" && seenScriptOption) { + if (arg == "--" && this->GetWorkingMode() == SCRIPT_MODE) { // Stop processing CMake args and avoid possible errors // when arbitrary args are given to CMake script. break; @@ -588,7 +582,7 @@ bool cmake::SetCacheArgs(const std::vector& args) } } - if (findPackageMode) { + if (this->GetWorkingMode() == FIND_PACKAGE_MODE) { return this->FindPackage(args); } @@ -793,7 +787,6 @@ void cmake::SetArgs(const std::vector& args) bool haveToolset = false; bool havePlatform = false; bool haveBArg = false; - bool scriptMode = false; std::string possibleUnknownArg; std::string extraProvidedPath; #if !defined(CMAKE_BOOTSTRAP) @@ -871,10 +864,7 @@ void cmake::SetArgs(const std::vector& args) CommandArgument{ "-P", "-P must be followed by a file name.", CommandArgument::Values::One, CommandArgument::RequiresSeparator::No, - [&](std::string const&, cmake*) -> bool { - scriptMode = true; - return true; - } }, + IgnoreAndTrueLambda }, CommandArgument{ "-D", "-D must be followed with VAR=VALUE.", CommandArgument::Values::One, CommandArgument::RequiresSeparator::No, @@ -1198,12 +1188,12 @@ void cmake::SetArgs(const std::vector& args) } } - if (!extraProvidedPath.empty() && !scriptMode) { + if (!extraProvidedPath.empty() && this->GetWorkingMode() == NORMAL_MODE) { this->IssueMessage(MessageType::WARNING, cmStrCat("Ignoring extra path from command line:\n \"", extraProvidedPath, "\"")); } - if (!possibleUnknownArg.empty() && !scriptMode) { + if (!possibleUnknownArg.empty() && this->GetWorkingMode() != SCRIPT_MODE) { cmSystemTools::Error(cmStrCat("Unknown argument ", possibleUnknownArg)); cmSystemTools::Error("Run 'cmake --help' for all supported options."); exit(1); @@ -1787,7 +1777,8 @@ void cmake::SetHomeDirectoryViaCommandLine(std::string const& path) } auto prev_path = this->GetHomeDirectory(); - if (prev_path != path && !prev_path.empty()) { + if (prev_path != path && !prev_path.empty() && + this->GetWorkingMode() == NORMAL_MODE) { this->IssueMessage(MessageType::WARNING, cmStrCat("Ignoring extra path from command line:\n \"", prev_path, "\"")); diff --git a/Tests/RunCMake/CommandLine/P_args-stdout.txt b/Tests/RunCMake/CommandLine/P_args-stdout.txt new file mode 100644 index 000000000..f9d039fe8 --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_args-stdout.txt @@ -0,0 +1,6 @@ +^-- CMAKE_ARGC='5' +-- CMAKE_ARGV1='-P' +-- CMAKE_ARGV2='[^']*/Tests/RunCMake/CommandLine/P_args.cmake' +-- CMAKE_ARGV3='relative/path' +-- CMAKE_ARGV4='[^']*/Tests/RunCMake/CommandLine' +-- CMAKE_ARGV5=''$ diff --git a/Tests/RunCMake/CommandLine/P_args.cmake b/Tests/RunCMake/CommandLine/P_args.cmake new file mode 100644 index 000000000..6c4fa4c70 --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_args.cmake @@ -0,0 +1,6 @@ +message(STATUS "CMAKE_ARGC='${CMAKE_ARGC}'") +message(STATUS "CMAKE_ARGV1='${CMAKE_ARGV1}'") +message(STATUS "CMAKE_ARGV2='${CMAKE_ARGV2}'") +message(STATUS "CMAKE_ARGV3='${CMAKE_ARGV3}'") +message(STATUS "CMAKE_ARGV4='${CMAKE_ARGV4}'") +message(STATUS "CMAKE_ARGV5='${CMAKE_ARGV5}'") diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index f7554ffad..48df4f7c7 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -52,6 +52,7 @@ run_cmake_command(G_no-arg ${CMAKE_COMMAND} -B DummyBuildDir -G) run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -B DummyBuildDir -G NoSuchGenerator) run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P) run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake) +run_cmake_command(P_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_args.cmake" relative/path "${RunCMake_SOURCE_DIR}") run_cmake_command(P_arbitrary_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_arbitrary_args.cmake" -- -DFOO) run_cmake_command(build-no-dir diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 3ddb8901c..87752bd6e 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -164,7 +164,9 @@ function(run_cmake test) "|[^\n]*install_name_tool: warning: changes being made to the file will invalidate the code signature in:" "|[^\n]*xcodebuild[^\n]*DVTPlugInManager" + "|[^\n]*xcodebuild[^\n]*DVTSDK: Warning: SDK path collision for path" "|[^\n]*xcodebuild[^\n]*Requested but did not find extension point with identifier" + "|[^\n]*xcodebuild[^\n]*nil host used in call to allows.*HTTPSCertificateForHost" "|[^\n]*xcodebuild[^\n]*warning: file type[^\n]*is based on missing file type" "|[^\n]*objc[^\n]*: Class [^\n]* One of the two will be used. Which one is undefined." "|[^\n]*is a member of multiple groups" diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake index 0e6020f0f..ee00b273c 100644 --- a/Tests/RunCMake/export/RunCMakeTest.cmake +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -18,3 +18,4 @@ run_cmake(DependOnDoubleExport) run_cmake(UnknownExport) run_cmake(NamelinkOnlyExport) run_cmake(SeparateNamelinkExport) +run_cmake(TryCompileExport) diff --git a/Tests/RunCMake/export/TryCompileExport.cmake b/Tests/RunCMake/export/TryCompileExport.cmake new file mode 100644 index 000000000..5ad7c6ee0 --- /dev/null +++ b/Tests/RunCMake/export/TryCompileExport.cmake @@ -0,0 +1,9 @@ +enable_language(CXX) + +add_library(interface INTERFACE) +install(TARGETS interface EXPORT export) +export(EXPORT export) + +add_library(imported IMPORTED INTERFACE) + +try_compile(tc "${CMAKE_CURRENT_BINARY_DIR}/tc" "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp" LINK_LIBRARIES imported) diff --git a/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-result.txt b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-stderr.txt b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-stderr.txt new file mode 100644 index 000000000..b8d35af9a --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error in CMakeLists\.txt: + File set "a" is listed in interface file sets of lib1 but has not been + exported + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport.cmake b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport.cmake new file mode 100644 index 000000000..72fab477f --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetExportMissingSetsInterfacePostExport.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +install(TARGETS lib1 EXPORT a) +target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +export(EXPORT a) diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-result.txt b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-stderr.txt b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-stderr.txt new file mode 100644 index 000000000..b8d35af9a --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error in CMakeLists\.txt: + File set "a" is listed in interface file sets of lib1 but has not been + exported + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall.cmake b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall.cmake new file mode 100644 index 000000000..4e1edffdb --- /dev/null +++ b/Tests/RunCMake/target_sources/FileSetInstallMissingSetsInterfacePostInstall.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +add_library(lib1 STATIC empty.c) +install(TARGETS lib1 EXPORT a) +target_sources(lib1 INTERFACE FILE_SET a TYPE HEADERS BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} FILES h1.h) +install(EXPORT a DESTINATION lib/cmake/test) diff --git a/Tests/RunCMake/target_sources/RunCMakeTest.cmake b/Tests/RunCMake/target_sources/RunCMakeTest.cmake index e78ee9dab..6a3c7b9c6 100644 --- a/Tests/RunCMake/target_sources/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_sources/RunCMakeTest.cmake @@ -33,6 +33,8 @@ run_cmake(FileSetWrongBaseDirsRelative) run_cmake(FileSetOverlappingBaseDirs) run_cmake(FileSetInstallMissingSetsPrivate) run_cmake(FileSetInstallMissingSetsInterface) +run_cmake(FileSetInstallMissingSetsInterfacePostInstall) +run_cmake(FileSetExportMissingSetsInterfacePostExport) run_cmake(FileSetReadOnlyPrivate) run_cmake(FileSetReadOnlyInterface) run_cmake(FileSetNoExistInstall) diff --git a/Utilities/Release/macos/sign-notarize.bash b/Utilities/Release/macos/sign-notarize.bash index 8283c90ba..76b8898ea 100755 --- a/Utilities/Release/macos/sign-notarize.bash +++ b/Utilities/Release/macos/sign-notarize.bash @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -e -readonly usage='usage: sign-notarize.bash -i -d -k [-p ] [--] .dmg +readonly usage='usage: sign-notarize.bash -i -k [--] .dmg Sign and notarize the "CMake.app" bundle inside the given ".dmg" disk image. Also produce a ".tar.gz" tarball containing the same "CMake.app". @@ -8,9 +8,22 @@ Also produce a ".tar.gz" tarball containing the same "CMake.app". Options: -i Signing Identity - -d Developer account name - -k Keychain item containing account credentials - -p Provider short name + -k Keychain profile containing stored credentials + +Create the keychain profile ahead of time using + + xcrun notarytool store-credentials \ + --apple-id --team-id [--password ] + +where: + + is an Apple ID of a developer account + is from https://developer.apple.com/account/#!/membership + is generated via https://support.apple.com/en-us/HT204397 + If --password is omitted, notarytool will prompt for it. + +This creates a keychain item called "com.apple.gke.notary.tool" with an +account name "com.apple.gke.notary.tool.saved-creds.". ' cleanup() { @@ -29,15 +42,11 @@ die() { } id='' -dev_acct='' -key_item='' -provider='' +keychain_profile='' while test "$#" != 0; do case "$1" in -i) shift; id="$1" ;; - -d) shift; dev_acct="$1" ;; - -k) shift; key_item="$1" ;; - -p) shift; provider="$1" ;; + -k) shift; keychain_profile="$1" ;; --) shift ; break ;; -*) die "$usage" ;; *) break ;; @@ -51,18 +60,14 @@ esac test "$#" = 0 || die "$usage" # Verify arguments. -if test -z "$id" -o -z "$dev_acct" -o -z "$key_item"; then +if test -z "$id" -o -z "$keychain_profile"; then die "$usage" fi -if test -n "$provider"; then - provider="--provider $provider" -fi # Verify environment. -if ! xcnotary="$(type -p xcnotary)"; then - die "'xcnotary' not found in PATH" +if ! xcrun --find notarytool 2>/dev/null; then + die "'xcrun notarytool' not found" fi -readonly xcnotary readonly tmpdir="$(mktemp -d)" @@ -101,7 +106,9 @@ codesign --verify --timestamp --options=runtime --verbose --deep \ "$vol_path/CMake.app/Contents/bin/cpack" \ "$vol_path/CMake.app" -xcnotary notarize "$vol_path/CMake.app" -d "$dev_acct" -k "$key_item" $provider +ditto -c -k --keepParent "$vol_path/CMake.app" "$tmpdir/CMake.app.zip" +xcrun notarytool submit "$tmpdir/CMake.app.zip" --keychain-profile "$keychain_profile" --wait +xcrun stapler staple "$vol_path/CMake.app" # Create a tarball of the volume next to the original disk image. readonly tar_gz="${dmg/%.dmg/.tar.gz}"