diff options
34 files changed, 242 insertions, 74 deletions
diff --git a/Help/cpack_gen/ifw.rst b/Help/cpack_gen/ifw.rst index 160b976..a940a95 100644 --- a/Help/cpack_gen/ifw.rst +++ b/Help/cpack_gen/ifw.rst @@ -109,6 +109,12 @@ Package Default height of the wizard in pixels. Setting a watermark image will override this. +.. variable:: CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST + + Set to ``OFF`` if the widget listing installer pages on the left side of the wizard should not be shown. + + Is ``ON`` by default. + .. variable:: CPACK_IFW_PACKAGE_TITLE_COLOR .. versionadded:: 3.8 diff --git a/Help/release/dev/cpackifw-package-wizard-show-page-list.rst b/Help/release/dev/cpackifw-package-wizard-show-page-list.rst new file mode 100644 index 0000000..ede69f5 --- /dev/null +++ b/Help/release/dev/cpackifw-package-wizard-show-page-list.rst @@ -0,0 +1,7 @@ +cpackifw-package-wizard-show-page-list +-------------------------------------- + +* The :cpack_gen:`CPack IFW Generator` gained new + :variable:`CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST` variable to + control visibility of the widget listing installer pages on the left side + of the wizard. This feature available only since QtIFW 4.0. diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 2f6bdb4..8ba6abc 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -26,7 +26,7 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif -#if defined(__CRAYXE) || defined(__CRAYXC) +#if defined(_CRAYC) || defined(__cray__) char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; #endif @@ -77,7 +77,7 @@ int main(int argc, char* argv[]) #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; #endif -#if defined(__CRAYXE) || defined(__CRAYXC) +#if defined(_CRAYC) || defined(__cray__) require += info_cray[argc]; #endif require += info_language_dialect_default[argc]; diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index a743ce7..672fff8 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -20,7 +20,7 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif -#if defined(__CRAYXE) || defined(__CRAYXC) +#if defined(_CRAYC) || defined(__cray__) char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; #endif @@ -76,7 +76,7 @@ int main(int argc, char* argv[]) #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; #endif -#if defined(__CRAYXE) || defined(__CRAYXC) +#if defined(_CRAYC) || defined(__cray__) require += info_cray[argc]; #endif require += info_language_dialect_default[argc]; diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 30f8d4c..7e8828b 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -108,7 +108,7 @@ #else PRINT *, 'INFO:compiler[]' #endif -#if defined(__CRAYXE) || defined(__CRAYXC) +#if defined(_CRAYFTN) PRINT *, 'INFO:compiler_wrapper[CrayPrgEnv]' #endif diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake index 3c97afb..bd88989 100644 --- a/Modules/Compiler/TI-C.cmake +++ b/Modules/Compiler/TI-C.cmake @@ -26,7 +26,7 @@ else() endif() -if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C99_VERSION_${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}}") +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C99_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID}}") set(CMAKE_C90_STANDARD_COMPILE_OPTION "--c89" "--strict_ansi") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--c89" "--relaxed_ansi") @@ -34,8 +34,8 @@ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C99_VERSION_$ set(CMAKE_C99_STANDARD_COMPILE_OPTION "--c99" "--strict_ansi") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "--c99" "--relaxed_ansi") - if(DEFINED __COMPILER_TI_C11_VERSION_${CMAKE_CXX_COMPILER_ARCHITECTURE_ID} AND - CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C11_VERSION_${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}}") + if(DEFINED __COMPILER_TI_C11_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID} AND + CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C11_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID}}") set(CMAKE_C11_STANDARD_COMPILE_OPTION "--c11" "--strict_ansi") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "--c11" "--relaxed_ansi") diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 068edcf..12f4c17 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -1036,7 +1036,7 @@ if (HDF5_FOUND) # Error if we still don't have the location. message(SEND_ERROR "HDF5 was found, but a different variable was set which contains " - "its location.") + "the location of the `hdf5::${hdf5_target_name}` library.") endif () add_library("hdf5::${hdf5_target_name}" UNKNOWN IMPORTED) string(REPLACE "-D" "" _hdf5_definitions "${HDF5_${hdf5_lang}_DEFINITIONS}") @@ -1067,12 +1067,14 @@ if (HDF5_FOUND) continue () endif () + set(hdf5_alt_target_name "") if (hdf5_lang STREQUAL "C") set(hdf5_target_name "hdf5_hl") elseif (hdf5_lang STREQUAL "CXX") set(hdf5_target_name "hdf5_hl_cpp") elseif (hdf5_lang STREQUAL "Fortran") set(hdf5_target_name "hdf5_hl_fortran") + set(hdf5_alt_target_name "hdf5hl_fortran") else () continue () endif () @@ -1091,11 +1093,13 @@ if (HDF5_FOUND) set(_hdf5_location "${HDF5_${hdf5_lang}_HL_LIBRARY}") elseif (DEFINED "HDF5_${hdf5_lang}_LIBRARY_${hdf5_target_name}") set(_hdf5_location "${HDF5_${hdf5_lang}_LIBRARY_${hdf5_target_name}}") + elseif (hdf5_alt_target_name AND DEFINED "HDF5_${hdf5_lang}_LIBRARY_${hdf5_alt_target_name}") + set(_hdf5_location "${HDF5_${hdf5_lang}_LIBRARY_${hdf5_alt_target_name}}") else () # Error if we still don't have the location. message(SEND_ERROR "HDF5 was found, but a different variable was set which contains " - "its location.") + "the location of the `hdf5::${hdf5_target_name}` library.") endif () add_library("hdf5::${hdf5_target_name}" UNKNOWN IMPORTED) string(REPLACE "-D" "" _hdf5_definitions "${HDF5_${hdf5_lang}_HL_DEFINITIONS}") diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index 2c6ee19..51e9e81 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -105,7 +105,7 @@ macro(__windows_compiler_clang_gnu lang) enable_language(RC) endmacro() -macro(__enable_llvm_rc_preprocessing clang_option_prefix) +macro(__enable_llvm_rc_preprocessing clang_option_prefix extra_pp_flags) # Feed the preprocessed rc file to llvm-rc if(CMAKE_RC_COMPILER_INIT MATCHES "llvm-rc" OR CMAKE_RC_COMPILER MATCHES "llvm-rc") if(DEFINED CMAKE_C_COMPILER_ID) @@ -117,7 +117,7 @@ macro(__enable_llvm_rc_preprocessing clang_option_prefix) set(CMAKE_DEPFILE_FLAGS_RC "${clang_option_prefix}-MD ${clang_option_prefix}-MF ${clang_option_prefix}<DEP_FILE>") # The <FLAGS> are passed to the preprocess and the resource compiler to pick # up the eventual -D / -C options passed through the CMAKE_RC_FLAGS. - set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_COMMAND> -E cmake_llvm_rc <SOURCE> <OBJECT>.pp <${CMAKE_RC_PREPROCESSOR}> <DEFINES> -DRC_INVOKED <INCLUDES> <FLAGS> -E -- <SOURCE> ++ <CMAKE_RC_COMPILER> <DEFINES> -I <SOURCE_DIR> <INCLUDES> <FLAGS> /fo <OBJECT> <OBJECT>.pp") + set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_COMMAND> -E cmake_llvm_rc <SOURCE> <OBJECT>.pp <${CMAKE_RC_PREPROCESSOR}> <DEFINES> -DRC_INVOKED <INCLUDES> <FLAGS> ${extra_pp_flags} -E -- <SOURCE> ++ <CMAKE_RC_COMPILER> <DEFINES> -I <SOURCE_DIR> <INCLUDES> <FLAGS> /fo <OBJECT> <OBJECT>.pp") if(CMAKE_GENERATOR MATCHES "Ninja") set(CMAKE_NINJA_CMCLDEPS_RC 0) set(CMAKE_NINJA_DEP_TYPE_RC gcc) @@ -167,7 +167,7 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" if ( "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC" OR "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC" ) include(Platform/Windows-MSVC) # Set the clang option forwarding prefix for clang-cl usage in the llvm-rc processing stage - __enable_llvm_rc_preprocessing("-clang:") + __enable_llvm_rc_preprocessing("-clang:" "") macro(__windows_compiler_clang_base lang) set(_COMPILE_${lang} "${_COMPILE_${lang}_MSVC}") __windows_compiler_msvc(${lang}) @@ -183,7 +183,7 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" set(CMAKE_BUILD_TYPE_INIT Debug) - __enable_llvm_rc_preprocessing("") + __enable_llvm_rc_preprocessing("" "-x c") macro(__windows_compiler_clang_base lang) __windows_compiler_clang_gnu(${lang}) endmacro() @@ -191,7 +191,7 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" else() include(Platform/Windows-GNU) - __enable_llvm_rc_preprocessing("") + __enable_llvm_rc_preprocessing("" "-x c") macro(__windows_compiler_clang_base lang) __windows_compiler_gnu(${lang}) endmacro() diff --git a/Modules/Platform/Windows-Intel-C.cmake b/Modules/Platform/Windows-Intel-C.cmake index 3cbc7a5..152b27c 100644 --- a/Modules/Platform/Windows-Intel-C.cmake +++ b/Modules/Platform/Windows-Intel-C.cmake @@ -1,11 +1,27 @@ include(Platform/Windows-Intel) __windows_compiler_intel(C) -set(CMAKE_NINJA_DEPTYPE_C intel) # special value handled by CMake + set(CMAKE_DEPFILE_FLAGS_C "-QMMD -QMT <DEP_TARGET> -QMF <DEP_FILE>") +set(CMAKE_C_DEPFILE_FORMAT gcc) + +if(CMAKE_GENERATOR MATCHES "^Ninja") + if(_CMAKE_NINJA_VERSION VERSION_LESS 1.9) + # This ninja version is too old to support the Intel depfile format. + # Fall back to msvc depfile format. + set(CMAKE_DEPFILE_FLAGS_C "/showIncludes") + set(CMAKE_C_DEPFILE_FORMAT msvc) + endif() +endif() if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) AND CMAKE_GENERATOR MATCHES "Makefiles|WMake") # dependencies are computed by the compiler itself - set(CMAKE_C_DEPFILE_FORMAT gcc) set(CMAKE_C_DEPENDS_USE_COMPILER TRUE) endif() + +if("${CMAKE_SOURCE_DIR}${CMAKE_BINARY_DIR}" MATCHES " ") + # The Intel compiler does not properly escape spaces in a depfile. + # Fall back to msvc depfile format. + set(CMAKE_DEPFILE_FLAGS_C "/showIncludes") + set(CMAKE_C_DEPFILE_FORMAT msvc) +endif() diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake index 6539f64..ce33ae1 100644 --- a/Modules/Platform/Windows-Intel-CXX.cmake +++ b/Modules/Platform/Windows-Intel-CXX.cmake @@ -1,12 +1,28 @@ include(Platform/Windows-Intel) set(_COMPILE_CXX " /TP") __windows_compiler_intel(CXX) -set(CMAKE_NINJA_DEPTYPE_CXX intel) # special value handled by CMake + set(CMAKE_DEPFILE_FLAGS_CXX "-QMMD -QMT <DEP_TARGET> -QMF <DEP_FILE>") +set(CMAKE_CXX_DEPFILE_FORMAT gcc) + +if(CMAKE_GENERATOR MATCHES "^Ninja") + if(_CMAKE_NINJA_VERSION VERSION_LESS 1.9) + # This ninja version is too old to support the Intel depfile format. + # Fall back to msvc depfile format. + set(CMAKE_DEPFILE_FLAGS_CXX "/showIncludes") + set(CMAKE_CXX_DEPFILE_FORMAT msvc) + endif() +endif() if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER) AND CMAKE_GENERATOR MATCHES "Makefiles|WMake") # dependencies are computed by the compiler itself - set(CMAKE_CXX_DEPFILE_FORMAT gcc) - set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) + set(CMAKE_CXX_DEPENDS_USE_COMPILER TRUE) +endif() + +if("${CMAKE_SOURCE_DIR}${CMAKE_BINARY_DIR}" MATCHES " ") + # The Intel compiler does not properly escape spaces in a depfile. + # Fall back to msvc depfile format. + set(CMAKE_DEPFILE_FLAGS_CXX "/showIncludes") + set(CMAKE_CXX_DEPFILE_FORMAT msvc) endif() diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index 5d8f7fc..01f8dd0 100644 --- a/Modules/Platform/Windows-Intel.cmake +++ b/Modules/Platform/Windows-Intel.cmake @@ -8,6 +8,20 @@ if(__WINDOWS_INTEL) endif() set(__WINDOWS_INTEL 1) + +if (CMAKE_GENERATOR MATCHES "^Ninja") + # retrieve ninja version to enable dependencies configuration + # against Ninja capabilities + execute_process(COMMAND "${CMAKE_MAKE_PROGRAM}" --version + RESULT_VARIABLE _CMAKE_NINJA_RESULT + OUTPUT_VARIABLE _CMAKE_NINJA_VERSION + ERROR_VARIABLE _CMAKE_NINJA_VERSION) + if (NOT _CMAKE_NINJA_RESULT AND _CMAKE_NINJA_VERSION MATCHES "[0-9]+(\\.[0-9]+)*") + set (_CMAKE_NINJA_VERSION "${CMAKE_MATCH_0}") + endif() + unset(_CMAKE_NINJA_RESULT) +endif() + include(Platform/Windows-MSVC) macro(__windows_compiler_intel lang) __windows_compiler_msvc(${lang}) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index ec5758c..08afd61 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -435,11 +435,10 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -MDd) endif() set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON) - set(CMAKE_NINJA_DEPTYPE_${lang} msvc) + __windows_compiler_msvc_enable_rc("${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_${lang}}") # define generic information about compiler dependencies - # activation is done on per language platform configuration basis if (MSVC_VERSION GREATER 1300) set(CMAKE_DEPFILE_FLAGS_${lang} "/showIncludes") set(CMAKE_${lang}_DEPFILE_FORMAT msvc) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 63dde11..ceeb07c 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 19) -set(CMake_VERSION_PATCH 20201201) +set(CMake_VERSION_PATCH 20201203) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 4bad598..8e00ad6 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -174,6 +174,26 @@ void cmCPackIFWInstaller::ConfigureFromOptions() this->WizardDefaultHeight = option; } + // WizardShowPageList + if (const char* option = + this->GetOption("CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST")) { + if (!this->IsVersionLess("4.0")) { + if (this->IsSetToOff("CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST")) { + this->WizardShowPageList = "false"; + } else if (this->IsOn("CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST")) { + this->WizardShowPageList = "true"; + } else { + this->WizardShowPageList.clear(); + } + } else { + cmCPackIFWLogger( + WARNING, + "Option CPACK_IFW_PACKAGE_WIZARD_SHOW_PAGE_LIST is set to value \"" + << option << "\". But has no any effect for QtIFW less than 4.0 " + << "and will be skipped." << std::endl); + } + } + // TitleColor if (const char* option = this->GetOption("CPACK_IFW_PACKAGE_TITLE_COLOR")) { this->TitleColor = option; @@ -408,6 +428,11 @@ void cmCPackIFWInstaller::GenerateInstallerFile() xout.Element("WizardDefaultHeight", this->WizardDefaultHeight); } + // WizardShowPageList + if (!this->IsVersionLess("4.0") && !this->WizardShowPageList.empty()) { + xout.Element("WizardShowPageList", this->WizardShowPageList); + } + // TitleColor if (!this->TitleColor.empty()) { xout.Element("TitleColor", this->TitleColor); diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index 6f398e3..a031fc2 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -80,6 +80,10 @@ public: /// Wizard height std::string WizardDefaultHeight; + /// Set to false if the widget listing installer pages on the left side + /// of the wizard should not be shown + std::string WizardShowPageList; + /// Title color std::string TitleColor; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 8cf5ae9..8479458 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1017,6 +1017,17 @@ int cmCTest::ProcessSteps() } if (res != 0) { cmCTestLog(this, ERROR_MESSAGE, "Errors while running CTest" << std::endl); + if (!this->Impl->OutputTestOutputOnTestFailure) { + const std::string lastTestLog = + this->GetBinaryDir() + "/Testing/Temporary/LastTest.log"; + cmCTestLog(this, ERROR_MESSAGE, + "Output from these tests are in: " << lastTestLog + << std::endl); + cmCTestLog(this, ERROR_MESSAGE, + "Use \"--rerun-failed --output-on-failure\" to re-run the " + "failed cases verbosely." + << std::endl); + } } return res; } diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index dd700c5..1a31ae4 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -288,6 +288,9 @@ void cmExportBuildFileGenerator::GetTargets( if (this->ExportSet) { for (std::unique_ptr<cmTargetExport> const& te : this->ExportSet->GetTargetExports()) { + if (te->NamelinkOnly) { + continue; + } targets.push_back(te->TargetName); } return; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 987ec9e..0b9b183 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -42,6 +42,9 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) std::string sep; for (std::unique_ptr<cmTargetExport> const& te : this->IEGen->GetExportSet()->GetTargetExports()) { + if (te->NamelinkOnly) { + continue; + } expectedTargets += sep + this->Namespace + te->Target->GetExportName(); sep = " "; if (this->ExportedTargets.insert(te->Target).second) { diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index b99e6a3..ff08ee4 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -461,6 +461,13 @@ bool HandleTargetsMode(std::vector<std::string> const& args, std::unique_ptr<cmInstallFilesGenerator> publicHeaderGenerator; std::unique_ptr<cmInstallFilesGenerator> resourceGenerator; + // Avoid selecting default destinations for PUBLIC_HEADER and + // PRIVATE_HEADER if any artifacts are specified. + bool artifactsSpecified = false; + + // Track whether this is a namelink-only rule. + bool namelinkOnly = false; + auto addTargetExport = [&]() { // Add this install rule to an export if one was specified. if (!exports.empty()) { @@ -475,20 +482,13 @@ bool HandleTargetsMode(std::vector<std::string> const& args, te->ObjectsGenerator = objectGenerator.get(); te->InterfaceIncludeDirectories = cmJoin(includesArgs.GetIncludeDirs(), ";"); - + te->NamelinkOnly = namelinkOnly; helper.Makefile->GetGlobalGenerator() ->GetExportSets()[exports] .AddTargetExport(std::move(te)); } }; - // Avoid selecting default destinations for PUBLIC_HEADER and - // PRIVATE_HEADER if any artifacts are specified. - bool artifactsSpecified = false; - - // Track whether this is a namelink-only rule. - bool namelinkOnly = false; - switch (target.GetType()) { case cmStateEnums::SHARED_LIBRARY: { // Shared libraries are handled differently on DLL and non-DLL @@ -497,6 +497,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args, if (target.IsDLLPlatform()) { // When in namelink only mode skip all libraries on Windows. if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) { + namelinkOnly = true; addTargetExport(); continue; } @@ -529,6 +530,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args, if (target.IsFrameworkOnApple()) { // When in namelink only mode skip frameworks. if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) { + namelinkOnly = true; addTargetExport(); continue; } @@ -574,6 +576,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args, if (target.IsFrameworkOnApple()) { // When in namelink only mode skip frameworks. if (namelinkMode == cmInstallTargetGenerator::NamelinkModeOnly) { + namelinkOnly = true; addTargetExport(); continue; } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 4ac08e0..99f1b45 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -12,7 +12,9 @@ #include <utility> #include <cm/memory> +#include <cm/string_view> #include <cmext/algorithm> +#include <cmext/string_view> #include <cm3p/json/value.h> #include <cm3p/json/writer.h> @@ -245,32 +247,6 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags, this->LocalGenerator->AppendFlags(languageFlags, includeFlags); } -bool cmNinjaTargetGenerator::NeedDepTypeMSVC(const std::string& lang) const -{ - std::string const& deptype = this->GetMakefile()->GetSafeDefinition( - cmStrCat("CMAKE_NINJA_DEPTYPE_", lang)); - if (deptype == "msvc") { - return true; - } - if (deptype == "intel") { - // Ninja does not really define "intel", but we use it to switch based - // on whether this environment supports "gcc" or "msvc" deptype. - if (!this->GetGlobalGenerator()->SupportsMultilineDepfile()) { - // This ninja version is too old to support the Intel depfile format. - // Fall back to msvc deptype. - return true; - } - if ((this->Makefile->GetHomeDirectory().find(' ') != std::string::npos) || - (this->Makefile->GetHomeOutputDirectory().find(' ') != - std::string::npos)) { - // The Intel compiler does not properly escape spaces in a depfile. - // Fall back to msvc deptype. - return true; - } - } - return false; -} - // TODO: Refactor with // void cmMakefileTargetGenerator::WriteTargetLanguageFlags(). std::string cmNinjaTargetGenerator::ComputeDefines(cmSourceFile const* source, @@ -727,10 +703,6 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, std::string cldeps; if (!compilationPreprocesses) { // The compiler will not do preprocessing, so it has no such dependencies. - } else if (this->NeedDepTypeMSVC(lang)) { - rule.DepType = "msvc"; - rule.DepFile.clear(); - flags += " /showIncludes"; } else if (mf->IsOn(cmStrCat("CMAKE_NINJA_CMCLDEPS_", lang))) { // For the MS resource compiler we need cmcldeps, but skip dependencies // for source-file try_compile cases because they are always fresh. @@ -746,16 +718,23 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, "\" \"", cl, "\" "); } } else { - rule.DepType = "gcc"; - rule.DepFile = "$DEP_FILE"; + const auto& depType = this->GetMakefile()->GetSafeDefinition( + cmStrCat("CMAKE_", lang, "_DEPFILE_FORMAT")); + if (depType == "msvc"_s) { + rule.DepType = "msvc"; + rule.DepFile.clear(); + } else { + rule.DepType = "gcc"; + rule.DepFile = "$DEP_FILE"; + } + vars.DependencyFile = rule.DepFile.c_str(); + vars.DependencyTarget = "$out"; + const std::string flagsName = cmStrCat("CMAKE_DEPFILE_FLAGS_", lang); std::string depfileFlags = mf->GetSafeDefinition(flagsName); if (!depfileFlags.empty()) { - cmSystemTools::ReplaceString(depfileFlags, "<DEP_FILE>", "$DEP_FILE"); - cmSystemTools::ReplaceString(depfileFlags, "<DEP_TARGET>", "$out"); - cmSystemTools::ReplaceString( - depfileFlags, "<CMAKE_C_COMPILER>", - cmToCStr(mf->GetDefinition("CMAKE_C_COMPILER"))); + rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(), + depfileFlags, vars); flags += cmStrCat(' ', depfileFlags); } } @@ -875,6 +854,14 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, compileCmds.front().insert(0, cldeps); } + const auto& extraCommands = this->GetMakefile()->GetSafeDefinition( + cmStrCat("CMAKE_", lang, "_DEPENDS_EXTRA_COMMANDS")); + if (!extraCommands.empty()) { + auto commandList = cmExpandedList(extraCommands); + compileCmds.insert(compileCmds.end(), commandList.cbegin(), + commandList.cend()); + } + for (std::string& i : compileCmds) { i = cmStrCat(launcher, i); rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(), i, @@ -1161,7 +1148,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( vars["DEFINES"] = this->ComputeDefines(source, language, config); vars["INCLUDES"] = this->ComputeIncludes(source, language, config); - if (!this->NeedDepTypeMSVC(language)) { + if (this->GetMakefile()->GetSafeDefinition( + cmStrCat("CMAKE_", language, "_DEPFILE_FORMAT")) != "msvc"_s) { bool replaceExt(false); if (!language.empty()) { std::string repVar = diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 4ba37ad..83a4342 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -42,8 +42,6 @@ public: std::string GetTargetName() const; - bool NeedDepTypeMSVC(const std::string& lang) const; - protected: bool SetMsvcTargetPdbVariable(cmNinjaVars&, const std::string& config) const; diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h index cb4d8da..1e38d84 100644 --- a/Source/cmTargetExport.h +++ b/Source/cmTargetExport.h @@ -31,4 +31,6 @@ public: cmInstallFilesGenerator* HeaderGenerator; std::string InterfaceIncludeDirectories; ///@} + + bool NamelinkOnly = false; }; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5524d4e..cfd724b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -846,6 +846,8 @@ void cmake::SetArgs(const std::vector<std::string>& args) bool haveToolset = false; bool havePlatform = false; bool haveBArg = false; + bool scriptMode = false; + std::string possibleUnknownArg; #if !defined(CMAKE_BOOTSTRAP) std::string profilingFormat; std::string profilingOutput; @@ -898,7 +900,11 @@ void cmake::SetArgs(const std::vector<std::string>& args) CommandArgument{ "-B", "No build directory specified for -B", CommandArgument::Values::One, BuildArgLambda }, CommandArgument{ "-P", "-P must be followed by a file name.", - CommandArgument::Values::One, IgnoreAndTrueLambda }, + CommandArgument::Values::One, + [&](std::string const&, cmake*) -> bool { + scriptMode = true; + return true; + } }, CommandArgument{ "-D", "-D must be followed with VAR=VALUE.", CommandArgument::Values::One, IgnoreAndTrueLambda }, CommandArgument{ "-C", "-C must be followed by a file name.", @@ -1145,14 +1151,28 @@ void cmake::SetArgs(const std::vector<std::string>& args) break; } } + + // We have an issue where arguments to a "-P" script mode + // can be provided before the "-P" argument. This means + // that we need to lazily check this argument after checking + // all args. + // Additionally it can't be the source/binary tree location if (!parsedCorrectly) { cmSystemTools::Error("Run 'cmake --help' for all supported options."); exit(1); + } else if (!matched && cmHasLiteralPrefix(arg, "-")) { + possibleUnknownArg = arg; } else if (!matched) { this->SetDirectoriesFromFile(arg); } } + if (!possibleUnknownArg.empty() && !scriptMode) { + cmSystemTools::Error(cmStrCat("Unknown argument ", possibleUnknownArg)); + cmSystemTools::Error("Run 'cmake --help' for all supported options."); + exit(1); + } + // Empty instance, platform and toolset if only a generator is specified if (this->GlobalGenerator) { this->GeneratorInstance = ""; diff --git a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt index 97e2a10..b27da43 100644 --- a/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/BadCTestTestfile-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at CTestTestfile.cmake:[0-9]+ \(subdirs\): subdirs called with incorrect number of arguments + -Errors while running CTest$ +Errors while running CTest +Output from these tests are in: .*/Testing/Temporary/LastTest.log +Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.$ diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt index 7593783..a993ac6 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-ctest-stderr.txt @@ -1 +1,3 @@ -^Errors while running CTest$ +^Errors while running CTest +Output from these tests are in: .*/Testing/Temporary/LastTest.log +Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.$ diff --git a/Tests/RunCMake/CommandLine/InvalidArg1-result.txt b/Tests/RunCMake/CommandLine/InvalidArg1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/InvalidArg1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/InvalidArg1-stderr.txt b/Tests/RunCMake/CommandLine/InvalidArg1-stderr.txt new file mode 100644 index 0000000..6b825bb --- /dev/null +++ b/Tests/RunCMake/CommandLine/InvalidArg1-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Unknown argument -invalid +CMake Error: Run 'cmake --help' for all supported options.$ diff --git a/Tests/RunCMake/CommandLine/InvalidArg2-result.txt b/Tests/RunCMake/CommandLine/InvalidArg2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/InvalidArg2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/InvalidArg2-stderr.txt b/Tests/RunCMake/CommandLine/InvalidArg2-stderr.txt new file mode 100644 index 0000000..eb1488c --- /dev/null +++ b/Tests/RunCMake/CommandLine/InvalidArg2-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Unknown argument --invalid +CMake Error: Run 'cmake --help' for all supported options.$ diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index bb40c52..51754fc 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.1) include(RunCMake) run_cmake_command(NoArgs ${CMAKE_COMMAND}) +run_cmake_command(InvalidArg1 ${CMAKE_COMMAND} -invalid) +run_cmake_command(InvalidArg2 ${CMAKE_COMMAND} --invalid) run_cmake_command(Wizard ${CMAKE_COMMAND} -i) run_cmake_command(C-no-arg ${CMAKE_COMMAND} -B DummyBuildDir -C) run_cmake_command(C-no-file ${CMAKE_COMMAND} -B DummyBuildDir -C nosuchcachefile.txt) diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake index 95c8d5c..0e6020f 100644 --- a/Tests/RunCMake/export/RunCMakeTest.cmake +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -17,3 +17,4 @@ run_cmake(DependOnNotExport) run_cmake(DependOnDoubleExport) run_cmake(UnknownExport) run_cmake(NamelinkOnlyExport) +run_cmake(SeparateNamelinkExport) diff --git a/Tests/RunCMake/export/SeparateNamelinkExport.cmake b/Tests/RunCMake/export/SeparateNamelinkExport.cmake new file mode 100644 index 0000000..b006aea --- /dev/null +++ b/Tests/RunCMake/export/SeparateNamelinkExport.cmake @@ -0,0 +1,16 @@ +enable_language(CXX) +add_library(foo SHARED empty.cpp) +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY + DESTINATION lib + COMPONENT runtime + NAMELINK_SKIP +) +install(TARGETS foo EXPORT fooExport + LIBRARY + DESTINATION lib + COMPONENT development + NAMELINK_ONLY +) +export(EXPORT fooExport FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") diff --git a/Tests/RunCMake/install/EXPORT-SeparateNamelink.cmake b/Tests/RunCMake/install/EXPORT-SeparateNamelink.cmake new file mode 100644 index 0000000..5c6fa10 --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-SeparateNamelink.cmake @@ -0,0 +1,19 @@ +enable_language(C) +add_library(foo SHARED empty.c) +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY + DESTINATION lib + COMPONENT runtime + NAMELINK_SKIP +) +install(TARGETS foo EXPORT fooExport + LIBRARY + DESTINATION lib + COMPONENT development + NAMELINK_ONLY +) +install(EXPORT fooExport + DESTINATION "lib/cmake/" + FILE "foo.cmake" +) diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 5aab88c..d64d88b 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -78,6 +78,7 @@ run_cmake(TARGETS-DESTINATION-bad) run_cmake(EXPORT-OldIFace) run_cmake(EXPORT-UnknownExport) run_cmake(EXPORT-NamelinkOnly) +run_cmake(EXPORT-SeparateNamelink) run_cmake(CMP0062-OLD) run_cmake(CMP0062-NEW) run_cmake(CMP0062-WARN) |