diff options
73 files changed, 566 insertions, 228 deletions
diff --git a/Help/release/dev/GNUInstallDirs-function.rst b/Help/release/dev/GNUInstallDirs-function.rst new file mode 100644 index 0000000..65ea7fb --- /dev/null +++ b/Help/release/dev/GNUInstallDirs-function.rst @@ -0,0 +1,5 @@ +GNUInstallDirs-function +----------------------- + +* The :module:`GNUInstallDirs` module gained a new + :command:`GNUInstallDirs_get_absolute_install_dir` command. diff --git a/Help/release/dev/cpack-deb-package-description-fallback.rst b/Help/release/dev/cpack-deb-package-description-fallback.rst new file mode 100644 index 0000000..71ca821 --- /dev/null +++ b/Help/release/dev/cpack-deb-package-description-fallback.rst @@ -0,0 +1,15 @@ +cpack-deb-package-description-fallback +-------------------------------------- + +* The :module:`CPackDeb` module gained a new + :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DESCRIPTION` + variable for component-specific package descriptions. + +* The :module:`CPackDeb` module changed its package description + override rules to match :module:`CPackRPM` module behavior. + If the :variable:`CPACK_PACKAGE_DESCRIPTION_FILE` variable is set to + a non-default location then it is preferred to the + :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` variable. + This is a behavior change from previous versions but produces + more consistent and expected behavior. + See :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION`. diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 1a7b923..423bb00 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -156,16 +156,18 @@ # * Default : :code:`CPACK_PACKAGE_CONTACT` # # .. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION -# CPACK_COMPONENT_<COMPONENT>_DESCRIPTION +# CPACK_DEBIAN_<COMPONENT>_PACKAGE_DESCRIPTION # # The Debian package description # # * Mandatory : YES # * Default : # -# - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` if set or -# - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` -# +# - :variable:`CPACK_COMPONENT_<compName>_DESCRIPTION` (component based installers only) if set, +# - :variable:`CPACK_PACKAGE_DESCRIPTION_FILE` if set to non default location, +# - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` if set, +# - :variable:`CPACK_PACKAGE_DESCRIPTION_FILE` default value if set, +# - or "no package description available" # # .. variable:: CPACK_DEBIAN_PACKAGE_SECTION # CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION @@ -829,24 +831,23 @@ function(cpack_deb_prepare_package_vars) endif() # Description: (mandatory) - if(NOT CPACK_DEB_PACKAGE_COMPONENT) - if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) - if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) - message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION") - endif() - set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) + if(CPACK_DEB_PACKAGE_COMPONENT) + if(CPACK_DEBIAN_${_local_component_name}_PACKAGE_DESCRIPTION) + set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_DEBIAN_${_local_component_name}_PACKAGE_DESCRIPTION}") + elseif(CPACK_COMPONENT_${_local_component_name}_DESCRIPTION) + set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_COMPONENT_${_local_component_name}_DESCRIPTION}") endif() - else() - set(component_description_var CPACK_COMPONENT_${_local_component_name}_DESCRIPTION) - - # component description overrides package description - if(${component_description_var}) - set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${${component_description_var}}) - elseif(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) - if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) - message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION or ${component_description_var}") - endif() - set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) + endif() + + if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) + if(CPACK_PACKAGE_DESCRIPTION_FILE AND NOT "${CPACK_PACKAGE_DESCRIPTION_FILE}" STREQUAL "${CMAKE_ROOT}/Templates/CPack.GenericDescription.txt") + file(READ "${CPACK_PACKAGE_DESCRIPTION_FILE}" CPACK_DEBIAN_PACKAGE_DESCRIPTION) + elseif(CPACK_PACKAGE_DESCRIPTION_SUMMARY) + set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}") + elseif(CPACK_PACKAGE_DESCRIPTION_FILE) # use default package description file content + file(READ "${CPACK_PACKAGE_DESCRIPTION_FILE}" CPACK_DEBIAN_PACKAGE_DESCRIPTION) + else() + set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "no package description available") endif() endif() diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index a0bffe7..e7f8408 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -86,6 +86,10 @@ Module Functions in one of the paths specified in the ``ExternalData_OBJECT_STORES`` variable. + Typically only one target is needed to manage all external data within + a project. Call this function once at the end of configuration after + all data references have been processed. + Module Variables ^^^^^^^^^^^^^^^^ @@ -394,8 +398,14 @@ function(ExternalData_add_target target) set(files "") - # Set "_ExternalData_FILE_${file}" for each output file to avoid duplicate - # rules. Use local data first to prefer real files over content links. + # Set a "_ExternalData_FILE_${file}" variable for each output file to avoid + # duplicate entries within this target. Set a directory property of the same + # name to avoid repeating custom commands with the same output in this directory. + # Repeating custom commands with the same output across directories or across + # targets in the same directory may be a race, but this is likely okay because + # we use atomic replacement of output files. + # + # Use local data first to prefer real files over content links. # Custom commands to copy or link local data. get_property(data_local GLOBAL PROPERTY _ExternalData_${target}_LOCAL) @@ -405,16 +415,20 @@ function(ExternalData_add_target target) list(GET tuple 1 name) if(NOT DEFINED "_ExternalData_FILE_${file}") set("_ExternalData_FILE_${file}" 1) - add_custom_command( - COMMENT "Generating ${file}" - OUTPUT "${file}" - COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR} - -Dfile=${file} -Dname=${name} - -DExternalData_ACTION=local - -DExternalData_CONFIG=${config} - -P ${_ExternalData_SELF} - MAIN_DEPENDENCY "${name}" - ) + get_property(added DIRECTORY PROPERTY "_ExternalData_FILE_${file}") + if(NOT added) + set_property(DIRECTORY PROPERTY "_ExternalData_FILE_${file}" 1) + add_custom_command( + COMMENT "Generating ${file}" + OUTPUT "${file}" + COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR} + -Dfile=${file} -Dname=${name} + -DExternalData_ACTION=local + -DExternalData_CONFIG=${config} + -P ${_ExternalData_SELF} + MAIN_DEPENDENCY "${name}" + ) + endif() list(APPEND files "${file}") endif() endforeach() @@ -429,23 +443,27 @@ function(ExternalData_add_target target) set(stamp "${ext}-stamp") if(NOT DEFINED "_ExternalData_FILE_${file}") set("_ExternalData_FILE_${file}" 1) - add_custom_command( - # Users care about the data file, so hide the hash/timestamp file. - COMMENT "Generating ${file}" - # The hash/timestamp file is the output from the build perspective. - # List the real file as a second output in case it is a broken link. - # The files must be listed in this order so CMake can hide from the - # make tool that a symlink target may not be newer than the input. - OUTPUT "${file}${stamp}" "${file}" - # Run the data fetch/update script. - COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR} - -Dfile=${file} -Dname=${name} -Dext=${ext} - -DExternalData_ACTION=fetch - -DExternalData_CONFIG=${config} - -P ${_ExternalData_SELF} - # Update whenever the object hash changes. - MAIN_DEPENDENCY "${name}${ext}" - ) + get_property(added DIRECTORY PROPERTY "_ExternalData_FILE_${file}") + if(NOT added) + set_property(DIRECTORY PROPERTY "_ExternalData_FILE_${file}" 1) + add_custom_command( + # Users care about the data file, so hide the hash/timestamp file. + COMMENT "Generating ${file}" + # The hash/timestamp file is the output from the build perspective. + # List the real file as a second output in case it is a broken link. + # The files must be listed in this order so CMake can hide from the + # make tool that a symlink target may not be newer than the input. + OUTPUT "${file}${stamp}" "${file}" + # Run the data fetch/update script. + COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR} + -Dfile=${file} -Dname=${name} -Dext=${ext} + -DExternalData_ACTION=fetch + -DExternalData_CONFIG=${config} + -P ${_ExternalData_SELF} + # Update whenever the object hash changes. + MAIN_DEPENDENCY "${name}${ext}" + ) + endif() list(APPEND files "${file}${stamp}") endif() endforeach() diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 9f96fe6..b501599 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -1030,13 +1030,17 @@ function(_Matlab_get_version_from_root matlab_root matlab_known_version matlab_f set(matlab_list_of_all_versions) matlab_get_version_from_matlab_run("${Matlab_PROG_VERSION_STRING_AUTO_DETECT}" matlab_list_of_all_versions) - list(GET matlab_list_of_all_versions 0 _matlab_version_tmp) + list(LENGTH matlab_list_of_all_versions list_of_all_versions_length) + if(${list_of_all_versions_length} GREATER 0) + list(GET matlab_list_of_all_versions 0 _matlab_version_tmp) + else() + set(_matlab_version_tmp "") + endif() # set the version into the cache set(Matlab_VERSION_STRING_INTERNAL ${_matlab_version_tmp} CACHE INTERNAL "Matlab version (automatically determined)" FORCE) # warning, just in case several versions found (should not happen) - list(LENGTH matlab_list_of_all_versions list_of_all_versions_length) if((${list_of_all_versions_length} GREATER 1) AND MATLAB_FIND_DEBUG) message(WARNING "[MATLAB] Found several versions, taking the first one (versions found ${matlab_list_of_all_versions})") endif() diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index b42084e..0c80b8a 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -99,6 +99,23 @@ # `Filesystem Hierarchy Standard`_. # # .. _`Filesystem Hierarchy Standard`: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html +# +# Macros +# ^^^^^^ +# +# .. command:: GNUInstallDirs_get_absolute_install_dir +# +# :: +# +# GNUInstallDirs_get_absolute_install_dir(absvar var) +# +# Set the given variable ``absvar`` to the absolute path contained +# within the variable ``var``. This is to allow the computation of an +# absolute path, accounting for all the special cases documented +# above. While this macro is used to compute the various +# ``CMAKE_INSTALL_FULL_<dir>`` variables, it is exposed publicly to +# allow users who create additional path variables to also compute +# absolute paths where necessary, using the same logic. #============================================================================= # Copyright 2015 Alex Turbov <i.zaufi@gmail.com> @@ -300,55 +317,59 @@ mark_as_advanced( CMAKE_INSTALL_DOCDIR ) -# Result directories -# -foreach(dir - BINDIR - SBINDIR - LIBEXECDIR - SYSCONFDIR - SHAREDSTATEDIR - LOCALSTATEDIR - LIBDIR - INCLUDEDIR - OLDINCLUDEDIR - DATAROOTDIR - DATADIR - INFODIR - LOCALEDIR - MANDIR - DOCDIR - ) - if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_${dir}}") +macro(GNUInstallDirs_get_absolute_install_dir absvar var) + if(NOT IS_ABSOLUTE "${${var}}") # Handle special cases: # - CMAKE_INSTALL_PREFIX == / # - CMAKE_INSTALL_PREFIX == /usr # - CMAKE_INSTALL_PREFIX == /opt/... if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/") if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR") - set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}") + set(${absvar} "/${${var}}") else() - if (NOT "${CMAKE_INSTALL_${dir}}" MATCHES "^usr/") - set(CMAKE_INSTALL_${dir} "usr/${CMAKE_INSTALL_${dir}}") + if (NOT "${${var}}" MATCHES "^usr/") + set(${var} "usr/${${var}}") endif() - set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}") + set(${absvar} "/${${var}}") endif() elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR") - set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}") + set(${absvar} "/${${var}}") else() - set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}") endif() elseif("${CMAKE_INSTALL_PREFIX}" MATCHES "^/opt/.*") if("${dir}" STREQUAL "SYSCONFDIR" OR "${dir}" STREQUAL "LOCALSTATEDIR") - set(CMAKE_INSTALL_FULL_${dir} "/${CMAKE_INSTALL_${dir}}${CMAKE_INSTALL_PREFIX}") + set(${absvar} "/${${var}}${CMAKE_INSTALL_PREFIX}") else() - set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}") endif() else() - set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + set(${absvar} "${CMAKE_INSTALL_PREFIX}/${${var}}") endif() else() - set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}") + set(${absvar} "${${var}}") endif() +endmacro() + +# Result directories +# +foreach(dir + BINDIR + SBINDIR + LIBEXECDIR + SYSCONFDIR + SHAREDSTATEDIR + LOCALSTATEDIR + LIBDIR + INCLUDEDIR + OLDINCLUDEDIR + DATAROOTDIR + DATADIR + INFODIR + LOCALEDIR + MANDIR + DOCDIR + ) + GNUInstallDirs_get_absolute_install_dir(CMAKE_INSTALL_FULL_${dir} CMAKE_INSTALL_${dir}) endforeach() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index fb13b21..74f34b2 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160906) +set(CMake_VERSION_PATCH 20160908) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 4a5eb90..a6f1585 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -12,21 +12,20 @@ #include "cmCPackIFWGenerator.h" -#include <CPack/cmCPackComponentGroup.h> -#include <CPack/cmCPackLog.h> - -#include <cmsys/Directory.hxx> -#include <cmsys/Glob.hxx> -#include <cmsys/RegularExpression.hxx> -#include <cmsys/SystemTools.hxx> - -#include <cmGeneratedFileStream.h> -#include <cmGlobalGenerator.h> -#include <cmMakefile.h> -#include <cmSystemTools.h> -#include <cmTimestamp.h> -#include <cmVersionConfig.h> -#include <cmXMLWriter.h> +#include "CPack/cmCPackComponentGroup.h" +#include "CPack/cmCPackGenerator.h" +#include "CPack/cmCPackLog.h" +#include "cmCPackIFWInstaller.h" +#include "cmCPackIFWPackage.h" +#include "cmCPackIFWRepository.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmTimestamp.h" +#include "cmVersionConfig.h" +#include "cmXMLWriter.h" + +#include <sstream> +#include <utility> cmCPackIFWGenerator::cmCPackIFWGenerator() { diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h index 12f2ca6..17d61bf 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.h +++ b/Source/CPack/IFW/cmCPackIFWGenerator.h @@ -13,11 +13,19 @@ #ifndef cmCPackIFWGenerator_h #define cmCPackIFWGenerator_h -#include <CPack/cmCPackGenerator.h> +#include <cmConfigure.h> +#include "CPack/cmCPackComponentGroup.h" +#include "CPack/cmCPackGenerator.h" #include "cmCPackIFWInstaller.h" #include "cmCPackIFWPackage.h" #include "cmCPackIFWRepository.h" +#include "cmTypeMacro.h" + +#include <map> +#include <set> +#include <string> +#include <vector> class cmXMLWriter; diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 13a3613..5a3efc9 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -12,12 +12,16 @@ #include "cmCPackIFWInstaller.h" +#include "CPack/cmCPackGenerator.h" #include "cmCPackIFWGenerator.h" - -#include <CPack/cmCPackLog.h> - -#include <cmGeneratedFileStream.h> -#include <cmXMLWriter.h> +#include "cmCPackIFWPackage.h" +#include "cmCPackIFWRepository.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmXMLWriter.h" + +#include <cmConfigure.h> +#include <utility> #ifdef cmCPackLogger #undef cmCPackLogger diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h index 3170116..f72d379 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.h +++ b/Source/CPack/IFW/cmCPackIFWInstaller.h @@ -13,10 +13,14 @@ #ifndef cmCPackIFWInstaller_h #define cmCPackIFWInstaller_h -#include <cmStandardIncludes.h> +#include <cmConfigure.h> // IWYU pragma: keep + +#include <map> +#include <string> +#include <vector> -class cmCPackIFWPackage; class cmCPackIFWGenerator; +class cmCPackIFWPackage; class cmCPackIFWRepository; class cmXMLWriter; diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 5db06e6..bc503fc 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -12,13 +12,20 @@ #include "cmCPackIFWPackage.h" +#include "CPack/cmCPackComponentGroup.h" +#include "CPack/cmCPackGenerator.h" +#include "CPack/cmCPackLog.h" #include "cmCPackIFWGenerator.h" - -#include <CPack/cmCPackLog.h> - -#include <cmGeneratedFileStream.h> -#include <cmTimestamp.h> -#include <cmXMLWriter.h> +#include "cmCPackIFWInstaller.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmTimestamp.h" +#include "cmXMLWriter.h" + +#include <cmConfigure.h> +#include <map> +#include <sstream> +#include <stddef.h> //----------------------------------------------------------------- Logger --- #ifdef cmCPackLogger diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h index 55b07ec..579eeb8 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.h +++ b/Source/CPack/IFW/cmCPackIFWPackage.h @@ -13,12 +13,16 @@ #ifndef cmCPackIFWPackage_h #define cmCPackIFWPackage_h -#include <cmStandardIncludes.h> +#include <cmConfigure.h> // IWYU pragma: keep + +#include <set> +#include <string> +#include <vector> class cmCPackComponent; class cmCPackComponentGroup; -class cmCPackIFWInstaller; class cmCPackIFWGenerator; +class cmCPackIFWInstaller; class cmXMLWriter; /** \class cmCPackIFWPackage diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index fcb1c77..947e420 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -12,13 +12,15 @@ #include "cmCPackIFWRepository.h" +#include "CPack/cmCPackGenerator.h" #include "cmCPackIFWGenerator.h" +#include "cmGeneratedFileStream.h" +#include "cmSystemTools.h" +#include "cmXMLParser.h" +#include "cmXMLWriter.h" -#include <CPack/cmCPackLog.h> - -#include <cmGeneratedFileStream.h> -#include <cmXMLParser.h> -#include <cmXMLWriter.h> +#include <cmConfigure.h> +#include <stddef.h> #ifdef cmCPackLogger #undef cmCPackLogger diff --git a/Source/CPack/IFW/cmCPackIFWRepository.h b/Source/CPack/IFW/cmCPackIFWRepository.h index 5ffb775..a0c535b 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.h +++ b/Source/CPack/IFW/cmCPackIFWRepository.h @@ -13,7 +13,10 @@ #ifndef cmCPackIFWRepository_h #define cmCPackIFWRepository_h -#include <cmStandardIncludes.h> +#include <cmConfigure.h> // IWYU pragma: keep + +#include <string> +#include <vector> class cmCPackIFWGenerator; class cmXMLWriter; diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index d7f69a1..85e0ae3 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -35,6 +35,7 @@ cmCPackWIXGenerator::cmCPackWIXGenerator() : Patch(0) + , ComponentGuidType(cmWIXSourceWriter::WIX_GENERATED_GUID) { } @@ -234,6 +235,12 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration() } } + // if install folder is supposed to be set absolutely, the default + // component guid "*" cannot be used + if (cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"))) { + this->ComponentGuidType = cmWIXSourceWriter::CMAKE_GENERATED_GUID; + } + return true; } @@ -317,7 +324,9 @@ void cmCPackWIXGenerator::CreateWiXVariablesIncludeFile() { std::string includeFilename = this->CPackTopLevel + "/cpack_variables.wxi"; - cmWIXSourceWriter includeFile(this->Logger, includeFilename, true); + cmWIXSourceWriter includeFile(this->Logger, includeFilename, + this->ComponentGuidType, + cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT); CopyDefinition(includeFile, "CPACK_WIX_PRODUCT_GUID"); CopyDefinition(includeFile, "CPACK_WIX_UPGRADE_GUID"); @@ -338,7 +347,9 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile() { std::string includeFilename = this->CPackTopLevel + "/properties.wxi"; - cmWIXSourceWriter includeFile(this->Logger, includeFilename, true); + cmWIXSourceWriter includeFile(this->Logger, includeFilename, + this->ComponentGuidType, + cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT); std::string prefix = "CPACK_WIX_PROPERTY_"; std::vector<std::string> options = GetOptions(); @@ -386,7 +397,9 @@ void cmCPackWIXGenerator::CreateWiXProductFragmentIncludeFile() { std::string includeFilename = this->CPackTopLevel + "/product_fragment.wxi"; - cmWIXSourceWriter includeFile(this->Logger, includeFilename, true); + cmWIXSourceWriter includeFile(this->Logger, includeFilename, + this->ComponentGuidType, + cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT); this->Patch->ApplyFragment("#PRODUCT", includeFile); } @@ -413,13 +426,15 @@ void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source, bool cmCPackWIXGenerator::CreateWiXSourceFiles() { + // if install folder is supposed to be set absolutely, the default + // component guid "*" cannot be used std::string directoryDefinitionsFilename = this->CPackTopLevel + "/directories.wxs"; this->WixSources.push_back(directoryDefinitionsFilename); cmWIXDirectoriesSourceWriter directoryDefinitions( - this->Logger, directoryDefinitionsFilename); + this->Logger, directoryDefinitionsFilename, this->ComponentGuidType); directoryDefinitions.BeginElement("Fragment"); std::string installRoot; @@ -439,13 +454,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() this->WixSources.push_back(fileDefinitionsFilename); - cmWIXFilesSourceWriter fileDefinitions(this->Logger, - fileDefinitionsFilename); - - // if install folder is supposed to be set absolutely, the default - // component guid "*" cannot be used - fileDefinitions.GenerateComponentGuids = - cmSystemTools::IsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER")); + cmWIXFilesSourceWriter fileDefinitions(this->Logger, fileDefinitionsFilename, + this->ComponentGuidType); fileDefinitions.BeginElement("Fragment"); @@ -454,8 +464,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles() this->WixSources.push_back(featureDefinitionsFilename); - cmWIXFeaturesSourceWriter featureDefinitions(this->Logger, - featureDefinitionsFilename); + cmWIXFeaturesSourceWriter featureDefinitions( + this->Logger, featureDefinitionsFilename, this->ComponentGuidType); featureDefinitions.BeginElement("Fragment"); @@ -764,7 +774,8 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType( fileDefinitions.BeginElement("Component"); fileDefinitions.AddAttribute("Id", componentId); - fileDefinitions.AddAttribute("Guid", "*"); + fileDefinitions.AddAttribute( + "Guid", fileDefinitions.CreateGuidFromComponentId(componentId)); this->Patch->ApplyFragment(componentId, fileDefinitions); diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index 9d3a522..883df9a 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -162,6 +162,8 @@ private: std::string CPackTopLevel; cmWIXPatch* Patch; + + cmWIXSourceWriter::GuidType ComponentGuidType; }; #endif diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx index 97e3a51..9704195 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx @@ -13,8 +13,8 @@ #include "cmWIXDirectoriesSourceWriter.h" cmWIXDirectoriesSourceWriter::cmWIXDirectoriesSourceWriter( - cmCPackLog* logger, std::string const& filename) - : cmWIXSourceWriter(logger, filename) + cmCPackLog* logger, std::string const& filename, GuidType componentGuidType) + : cmWIXSourceWriter(logger, filename, componentGuidType) { } diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h index 023f4b8..6ebe281 100644 --- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h @@ -25,8 +25,8 @@ class cmWIXDirectoriesSourceWriter : public cmWIXSourceWriter { public: - cmWIXDirectoriesSourceWriter(cmCPackLog* logger, - std::string const& filename); + cmWIXDirectoriesSourceWriter(cmCPackLog* logger, std::string const& filename, + GuidType componentGuidType); void EmitStartMenuFolder(std::string const& startMenuFolder); diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx index 1747b62..7794935 100644 --- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx @@ -13,8 +13,8 @@ #include "cmWIXFeaturesSourceWriter.h" cmWIXFeaturesSourceWriter::cmWIXFeaturesSourceWriter( - cmCPackLog* logger, std::string const& filename) - : cmWIXSourceWriter(logger, filename) + cmCPackLog* logger, std::string const& filename, GuidType componentGuidType) + : cmWIXSourceWriter(logger, filename, componentGuidType) { } @@ -24,7 +24,7 @@ void cmWIXFeaturesSourceWriter::CreateCMakePackageRegistryEntry( BeginElement("Component"); AddAttribute("Id", "CM_PACKAGE_REGISTRY"); AddAttribute("Directory", "TARGETDIR"); - AddAttribute("Guid", "*"); + AddAttribute("Guid", CreateGuidFromComponentId("CM_PACKAGE_REGISTRY")); std::string registryKey = std::string("Software\\Kitware\\CMake\\Packages\\") + package; diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h index ee9c17a..9974b63 100644 --- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h @@ -23,7 +23,8 @@ class cmWIXFeaturesSourceWriter : public cmWIXSourceWriter { public: - cmWIXFeaturesSourceWriter(cmCPackLog* logger, std::string const& filename); + cmWIXFeaturesSourceWriter(cmCPackLog* logger, std::string const& filename, + GuidType componentGuidType); void CreateCMakePackageRegistryEntry(std::string const& package, std::string const& upgradeGuid); diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index dde9635..846edde 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -24,9 +24,9 @@ #include <sys/stat.h> cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger, - std::string const& filename) - : cmWIXSourceWriter(logger, filename) - , GenerateComponentGuids(false) + std::string const& filename, + GuidType componentGuidType) + : cmWIXSourceWriter(logger, filename, componentGuidType) { } @@ -130,13 +130,7 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile( std::string componentId = std::string("CM_C") + id; std::string fileId = std::string("CM_F") + id; - std::string guid = "*"; - if (this->GenerateComponentGuids) { - std::string md5 = cmSystemTools::ComputeStringMD5(componentId); - cmUuid uuid; - std::vector<unsigned char> ns; - guid = uuid.FromMd5(ns, md5); - } + std::string guid = CreateGuidFromComponentId(componentId); BeginElement("DirectoryRef"); AddAttribute("Id", directoryId); diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h index eeb84cb..c1952af 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h @@ -26,7 +26,8 @@ class cmWIXFilesSourceWriter : public cmWIXSourceWriter { public: - cmWIXFilesSourceWriter(cmCPackLog* logger, std::string const& filename); + cmWIXFilesSourceWriter(cmCPackLog* logger, std::string const& filename, + GuidType componentGuidType); void EmitShortcut(std::string const& id, cmWIXShortcut const& shortcut, std::string const& shortcutPrefix, size_t shortcutIndex); @@ -47,8 +48,6 @@ public: std::string const& id, std::string const& filePath, cmWIXPatch& patch, cmInstalledFile const* installedFile); - - bool GenerateComponentGuids; }; #endif diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx index 2c0384e..a287424 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx @@ -14,19 +14,23 @@ #include <CPack/cmCPackGenerator.h> +#include <cmUuid.h> + #include <windows.h> cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger, std::string const& filename, - bool isIncludeFile) + GuidType componentGuidType, + RootElementType rootElementType) : Logger(logger) , File(filename.c_str()) , State(DEFAULT) , SourceFilename(filename) + , ComponentGuidType(componentGuidType) { WriteXMLDeclaration(); - if (isIncludeFile) { + if (rootElementType == INCLUDE_ELEMENT_ROOT) { BeginElement("Include"); } else { BeginElement("Wix"); @@ -173,6 +177,19 @@ std::string cmWIXSourceWriter::CMakeEncodingToUtf8(std::string const& value) #endif } +std::string cmWIXSourceWriter::CreateGuidFromComponentId( + std::string const& componentId) +{ + std::string guid = "*"; + if (this->ComponentGuidType == CMAKE_GENERATED_GUID) { + std::string md5 = cmSystemTools::ComputeStringMD5(componentId); + cmUuid uuid; + std::vector<unsigned char> ns; + guid = uuid.FromMd5(ns, md5); + } + return guid; +} + void cmWIXSourceWriter::WriteXMLDeclaration() { File << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl; diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h index 4efc026..c29ffa7 100644 --- a/Source/CPack/WiX/cmWIXSourceWriter.h +++ b/Source/CPack/WiX/cmWIXSourceWriter.h @@ -26,8 +26,21 @@ class cmWIXSourceWriter { public: + enum GuidType + { + WIX_GENERATED_GUID, + CMAKE_GENERATED_GUID + }; + + enum RootElementType + { + WIX_ELEMENT_ROOT, + INCLUDE_ELEMENT_ROOT + }; + cmWIXSourceWriter(cmCPackLog* logger, std::string const& filename, - bool isIncludeFile = false); + GuidType componentGuidType, + RootElementType rootElementType = WIX_ELEMENT_ROOT); ~cmWIXSourceWriter(); @@ -45,6 +58,8 @@ public: void AddAttributeUnlessEmpty(std::string const& key, std::string const& value); + std::string CreateGuidFromComponentId(std::string const& componentId); + static std::string CMakeEncodingToUtf8(std::string const& value); protected: @@ -70,6 +85,8 @@ private: std::vector<std::string> Elements; std::string SourceFilename; + + GuidType ComponentGuidType; }; #endif diff --git a/Source/CPack/cmCPack7zGenerator.cxx b/Source/CPack/cmCPack7zGenerator.cxx index b01c216..39d2e54 100644 --- a/Source/CPack/cmCPack7zGenerator.cxx +++ b/Source/CPack/cmCPack7zGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPack7zGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPack7zGenerator::cmCPack7zGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "7zip") { diff --git a/Source/CPack/cmCPack7zGenerator.h b/Source/CPack/cmCPack7zGenerator.h index ddbcc34..94add69 100644 --- a/Source/CPack/cmCPack7zGenerator.h +++ b/Source/CPack/cmCPack7zGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPack7zGenerator_h #define cmCPack7zGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPack7zGenerator * \brief A generator for 7z files diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 377fee1..ddf2ccb 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -12,17 +12,16 @@ #include "cmCPackArchiveGenerator.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" -#include "cmGlobalGenerator.h" -#include "cmMakefile.h" #include "cmSystemTools.h" -#include "cmake.h" -#include <errno.h> -#include <cm_libarchive.h> -#include <cmsys/Directory.hxx> -#include <cmsys/SystemTools.hxx> +#include <map> +#include <ostream> +#include <utility> +#include <vector> cmCPackArchiveGenerator::cmCPackArchiveGenerator(cmArchiveWrite::Compress t, std::string const& format) diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h index a018ebd..6db6fb0 100644 --- a/Source/CPack/cmCPackArchiveGenerator.h +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -13,9 +13,16 @@ #ifndef cmCPackArchiveGenerator_h #define cmCPackArchiveGenerator_h -#include "cmCPackGenerator.h" +#include <cmConfigure.h> #include "cmArchiveWrite.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" + +#include <iosfwd> +#include <string> + +class cmCPackComponent; /** \class cmCPackArchiveGenerator * \brief A generator base for libarchive generation. diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index 78b81b3..8e9218e 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -15,7 +15,8 @@ #include <cmConfigure.h> -#include "cmStandardIncludes.h" +#include <string> +#include <vector> class cmCPackComponentGroup; diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index b909598..2e18265 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -13,16 +13,21 @@ #include "cmCPackDebGenerator.h" #include "cmArchiveWrite.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" -#include "cmMakefile.h" #include "cmSystemTools.h" #include <cmsys/Glob.hxx> -#include <cmsys/SystemTools.hxx> - -#include <limits.h> // USHRT_MAX +#include <limits.h> +#include <map> +#include <ostream> +#include <set> +#include <stdio.h> +#include <string.h> #include <sys/stat.h> +#include <utility> // NOTE: // A debian package .deb is simply an 'ar' archive. The only subtle difference @@ -743,14 +748,6 @@ std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix( * SUCH DAMAGE. */ -#include <sys/types.h> -// include sys/stat.h after sys/types.h -#include <sys/stat.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - #define ARMAG "!<arch>\n" /* ar "magic number" */ #define SARMAG 8 /* strlen(ARMAG); */ diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h index bcdc509..c76bf99 100644 --- a/Source/CPack/cmCPackDebGenerator.h +++ b/Source/CPack/cmCPackDebGenerator.h @@ -13,7 +13,13 @@ #ifndef cmCPackDebGenerator_h #define cmCPackDebGenerator_h +#include <cmConfigure.h> + #include "cmCPackGenerator.h" +#include "cmTypeMacro.h" + +#include <string> +#include <vector> /** \class cmCPackDebGenerator * \brief A generator for Debian packages diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 96c218c..d6b58f2 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -17,14 +17,17 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmXMLSafe.h" +#include "cm_auto_ptr.hxx" #include "cmake.h" #include <algorithm> #include <cmsys/FStream.hxx> #include <cmsys/Glob.hxx> -#include <cmsys/SystemTools.hxx> +#include <cmsys/RegularExpression.hxx> #include <list> +#include <utility> #if defined(__HAIKU__) #include <FindDirectory.h> diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 23e4bb7..f89f349 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -13,15 +13,21 @@ #ifndef cmCPackGenerator_h #define cmCPackGenerator_h -#include "cmObject.h" +#include <cmConfigure.h> +#include "cmCPackComponentGroup.h" +#include "cmObject.h" #include "cmSystemTools.h" +#include "cmTypeMacro.h" + #include <map> +#include <sstream> +#include <string> #include <vector> -#include "cmCPackComponentGroup.h" // cmCPackComponent and friends -// Forward declarations are insufficient since we use them in -// std::map data members below... +class cmCPackLog; +class cmInstalledFile; +class cmMakefile; #define cmCPackTypeMacro(klass, superclass) \ cmTypeMacro(klass, superclass); \ @@ -46,10 +52,6 @@ #endif #define cout no_cout_use_cmCPack_Log -class cmMakefile; -class cmCPackLog; -class cmInstalledFile; - /** \class cmCPackGenerator * \brief A superclass of all CPack Generators * diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index 0f0268f..fb84739 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -49,6 +49,9 @@ #include "cmAlgorithms.h" #include "cmCPackLog.h" +#include <ostream> +#include <utility> + cmCPackGeneratorFactory::cmCPackGeneratorFactory() { if (cmCPackTGZGenerator::CanGenerate()) { diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h index f0ed57a..4c07ea3 100644 --- a/Source/CPack/cmCPackGeneratorFactory.h +++ b/Source/CPack/cmCPackGeneratorFactory.h @@ -13,10 +13,17 @@ #ifndef cmCPackGeneratorFactory_h #define cmCPackGeneratorFactory_h +#include <cmConfigure.h> + #include "cmObject.h" +#include "cmTypeMacro.h" + +#include <map> +#include <string> +#include <vector> -class cmCPackLog; class cmCPackGenerator; +class cmCPackLog; /** \class cmCPackGeneratorFactory * \brief A container for CPack generators diff --git a/Source/CPack/cmCPackLog.cxx b/Source/CPack/cmCPackLog.cxx index 339323e..8439de1 100644 --- a/Source/CPack/cmCPackLog.cxx +++ b/Source/CPack/cmCPackLog.cxx @@ -15,6 +15,8 @@ #include "cmGeneratedFileStream.h" #include "cmSystemTools.h" +#include <iostream> + cmCPackLog::cmCPackLog() { this->Verbose = false; diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h index 77f0f0b..c1bf82c 100644 --- a/Source/CPack/cmCPackLog.h +++ b/Source/CPack/cmCPackLog.h @@ -13,7 +13,14 @@ #ifndef cmCPackLog_h #define cmCPackLog_h +#include <cmConfigure.h> + #include "cmObject.h" +#include "cmTypeMacro.h" + +#include <ostream> +#include <string.h> +#include <string> #define cmCPack_Log(ctSelf, logType, msg) \ do { \ diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index d8ff907..2db94f1 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -13,16 +13,19 @@ #include "cmCPackNSISGenerator.h" #include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmGeneratedFileStream.h" -#include "cmGlobalGenerator.h" -#include "cmMakefile.h" #include "cmSystemTools.h" +#include <algorithm> #include <cmsys/Directory.hxx> -#include <cmsys/Glob.hxx> #include <cmsys/RegularExpression.hxx> -#include <cmsys/SystemTools.hxx> +#include <map> +#include <sstream> +#include <stdlib.h> +#include <string.h> +#include <utility> /* NSIS uses different command line syntax on Windows and others */ #ifdef _WIN32 diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h index 4923cf0..ae03e6b 100644 --- a/Source/CPack/cmCPackNSISGenerator.h +++ b/Source/CPack/cmCPackNSISGenerator.h @@ -13,9 +13,18 @@ #ifndef cmCPackNSISGenerator_h #define cmCPackNSISGenerator_h +#include <cmConfigure.h> + #include "cmCPackGenerator.h" +#include "cmTypeMacro.h" +#include <iosfwd> #include <set> +#include <string> +#include <vector> + +class cmCPackComponent; +class cmCPackComponentGroup; /** \class cmCPackNSISGenerator * \brief A generator for NSIS files diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 5d81a49..0f2e9b9 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -11,9 +11,17 @@ ============================================================================*/ #include "cmCPackRPMGenerator.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmSystemTools.h" +#include <algorithm> +#include <map> +#include <ostream> +#include <utility> +#include <vector> + cmCPackRPMGenerator::cmCPackRPMGenerator() { } diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h index 4baef08..10c5572 100644 --- a/Source/CPack/cmCPackRPMGenerator.h +++ b/Source/CPack/cmCPackRPMGenerator.h @@ -13,7 +13,12 @@ #ifndef cmCPackRPMGenerator_h #define cmCPackRPMGenerator_h +#include <cmConfigure.h> + #include "cmCPackGenerator.h" +#include "cmTypeMacro.h" + +#include <string> /** \class cmCPackRPMGenerator * \brief A generator for RPM packages diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx index 4d07a7e..4c33a08 100644 --- a/Source/CPack/cmCPackSTGZGenerator.cxx +++ b/Source/CPack/cmCPackSTGZGenerator.cxx @@ -12,13 +12,15 @@ #include "cmCPackSTGZGenerator.h" +#include "cmCPackGenerator.h" #include "cmCPackLog.h" -#include "cmGlobalGenerator.h" -#include "cmMakefile.h" #include "cmSystemTools.h" -#include "cmake.h" #include <cmsys/FStream.hxx> +#include <sstream> +#include <stdio.h> +#include <string> +#include <vector> #include <sys/types.h> // include sys/stat.h after sys/types.h diff --git a/Source/CPack/cmCPackSTGZGenerator.h b/Source/CPack/cmCPackSTGZGenerator.h index 94cc8aa..2a68f2c 100644 --- a/Source/CPack/cmCPackSTGZGenerator.h +++ b/Source/CPack/cmCPackSTGZGenerator.h @@ -13,7 +13,13 @@ #ifndef cmCPackSTGZGenerator_h #define cmCPackSTGZGenerator_h +#include <cmConfigure.h> + +#include "cmCPackGenerator.h" #include "cmCPackTGZGenerator.h" +#include "cmTypeMacro.h" + +#include <iosfwd> /** \class cmCPackSTGZGenerator * \brief A generator for Self extractable TGZ files diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx index 7c5c245..8df53a8 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTGZGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTGZGenerator::cmCPackTGZGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressGZip, "paxr") { diff --git a/Source/CPack/cmCPackTGZGenerator.h b/Source/CPack/cmCPackTGZGenerator.h index cb7620c..78cd109 100644 --- a/Source/CPack/cmCPackTGZGenerator.h +++ b/Source/CPack/cmCPackTGZGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTGZGenerator_h #define cmCPackTGZGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTGZGenerator * \brief A generator for TGZ files diff --git a/Source/CPack/cmCPackTXZGenerator.cxx b/Source/CPack/cmCPackTXZGenerator.cxx index d17a164..c708022 100644 --- a/Source/CPack/cmCPackTXZGenerator.cxx +++ b/Source/CPack/cmCPackTXZGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTXZGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTXZGenerator::cmCPackTXZGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ, "paxr") { diff --git a/Source/CPack/cmCPackTXZGenerator.h b/Source/CPack/cmCPackTXZGenerator.h index 87c92ef..6d6db74 100644 --- a/Source/CPack/cmCPackTXZGenerator.h +++ b/Source/CPack/cmCPackTXZGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTXZGenerator_h #define cmCPackTXZGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTXZGenerator * \brief A generator for TXZ files diff --git a/Source/CPack/cmCPackTarBZip2Generator.cxx b/Source/CPack/cmCPackTarBZip2Generator.cxx index 694d392..09bda8c 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.cxx +++ b/Source/CPack/cmCPackTarBZip2Generator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTarBZip2Generator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTarBZip2Generator::cmCPackTarBZip2Generator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressBZip2, "paxr") { diff --git a/Source/CPack/cmCPackTarBZip2Generator.h b/Source/CPack/cmCPackTarBZip2Generator.h index 6fec882..d7b7277 100644 --- a/Source/CPack/cmCPackTarBZip2Generator.h +++ b/Source/CPack/cmCPackTarBZip2Generator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTarBZip2Generator_h #define cmCPackTarBZip2Generator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTarBZip2Generator * \brief A generator for TarBZip2 files diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx index aec6893..a2b0b66 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.cxx +++ b/Source/CPack/cmCPackTarCompressGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackTarCompressGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackTarCompressGenerator::cmCPackTarCompressGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressCompress, "paxr") { diff --git a/Source/CPack/cmCPackTarCompressGenerator.h b/Source/CPack/cmCPackTarCompressGenerator.h index 02926a2..9213d81 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.h +++ b/Source/CPack/cmCPackTarCompressGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackTarCompressGenerator_h #define cmCPackTarCompressGenerator_h -#include "cmCPackTGZGenerator.h" +#include <cmConfigure.h> + +#include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackTarCompressGenerator * \brief A generator for TarCompress files diff --git a/Source/CPack/cmCPackZIPGenerator.cxx b/Source/CPack/cmCPackZIPGenerator.cxx index 9b42e6d..f2a2547 100644 --- a/Source/CPack/cmCPackZIPGenerator.cxx +++ b/Source/CPack/cmCPackZIPGenerator.cxx @@ -12,6 +12,9 @@ #include "cmCPackZIPGenerator.h" +#include "cmArchiveWrite.h" +#include "cmCPackArchiveGenerator.h" + cmCPackZIPGenerator::cmCPackZIPGenerator() : cmCPackArchiveGenerator(cmArchiveWrite::CompressNone, "zip") { diff --git a/Source/CPack/cmCPackZIPGenerator.h b/Source/CPack/cmCPackZIPGenerator.h index 1130826..fdb10a9 100644 --- a/Source/CPack/cmCPackZIPGenerator.h +++ b/Source/CPack/cmCPackZIPGenerator.h @@ -13,7 +13,11 @@ #ifndef cmCPackZIPGenerator_h #define cmCPackZIPGenerator_h +#include <cmConfigure.h> + #include "cmCPackArchiveGenerator.h" +#include "cmCPackGenerator.h" +#include "cmTypeMacro.h" /** \class cmCPackZIPGenerator * \brief A generator for ZIP files diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index de572c0..be524b3 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -9,22 +9,30 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ -#include "cmSystemTools.h" +#include <cmConfigure.h> -// Need these for documentation support. #include "cmCPackGenerator.h" #include "cmCPackGeneratorFactory.h" +#include "cmCPackLog.h" #include "cmDocumentation.h" +#include "cmDocumentationEntry.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" +#include "cmSystemTools.h" +#include "cmTypeMacro.h" +#include "cm_auto_ptr.hxx" #include "cmake.h" -#include "cmake.h" - -#include "cmCPackLog.h" #include <cmsys/CommandLineArguments.hxx> #include <cmsys/Encoding.hxx> -#include <cmsys/SystemTools.hxx> +#include <iostream> +#include <map> +#include <sstream> +#include <stddef.h> +#include <string> +#include <utility> +#include <vector> static const char* cmDocumentationName[][2] = { { CM_NULLPTR, " cpack - Packaging driver provided by CMake." }, diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h index 14e1454..7302837 100644 --- a/Source/cmExecutionStatus.h +++ b/Source/cmExecutionStatus.h @@ -40,12 +40,16 @@ public: this->ReturnInvoked = false; this->BreakInvoked = false; this->ContinueInvoked = false; + this->NestedError = false; } + void SetNestedError(bool val) { this->NestedError = val; } + bool GetNestedError() { return this->NestedError; } private: bool ReturnInvoked; bool BreakInvoked; bool ContinueInvoked; + bool NestedError; }; #endif diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index ceba69a..bcadaa0 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -122,7 +122,10 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) "PATH)\n"; dest = cmSystemTools::GetFilenamePath(dest); } - os << "\n"; + os << "if(_IMPORT_PREFIX STREQUAL \"/\")\n" + << " set(_IMPORT_PREFIX \"\")\n" + << "endif()\n" + << "\n"; } std::vector<std::string> missingTargets; diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index f0e4854..40c54db 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -76,7 +76,7 @@ public: }; bool cmFunctionHelperCommand::InvokeInitialPass( - const std::vector<cmListFileArgument>& args, cmExecutionStatus&) + const std::vector<cmListFileArgument>& args, cmExecutionStatus& inStatus) { // Expand the argument list to the function. std::vector<std::string> expandedArgs; @@ -129,11 +129,11 @@ bool cmFunctionHelperCommand::InvokeInitialPass( for (unsigned int c = 0; c < this->Functions.size(); ++c) { cmExecutionStatus status; if (!this->Makefile->ExecuteCommand(this->Functions[c], status) || - (cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured())) { + status.GetNestedError()) { // The error message should have already included the call stack // so we do not need to report an error here. functionScope.Quiet(); + inStatus.SetNestedError(true); return false; } if (status.GetReturnInvoked()) { diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 9d312ee..ee9dc8a 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -159,11 +159,11 @@ bool cmMacroHelperCommand::InvokeInitialPass( } cmExecutionStatus status; if (!this->Makefile->ExecuteCommand(newLFF, status) || - (cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured())) { + status.GetNestedError()) { // The error message should have already included the call stack // so we do not need to report an error here. macroScope.Quiet(); + inStatus.SetNestedError(true); return false; } if (status.GetReturnInvoked()) { diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 11ccca1..e5a5e6e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -117,6 +117,11 @@ cmMakefile::~cmMakefile() void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text) const { + if (!this->ExecutionStatusStack.empty()) { + if ((t == cmake::FATAL_ERROR) || (t == cmake::INTERNAL_ERROR)) { + this->ExecutionStatusStack.back()->SetNestedError(true); + } + } this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace()); } @@ -277,19 +282,11 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, if (this->GetCMakeInstance()->GetTrace()) { this->PrintCommandTrace(lff); } - - bool hadPreviousNonFatalError = cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured(); - cmSystemTools::ResetErrorOccuredFlag(); - + // Try invoking the command. bool invokeSucceeded = pcmd->InvokeInitialPass(lff.Arguments, status); - bool hadNestedError = cmSystemTools::GetErrorOccuredFlag() && - !cmSystemTools::GetFatalErrorOccured(); - if (hadPreviousNonFatalError) { - cmSystemTools::SetErrorOccured(); - } + bool hadNestedError = status.GetNestedError(); if (!invokeSucceeded || hadNestedError) { - if (!hadNestedError && !cmSystemTools::GetFatalErrorOccured()) { + if (!hadNestedError) { // The command invocation requested that we report an error. this->IssueMessage(cmake::FATAL_ERROR, pcmd->GetError()); } diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in index 74d816c..6c5a655 100644 --- a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in +++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description1.cmake.in @@ -15,8 +15,8 @@ set(CPACK_COMPONENTS_IGNORE_GROUPS 1) #set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) # overriding previous descriptions -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "main description") -set(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION "applications_description") -set(CPACK_COMPONENT_HEADERS_DESCRIPTION "headers_description") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "main description") +set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_DESCRIPTION "applications_description") +set(CPACK_COMPONENT_HEADERS_DESCRIPTION "headers_description") # libraries does not have any description and should inherit from CPACK_PACKAGE_DESCRIPTION_SUMMARY unset(CPACK_COMPONENT_LIBRARIES_DESCRIPTION) diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in index cda79bc..92226d8 100644 --- a/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in +++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-components-description2.cmake.in @@ -17,10 +17,12 @@ set(CPACK_COMPONENTS_IGNORE_GROUPS 1) # overriding previous descriptions set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "main description 2") +# and override CPACK_PACKAGE_DESCRIPTION_SUMMARY because of precedence +set(CPACK_PACKAGE_DESCRIPTION_FILE + "@CPackComponentsDEB_SOURCE_DIR@/pkg_description.txt") + # Components do not have any description unset(CPACK_COMPONENT_APPLICATIONS_DESCRIPTION) unset(CPACK_COMPONENT_HEADERS_DESCRIPTION) -unset(CPACK_COMPONENT_LIBRARIES_DESCRIPTION) - set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION "library description") diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake index 35ca74c..7b94ca0 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-description2.cmake @@ -55,12 +55,12 @@ if(DPKGDEB_EXECUTABLE) message(STATUS "package='${dpkg_package_name}', description='${dpkg_description}'") if("${dpkg_package_name}" STREQUAL "mylib-applications") - if(NOT "${dpkg_description}" STREQUAL "main description 2") + if(NOT "${dpkg_description}" STREQUAL "Debian package description file") set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all} "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: ${dpkg_description} != applications_description") endif() elseif("${dpkg_package_name}" STREQUAL "mylib-headers") - if(NOT "${dpkg_description}" STREQUAL "main description 2") + if(NOT "${dpkg_description}" STREQUAL "Debian package description file") set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all} "dpkg-deb: ${_f}: Incorrect description for package ${dpkg_package_name}: ${dpkg_description} != headers_description") endif() diff --git a/Tests/CPackComponentsDEB/pkg_description.txt b/Tests/CPackComponentsDEB/pkg_description.txt new file mode 100644 index 0000000..99f8f9b --- /dev/null +++ b/Tests/CPackComponentsDEB/pkg_description.txt @@ -0,0 +1 @@ +Debian package description file diff --git a/Tests/Module/ExternalData/CMakeLists.txt b/Tests/Module/ExternalData/CMakeLists.txt index f07ab71..1018dd8 100644 --- a/Tests/Module/ExternalData/CMakeLists.txt +++ b/Tests/Module/ExternalData/CMakeLists.txt @@ -53,4 +53,5 @@ ExternalData_Add_Target(Data1) add_subdirectory(Data2) add_subdirectory(Data3) add_subdirectory(Data4) +add_subdirectory(Data5) add_subdirectory(DataNoSymlinks) diff --git a/Tests/Module/ExternalData/Data5/CMakeLists.txt b/Tests/Module/ExternalData/Data5/CMakeLists.txt new file mode 100644 index 0000000..13c7fab --- /dev/null +++ b/Tests/Module/ExternalData/Data5/CMakeLists.txt @@ -0,0 +1,22 @@ +# Test adding the same data file in multiple tests +ExternalData_Add_Test(Data5.A + NAME Data5Check.A + COMMAND ${CMAKE_COMMAND} + -D Data5=DATA{../Data.dat} + -P ${CMAKE_CURRENT_SOURCE_DIR}/Data5Check.cmake + ) +ExternalData_Add_Target(Data5.A) +ExternalData_Add_Test(Data5.B + NAME Data5Check.B + COMMAND ${CMAKE_COMMAND} + -D Data5=DATA{../Data.dat} + -P ${CMAKE_CURRENT_SOURCE_DIR}/Data5Check.cmake + ) +ExternalData_Add_Target(Data5.B) +ExternalData_Add_Test(Data5.C + NAME Data5Check.C + COMMAND ${CMAKE_COMMAND} + -D Data5=DATA{../Data.dat} + -P ${CMAKE_CURRENT_SOURCE_DIR}/Data5Check.cmake + ) +ExternalData_Add_Target(Data5.C) diff --git a/Tests/Module/ExternalData/Data5/Data5Check.cmake b/Tests/Module/ExternalData/Data5/Data5Check.cmake new file mode 100644 index 0000000..4dea9a4 --- /dev/null +++ b/Tests/Module/ExternalData/Data5/Data5Check.cmake @@ -0,0 +1,4 @@ +file(STRINGS "${Data5}" lines LIMIT_INPUT 1024) +if(NOT "x${lines}" STREQUAL "xInput file already transformed.") + message(SEND_ERROR "Input file:\n ${Data5}\ndoes not have expected content, but [[${lines}]]") +endif() diff --git a/Tests/RunCMake/Configure/ContinueAfterError-result.txt b/Tests/RunCMake/Configure/ContinueAfterError-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Configure/ContinueAfterError-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Configure/ContinueAfterError-stderr.txt b/Tests/RunCMake/Configure/ContinueAfterError-stderr.txt new file mode 100644 index 0000000..f40a3ef --- /dev/null +++ b/Tests/RunCMake/Configure/ContinueAfterError-stderr.txt @@ -0,0 +1,13 @@ +^CMake Error at ContinueAfterError.cmake:[0-9]+ \(message\): + error in loop body +Call Stack \(most recent call first\): + ContinueAfterError.cmake:[0-9]+ \(m\) + ContinueAfterError.cmake:[0-9]+ \(f\) + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Error at ContinueAfterError.cmake:[0-9]+ \(message\): + error in loop body +Call Stack \(most recent call first\): + ContinueAfterError.cmake:[0-9]+ \(m\) + ContinueAfterError.cmake:[0-9]+ \(f\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Configure/ContinueAfterError-stdout.txt b/Tests/RunCMake/Configure/ContinueAfterError-stdout.txt new file mode 100644 index 0000000..f03aa07 --- /dev/null +++ b/Tests/RunCMake/Configure/ContinueAfterError-stdout.txt @@ -0,0 +1,11 @@ +-- before f +-- start f +-- start m +-- start loop body +-- end loop body +-- start loop body +-- end loop body +-- end m +-- end f +-- after f +-- Configuring incomplete, errors occurred! diff --git a/Tests/RunCMake/Configure/ContinueAfterError.cmake b/Tests/RunCMake/Configure/ContinueAfterError.cmake new file mode 100644 index 0000000..d094390 --- /dev/null +++ b/Tests/RunCMake/Configure/ContinueAfterError.cmake @@ -0,0 +1,19 @@ +macro(m) + message(STATUS " start m") + foreach(i 1 2) + message(STATUS " start loop body") + message(SEND_ERROR "error in loop body") + message(STATUS " end loop body") + endforeach() + message(STATUS " end m") +endmacro() + +function(f) + message(STATUS " start f") + m() + message(STATUS " end f") +endfunction() + +message(STATUS "before f") +f() +message(STATUS "after f") diff --git a/Tests/RunCMake/Configure/RunCMakeTest.cmake b/Tests/RunCMake/Configure/RunCMakeTest.cmake index 58e1a2a..91adb4e 100644 --- a/Tests/RunCMake/Configure/RunCMakeTest.cmake +++ b/Tests/RunCMake/Configure/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(ContinueAfterError) run_cmake(CustomTargetAfterError) run_cmake(ErrorLogs) run_cmake(FailCopyFileABI) diff --git a/Utilities/cmcurl/lib/vtls/nss.c b/Utilities/cmcurl/lib/vtls/nss.c index ad33f25..e467360 100644 --- a/Utilities/cmcurl/lib/vtls/nss.c +++ b/Utilities/cmcurl/lib/vtls/nss.c @@ -1004,10 +1004,10 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock, struct ssl_connect_data *connssl = (struct ssl_connect_data *)arg; struct Curl_easy *data = connssl->data; const char *nickname = connssl->client_nickname; + static const char pem_slotname[] = "PEM Token #1"; if(connssl->obj_clicert) { /* use the cert/key provided by PEM reader */ - static const char pem_slotname[] = "PEM Token #1"; SECItem cert_der = { 0, NULL, 0 }; void *proto_win = SSL_RevealPinArg(sock); struct CERTCertificateStr *cert; @@ -1069,6 +1069,12 @@ static SECStatus SelectClientCert(void *arg, PRFileDesc *sock, if(NULL == nickname) nickname = "[unknown]"; + if(!strncmp(nickname, pem_slotname, sizeof(pem_slotname) - 1U)) { + failf(data, "NSS: refusing previously loaded certificate from file: %s", + nickname); + return SECFailure; + } + if(NULL == *pRetKey) { failf(data, "NSS: private key not found for certificate: %s", nickname); return SECFailure; |