diff options
84 files changed, 748 insertions, 172 deletions
diff --git a/Help/release/dev/CTestCoverageCollectGCOV-compress-opts.rst b/Help/release/dev/CTestCoverageCollectGCOV-compress-opts.rst new file mode 100644 index 0000000..eb8532d --- /dev/null +++ b/Help/release/dev/CTestCoverageCollectGCOV-compress-opts.rst @@ -0,0 +1,7 @@ +CTestCoverageCollectGCOV-compress-opts +-------------------------------------- + +* The :module:`CTestCoverageCollectGCOV` module + :command:`ctest_coverage_collect_gcov` function gained a + ``TARBALL_COMPRESSION`` option to control compression of the + tarball of collected results. diff --git a/Help/release/dev/FPHSA-handle_components.rst b/Help/release/dev/FPHSA-handle_components.rst new file mode 100644 index 0000000..39907c4 --- /dev/null +++ b/Help/release/dev/FPHSA-handle_components.rst @@ -0,0 +1,5 @@ +FPHSA-handle_components +----------------------- + +* The :module:`FindPackageHandleStandardArgs` module option ``REQUIRED_VARS`` + is now optional if ``HANDLE_COMPONENTS`` is specified. diff --git a/Help/release/dev/FindPython-pypy.rst b/Help/release/dev/FindPython-pypy.rst new file mode 100644 index 0000000..84f0db1 --- /dev/null +++ b/Help/release/dev/FindPython-pypy.rst @@ -0,0 +1,5 @@ +FindPython-pypy +--------------- + +* The :module:`FindPython3`, :module:`FindPython2` and :module:`FindPython` + modules gained the capability to handle ``PyPy`` product. diff --git a/Help/variable/CTEST_NIGHTLY_START_TIME.rst b/Help/variable/CTEST_NIGHTLY_START_TIME.rst index bc80276..90841f9 100644 --- a/Help/variable/CTEST_NIGHTLY_START_TIME.rst +++ b/Help/variable/CTEST_NIGHTLY_START_TIME.rst @@ -1,5 +1,9 @@ CTEST_NIGHTLY_START_TIME ------------------------ -Specify the CTest ``NightlyStartTime`` setting -in a :manual:`ctest(1)` dashboard client script. +Specify the CTest ``NightlyStartTime`` setting in a :manual:`ctest(1)` +dashboard client script. + +Note that this variable must always be set for a nightly build in a +dashboard script. It is needed so that nightly builds can be properly grouped +together in CDash. diff --git a/Modules/CTestCoverageCollectGCOV.cmake b/Modules/CTestCoverageCollectGCOV.cmake index b498086..b1268be 100644 --- a/Modules/CTestCoverageCollectGCOV.cmake +++ b/Modules/CTestCoverageCollectGCOV.cmake @@ -37,6 +37,17 @@ After generating this tar file, it can be sent to CDash for display with the upload to CDash. Relative paths will be interpreted with respect to the top-level build directory. + ``TARBALL_COMPRESSION <option>`` Specify a compression algorithm for the + ``TARBALL`` data file. Using this option reduces the size of the data file + before it is submitted to CDash. ``<option>`` must be one of ``GZIP``, + ``BZIP2``, ``XZ``, ``ZSTD``, ``FROM_EXT``, or an expression that CMake + evaluates as ``FALSE``. The default value is ``BZIP2``. + + If ``FROM_EXT`` is specified, the resulting file will be compressed based on + the file extension of the ``<tarfile>`` (i.e. ``.tar.gz`` will use ``GZIP`` + compression). File extensions that will produce compressed output include + ``.tar.gz``, ``.tgz``, ``.tar.bzip2``, ``.tbz``, ``.tar.xz``, and ``.txz``. + ``SOURCE <source_dir>`` Specify the top-level source directory for the build. Default is the value of :variable:`CTEST_SOURCE_DIRECTORY`. @@ -68,7 +79,7 @@ After generating this tar file, it can be sent to CDash for display with the function(ctest_coverage_collect_gcov) set(options QUIET GLOB DELETE) - set(oneValueArgs TARBALL SOURCE BUILD GCOV_COMMAND) + set(oneValueArgs TARBALL SOURCE BUILD GCOV_COMMAND TARBALL_COMPRESSION) set(multiValueArgs GCOV_OPTIONS) cmake_parse_arguments(GCOV "${options}" "${oneValueArgs}" "${multiValueArgs}" "" ${ARGN} ) @@ -91,6 +102,13 @@ function(ctest_coverage_collect_gcov) else() set(gcov_command "${GCOV_GCOV_COMMAND}") endif() + if(NOT DEFINED GCOV_TARBALL_COMPRESSION) + set(GCOV_TARBALL_COMPRESSION "BZIP2") + elseif( GCOV_TARBALL_COMPRESSION AND + NOT GCOV_TARBALL_COMPRESSION MATCHES "^(GZIP|BZIP2|XZ|ZSTD|FROM_EXT)$") + message(FATAL_ERROR "TARBALL_COMPRESSION must be one of OFF, GZIP, " + "BZIP2, XZ, ZSTD, or FROM_EXT for ctest_coverage_collect_gcov") + endif() # run gcov on each gcda file in the binary tree set(gcda_files) set(label_files) @@ -270,14 +288,38 @@ ${label_files} ${uncovered_files_for_tar} ") - if (GCOV_QUIET) - set(tar_opts "cfj") - else() - set(tar_opts "cvfj") + # Prepare tar command line arguments + + set(tar_opts "") + # Select data compression mode + if( GCOV_TARBALL_COMPRESSION STREQUAL "FROM_EXT") + if( GCOV_TARBALL MATCHES [[\.(tgz|tar.gz)$]] ) + string(APPEND tar_opts "z") + elseif( GCOV_TARBALL MATCHES [[\.(txz|tar.xz)$]] ) + string(APPEND tar_opts "J") + elseif( GCOV_TARBALL MATCHES [[\.(tbz|tar.bz)$]] ) + string(APPEND tar_opts "j") + endif() + elseif(GCOV_TARBALL_COMPRESSION STREQUAL "GZIP") + string(APPEND tar_opts "z") + elseif(GCOV_TARBALL_COMPRESSION STREQUAL "XZ") + string(APPEND tar_opts "J") + elseif(GCOV_TARBALL_COMPRESSION STREQUAL "BZIP2") + string(APPEND tar_opts "j") + elseif(GCOV_TARBALL_COMPRESSION STREQUAL "ZSTD") + set(zstd_tar_opt "--zstd") + endif() + # Verbosity options + if(NOT GCOV_QUIET AND NOT tar_opts MATCHES v) + string(APPEND tar_opts "v") endif() + # Prepend option 'c' specifying 'create' + string(PREPEND tar_opts "c") + # Append option 'f' so that the next argument is the filename + string(APPEND tar_opts "f") execute_process(COMMAND - ${CMAKE_COMMAND} -E tar ${tar_opts} ${GCOV_TARBALL} + ${CMAKE_COMMAND} -E tar ${tar_opts} ${GCOV_TARBALL} ${zstd_tar_opt} "--mtime=1970-01-01 0:0:0 UTC" "--format=gnutar" --files-from=${coverage_dir}/coverage_file_list.txt diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index a078049..4fb0825 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -57,7 +57,8 @@ valid filepaths. These may be named in the generated failure message asking the user to set the missing variable values. Therefore these should typically be cache entries such as ``FOO_LIBRARY`` and not output - variables like ``FOO_LIBRARIES``. + variables like ``FOO_LIBRARIES``. This option is mandatory if + ``HANDLE_COMPONENTS`` is not specified. ``VERSION_VAR <version-var>`` Specify the name of a variable that holds the version of the package @@ -257,7 +258,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) set(FPHSA_VERSION_VAR ${_NAME}_VERSION) endif() - if(NOT FPHSA_REQUIRED_VARS) + if(NOT FPHSA_REQUIRED_VARS AND NOT FPHSA_HANDLE_COMPONENTS) message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") endif() endif() @@ -283,7 +284,9 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") endif() - list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) + if (FPHSA_REQUIRED_VARS) + list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) + endif() string(TOUPPER ${_NAME} _NAME_UPPER) string(TOLOWER ${_NAME} _NAME_LOWER) @@ -440,7 +443,17 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) _FPHSA_HANDLE_FAILURE_CONFIG_MODE() else() if(NOT VERSION_OK) - _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") + set(RESULT_MSG) + if (_FIRST_REQUIRED_VAR) + string (APPEND RESULT_MSG "found ${${_FIRST_REQUIRED_VAR}}") + endif() + if (COMPONENT_MSG) + if (RESULT_MSG) + string (APPEND RESULT_MSG ", ") + endif() + string (APPEND RESULT_MSG "${FOUND_COMPONENTS_MSG}") + endif() + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (${RESULT_MSG})") else() _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing:${MISSING_VARS}) ${VERSION_MSG}") endif() diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake index 93f77a8..a97f3c5 100644 --- a/Modules/FindPython.cmake +++ b/Modules/FindPython.cmake @@ -85,6 +85,7 @@ This module will set the following variables in your project * Anaconda * Canopy * IronPython + * PyPy ``Python_STDLIB`` Standard platform independent installation directory. @@ -147,6 +148,8 @@ This module will set the following variables in your project Python minor version. ``Python_VERSION_PATCH`` Python patch version. +``Python_PyPy_VERSION`` + Python PyPy version. ``Python_NumPy_FOUND`` System has the NumPy. ``Python_NumPy_INCLUDE_DIRS`` @@ -281,6 +284,9 @@ Hints * ``IronPython``: This implementation use the ``CSharp`` language for ``.NET Framework`` on top of the `Dynamic Language Runtime` (``DLR``). See `IronPython <http://ironpython.net>`_. + * ``PyPy``: This implementation use ``RPython`` language and + ``RPython translation toolchain`` to produce the python interpreter. + See `PyPy <https://www.pypy.org>`_. The default value is the list: ``CPython``, ``IronPython``. diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 733faa8..6aeb74a 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -263,6 +263,14 @@ function (_PYTHON_GET_PATH_SUFFIXES _PYTHON_PGPS_PATH_SUFFIXES) if (_PGPS_EXECUTABLE) list (APPEND path_suffixes ${_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES}) endif() + elseif (implementation STREQUAL "PyPy") + if (_PGPS_EXECUTABLE) + list (APPEND path_suffixes ${_${_PYTHON_PREFIX}_PYPY_EXECUTABLE_PATH_SUFFIXES}) + elseif (_PGPS_LIBRARY) + list (APPEND path_suffixes ${_${_PYTHON_PREFIX}_PYPY_LIBRARY_PATH_SUFFIXES}) + elseif (_PGPS_INCLUDE) + list (APPEND path_suffixes ${_${_PYTHON_PREFIX}_PYPY_INCLUDE_PATH_SUFFIXES}) + endif() endif() endforeach() list (REMOVE_DUPLICATES path_suffixes) @@ -333,6 +341,23 @@ function (_PYTHON_GET_NAMES _PYTHON_PGN_NAMES) if (_PGN_EXECUTABLE) list (APPEND names ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES}) endif() + elseif (implementation STREQUAL "PyPy") + if (_PGN_EXECUTABLE) + list (APPEND names ${_${_PYTHON_PREFIX}_PYPY_NAMES}) + elseif (_PGN_LIBRARY) + if (_PGN_WIN32) + foreach (version IN LISTS _PGN_VERSION) + string (REPLACE "." "" version_no_dots ${version}) + + set (name "python${version_no_dots}") + if (_PGN_DEBUG) + string (APPEND name "_d") + endif() + list (APPEND names "${name}") + endforeach() + endif() + list (APPEND names ${_${_PYTHON_PREFIX}_PYPY_LIB_NAMES}) + endif() endif() endforeach() @@ -484,8 +509,18 @@ function (_PYTHON_GET_VERSION) set (${_PGV_PREFIX}VERSION_MINOR "${CMAKE_MATCH_2}" PARENT_SCOPE) set (${_PGV_PREFIX}VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" PARENT_SCOPE) set (${_PGV_PREFIX}ABI "${CMAKE_MATCH_3}" PARENT_SCOPE) + elseif (_${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "pypy(3)?") + set (version "${CMAKE_MATCH_1}") + if (version EQUAL "3") + set (${_PGV_PREFIX}VERSION_MAJOR "3" PARENT_SCOPE) + set (${_PGV_PREFIX}VERSION "3" PARENT_SCOPE) + else() + set (${_PGV_PREFIX}VERSION_MAJOR "2" PARENT_SCOPE) + set (${_PGV_PREFIX}VERSION "2" PARENT_SCOPE) endif() + set (${_PGV_PREFIX}ABI "" PARENT_SCOPE) endif() + endif() else() if (_${_PYTHON_PREFIX}_INCLUDE_DIR) # retrieve version from header file @@ -977,12 +1012,34 @@ else() endif() set (_${_PYTHON_PREFIX}_IRON_PYTHON_PATH_SUFFIXES net45 net40) +# PyPy support +if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL "3") + set (_${_PYTHON_PREFIX}_PYPY_NAMES pypy3) + set (_${_PYTHON_PREFIX}_PYPY_LIB_NAMES pypy3-c) + if (WIN32) + # special name for runtime part + list (APPEND _${_PYTHON_PREFIX}_PYPY_LIB_NAMES libpypy3-c) + endif() + set (_${_PYTHON_PREFIX}_PYPY_INCLUDE_PATH_SUFFIXES lib/pypy3) +else() + set (_${_PYTHON_PREFIX}_PYPY_NAMES pypy) + set (_${_PYTHON_PREFIX}_PYPY_LIB_NAMES pypy-c) + if (WIN32) + # special name for runtime part + list (APPEND _${_PYTHON_PREFIX}_PYPY_LIB_NAMES libpypy-c) + endif() + set (_${_PYTHON_PREFIX}_PYPY_INCLUDE_PATH_SUFFIXES lib/pypy) +endif() +set (_${_PYTHON_PREFIX}_PYPY_EXECUTABLE_PATH_SUFFIXES bin) +set (_${_PYTHON_PREFIX}_PYPY_LIBRARY_PATH_SUFFIXES lib libs bin) +list (APPEND _${_PYTHON_PREFIX}_PYPY_INCLUDE_PATH_SUFFIXES include) + # Python Implementations handling unset (_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS) if (DEFINED ${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS) foreach (_${_PYTHON_PREFIX}_IMPLEMENTATION IN LISTS ${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS) - if (NOT _${_PYTHON_PREFIX}_IMPLEMENTATION MATCHES "^(CPython|IronPython)$") - message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${_${_PYTHON_PREFIX}_IMPLEMENTATION}: invalid value for '${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS'. 'CPython' or 'IronPython' expected. Value will be ignored.") + if (NOT _${_PYTHON_PREFIX}_IMPLEMENTATION MATCHES "^(CPython|IronPython|PyPy)$") + message (AUTHOR_WARNING "Find${_PYTHON_PREFIX}: ${_${_PYTHON_PREFIX}_IMPLEMENTATION}: invalid value for '${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS'. 'CPython', 'IronPython' or 'PyPy' expected. Value will be ignored.") else() list (APPEND _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS ${_${_PYTHON_PREFIX}_IMPLEMENTATION}) endif() @@ -996,6 +1053,8 @@ unset (_${_PYTHON_PREFIX}_INCLUDE_NAMES) foreach (_${_PYTHON_PREFIX}_IMPLEMENTATION IN LISTS _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS) if (_${_PYTHON_PREFIX}_IMPLEMENTATION STREQUAL "CPython") list (APPEND _${_PYTHON_PREFIX}_INCLUDE_NAMES "Python.h") + elseif (_${_PYTHON_PREFIX}_IMPLEMENTATION STREQUAL "PyPy") + list (APPEND _${_PYTHON_PREFIX}_INCLUDE_NAMES "PyPy.h") endif() endforeach() @@ -1150,7 +1209,7 @@ unset (_${_PYTHON_PREFIX}_NumPy_REASON_FAILURE) # first step, search for the interpreter if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_EXECUTABLE - _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES) + _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES) if (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter) list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_EXECUTABLE) endif() @@ -1526,6 +1585,9 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) set (${_PYTHON_PREFIX}_INTERPRETER_ID "Anaconda") elseif (${_PYTHON_PREFIX}_INTERPRETER_ID MATCHES "Enthought") set (${_PYTHON_PREFIX}_INTERPRETER_ID "Canopy") + elseif (${_PYTHON_PREFIX}_INTERPRETER_ID MATCHES "PyPy ([0-9.]+)") + set (${_PYTHON_PREFIX}_INTERPRETER_ID "PyPy") + set (${_PYTHON_PREFIX}_PyPy_VERSION "${CMAKE_MATCH_1}") else() string (REGEX REPLACE "^([^ ]+).*" "\\1" ${_PYTHON_PREFIX}_INTERPRETER_ID "${${_PYTHON_PREFIX}_INTERPRETER_ID}") if (${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "Python") @@ -1811,11 +1873,19 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ((${_PYTHON_PREFIX}_Interpreter_FOUND AND NOT ${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "IronPython") OR NOT ${_PYTHON_PREFIX}_Interpreter_FOUND)) + if (${_PYTHON_PREFIX}_Interpreter_FOUND) + # reduce possible implementations to the interpreter one + if (${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "PyPy") + set (_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS "PyPy") + else() + set (_${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS "CPython") + endif() + endif() if ("LIBRARY" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS) - list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_LIBRARY_RELEASE - _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE - _${_PYTHON_PREFIX}_LIBRARY_DEBUG - _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG) + list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_LIBRARY_RELEASE + _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE + _${_PYTHON_PREFIX}_LIBRARY_DEBUG + _${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG) endif() if ("INCLUDE_DIR" IN_LIST _${_PYTHON_PREFIX}_FIND_DEVELOPMENT_ARTIFACTS) list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_INCLUDE_DIR) @@ -2265,7 +2335,8 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS _python_find_runtime_library (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES} NAMES_PER_DIR - HINTS "${_${_PYTHON_PREFIX}_PATH}" "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS} + HINTS "${_${_PYTHON_PREFIX}_PATH}" + "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS} PATH_SUFFIXES bin) endif() if (_${_PYTHON_PREFIX}_LIBRARY_DEBUG) @@ -2275,7 +2346,8 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS _python_find_runtime_library (_${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES_DEBUG} NAMES_PER_DIR - HINTS "${_${_PYTHON_PREFIX}_PATH}" "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS} + HINTS "${_${_PYTHON_PREFIX}_PATH}" + "${_${_PYTHON_PREFIX}_PATH2}" ${_${_PYTHON_PREFIX}_HINTS} PATH_SUFFIXES bin) endif() endif() @@ -2482,6 +2554,16 @@ if (("Development.Module" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS set (${_PYTHON_PREFIX}_Development_FOUND TRUE) endif() + if ((${_PYTHON_PREFIX}_Development.Module_FOUND + OR ${_PYTHON_PREFIX}_Development.Embed_FOUND) + AND EXISTS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}/PyPy.h") + # retrieve PyPy version + file (STRINGS "${_${_PYTHON_PREFIX}_INCLUDE_DIR}/patchlevel.h" ${_PYTHON_PREFIX}_PyPy_VERSION + REGEX "^#define[ \t]+PYPY_VERSION[ \t]+\"[^\"]+\"") + string (REGEX REPLACE "^#define[ \t]+PYPY_VERSION[ \t]+\"([^\"]+)\".*" "\\1" + ${_PYTHON_PREFIX}_PyPy_VERSION "${${_PYTHON_PREFIX}_PyPy_VERSION}") + endif() + if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR VERSION_GREATER_EQUAL "3" AND NOT DEFINED ${_PYTHON_PREFIX}_SOABI) _python_get_config_var (${_PYTHON_PREFIX}_SOABI SOABI) diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake index def6f3c..4ef0e5a 100644 --- a/Modules/FindPython2.cmake +++ b/Modules/FindPython2.cmake @@ -86,6 +86,7 @@ This module will set the following variables in your project * Anaconda * Canopy * IronPython + * PyPy ``Python2_STDLIB`` Standard platform independent installation directory. @@ -139,6 +140,8 @@ This module will set the following variables in your project Python 2 minor version. ``Python2_VERSION_PATCH`` Python 2 patch version. +``Python2_PyPy_VERSION`` + Python 2 PyPy version. ``Python2_NumPy_FOUND`` System has the NumPy. ``Python2_NumPy_INCLUDE_DIRS`` @@ -228,6 +231,9 @@ Hints * ``IronPython``: This implementation use the ``CSharp`` language for ``.NET Framework`` on top of the `Dynamic Language Runtime` (``DLR``). See `IronPython <http://ironpython.net>`_. + * ``PyPy``: This implementation use ``RPython`` language and + ``RPython translation toolchain`` to produce the python interpreter. + See `PyPy <https://www.pypy.org>`_. The default value is the list: ``CPython``, ``IronPython``. diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake index 3660ee8..d8fc54a 100644 --- a/Modules/FindPython3.cmake +++ b/Modules/FindPython3.cmake @@ -86,6 +86,7 @@ This module will set the following variables in your project * Anaconda * Canopy * IronPython + * PyPy ``Python3_STDLIB`` Standard platform independent installation directory. @@ -148,6 +149,8 @@ This module will set the following variables in your project Python 3 minor version. ``Python3_VERSION_PATCH`` Python 3 patch version. +``Python3_PyPy_VERSION`` + Python 3 PyPy version. ``Python3_NumPy_FOUND`` System has the NumPy. ``Python3_NumPy_INCLUDE_DIRS`` @@ -278,6 +281,9 @@ Hints * ``IronPython``: This implementation use the ``CSharp`` language for ``.NET Framework`` on top of the `Dynamic Language Runtime` (``DLR``). See `IronPython <http://ironpython.net>`_. + * ``PyPy``: This implementation use ``RPython`` language and + ``RPython translation toolchain`` to produce the python interpreter. + See `PyPy <https://www.pypy.org>`_. The default value is the list: ``CPython``, ``IronPython``. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 564e647..ec473d2 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -698,7 +698,6 @@ set(SRCS cmWriteFileCommand.cxx cmWriteFileCommand.h - cm_static_string_view.hxx cm_get_date.h cm_get_date.c cm_utf8.h diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 72c70c2..254d02b 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 17) -set(CMake_VERSION_PATCH 20200501) +set(CMake_VERSION_PATCH 20200504) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 8eca2ff..3d5fe6b 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -135,16 +135,17 @@ void DebGenerator::generateDebianBinaryFile() const { // debian-binary file const std::string dbfilename = WorkDir + "/debian-binary"; - cmGeneratedFileStream out(dbfilename); - out << "2.0"; - out << std::endl; // required for valid debian package + cmGeneratedFileStream out; + out.Open(dbfilename, false, true); + out << "2.0\n"; // required for valid debian package } void DebGenerator::generateControlFile() const { std::string ctlfilename = WorkDir + "/control"; - cmGeneratedFileStream out(ctlfilename); + cmGeneratedFileStream out; + out.Open(ctlfilename, false, true); for (auto const& kv : ControlValues) { out << kv.first << ": " << kv.second << "\n"; } @@ -156,8 +157,7 @@ void DebGenerator::generateControlFile() const totalSize += cmSystemTools::FileLength(file); } } - out << "Installed-Size: " << (totalSize + 1023) / 1024 << "\n"; - out << std::endl; + out << "Installed-Size: " << (totalSize + 1023) / 1024 << "\n\n"; } bool DebGenerator::generateDataTar() const @@ -248,7 +248,8 @@ std::string DebGenerator::generateMD5File() const { std::string md5filename = WorkDir + "/md5sums"; - cmGeneratedFileStream out(md5filename); + cmGeneratedFileStream out; + out.Open(md5filename, false, true); std::string topLevelWithTrailingSlash = cmStrCat(TemporaryDir, '/'); for (std::string const& file : PackageFiles) { @@ -757,15 +758,17 @@ int cmCPackDebGenerator::createDeb() const bool gen_shibs = this->IsOn("CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS") && debian_pkg_shlibs && *debian_pkg_shlibs; if (gen_shibs) { - cmGeneratedFileStream out(shlibsfilename); + cmGeneratedFileStream out; + out.Open(shlibsfilename, false, true); out << debian_pkg_shlibs; - out << std::endl; + out << '\n'; } const std::string postinst = strGenWDIR + "/postinst"; const std::string postrm = strGenWDIR + "/postrm"; if (this->IsOn("GEN_CPACK_DEBIAN_GENERATE_POSTINST")) { - cmGeneratedFileStream out(postinst); + cmGeneratedFileStream out; + out.Open(postinst, false, true); out << "#!/bin/sh\n\n" "set -e\n\n" "if [ \"$1\" = \"configure\" ]; then\n" @@ -773,7 +776,8 @@ int cmCPackDebGenerator::createDeb() "fi\n"; } if (this->IsOn("GEN_CPACK_DEBIAN_GENERATE_POSTRM")) { - cmGeneratedFileStream out(postrm); + cmGeneratedFileStream out; + out.Open(postrm, false, true); out << "#!/bin/sh\n\n" "set -e\n\n" "if [ \"$1\" = \"remove\" ]; then\n" diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index d1b7701..44fdc29 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -5,7 +5,7 @@ #include <cstring> #include <sstream> -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmCTest.h" #include "cmCTestBuildHandler.h" diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index 3854710..f42c3f1 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -6,7 +6,7 @@ #include <sstream> #include <vector> -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmCTest.h" #include "cmCTestConfigureHandler.h" diff --git a/Source/CTest/cmCTestCoverageCommand.cxx b/Source/CTest/cmCTestCoverageCommand.cxx index e335923..7432d08 100644 --- a/Source/CTest/cmCTestCoverageCommand.cxx +++ b/Source/CTest/cmCTestCoverageCommand.cxx @@ -5,8 +5,7 @@ #include <set> #include <cmext/algorithm> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmCTest.h" #include "cmCTestCoverageHandler.h" diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index b1034c9..a755632 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -7,7 +7,7 @@ #include <cstring> #include <sstream> -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmCTest.h" #include "cmCTestGenericHandler.h" diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx index 39dec6d..d0e2974 100644 --- a/Source/CTest/cmCTestMemCheckCommand.cxx +++ b/Source/CTest/cmCTestMemCheckCommand.cxx @@ -2,7 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCTestMemCheckCommand.h" -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmCTest.h" #include "cmCTestMemCheckHandler.h" diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index 5b2f2e6..279216e 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -9,8 +9,7 @@ #include <cm/memory> #include <cm/vector> #include <cmext/algorithm> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmCTest.h" #include "cmCTestSubmitHandler.h" diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index 6b317cb..c71b409 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -6,7 +6,7 @@ #include <cstdlib> #include <sstream> -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmCTest.h" #include "cmCTestGenericHandler.h" diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index e6b3f36..8fc5cd6 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -20,13 +20,13 @@ #include <cm/memory> #include <cm/string_view> #include <cmext/algorithm> +#include <cmext/string_view> #include "cmsys/FStream.hxx" #include <cmsys/Base64.h> #include <cmsys/Directory.hxx> #include <cmsys/RegularExpression.hxx> -#include "cm_static_string_view.hxx" #include "cm_utf8.h" #include "cmCTest.h" diff --git a/Source/CTest/cmCTestUploadCommand.cxx b/Source/CTest/cmCTestUploadCommand.cxx index eaef1ca..f86ee0d 100644 --- a/Source/CTest/cmCTestUploadCommand.cxx +++ b/Source/CTest/cmCTestUploadCommand.cxx @@ -6,8 +6,7 @@ #include <sstream> #include <cm/vector> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmCTest.h" #include "cmCTestUploadHandler.h" diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index 358c5c5..50ccc7c 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -32,6 +32,8 @@ function(cm_check_cxx_feature name) string(REGEX REPLACE "[^\n]*libhugetlbfs [^\n]*: WARNING[^\n]*" "" check_output "${check_output}") # Filter out xcodebuild warnings. string(REGEX REPLACE "[^\n]* xcodebuild\\[[0-9]*:[0-9]*\\] warning: [^\n]*" "" check_output "${check_output}") + # Filter out icpc warnings + string(REGEX REPLACE "[^\n]*icpc: command line warning #10121: overriding [^\n]*" "" check_output "${check_output}") # Filter out ld warnings. string(REGEX REPLACE "[^\n]*ld: warning: [^\n]*" "" check_output "${check_output}") # If using the feature causes warnings, treat it as broken/unavailable. diff --git a/Source/cmArgumentParser.h b/Source/cmArgumentParser.h index 9426537..5d2dfa2 100644 --- a/Source/cmArgumentParser.h +++ b/Source/cmArgumentParser.h @@ -12,8 +12,7 @@ #include <vector> #include <cm/string_view> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> namespace ArgumentParser { diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index c2b2a09..2a0ddba1 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -19,6 +19,7 @@ #include <cm/memory> #include <cm/string_view> #include <cmext/algorithm> +#include <cmext/string_view> #include "cmsys/Base64.h" #include "cmsys/Directory.hxx" @@ -36,8 +37,6 @@ # include <unistd.h> // IWYU pragma: keep #endif -#include "cm_static_string_view.hxx" - #include "cmCTestBuildAndTestHandler.h" #include "cmCTestBuildHandler.h" #include "cmCTestConfigureHandler.h" diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 379836a..0516d26 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -69,8 +69,7 @@ const char* cmCommandArgumentParserHelper::ExpandSpecialVariable( return ""; } if (strcmp(key, "CACHE") == 0) { - if (const std::string* c = - this->Makefile->GetState()->GetInitializedCacheValue(var)) { + if (cmProp c = this->Makefile->GetState()->GetInitializedCacheValue(var)) { if (this->EscapeQuotes) { return this->AddString(cmEscapeQuotes(*c)); } diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 6c1a476..5414409 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -77,7 +77,7 @@ void cmCommonTargetGenerator::AppendFortranFormatFlags( cmOutputConverter::FortranFormat format = cmOutputConverter::GetFortranFormat(srcfmt); if (format == cmOutputConverter::FortranFormatNone) { - const std::string tgtfmt = + std::string const& tgtfmt = this->GeneratorTarget->GetSafeProperty("Fortran_FORMAT"); format = cmOutputConverter::GetFortranFormat(tgtfmt); } diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index bac9337..5b3045d 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -5,8 +5,7 @@ #include <set> #include <cm/string_view> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmExecutionStatus.h" #include "cmMakefile.h" diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index dc2df14..4e2caed 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -8,9 +8,9 @@ #include <sstream> #include <utility> -#include "cmsys/Directory.hxx" +#include <cmext/string_view> -#include "cm_static_string_view.hxx" +#include "cmsys/Directory.hxx" #include "cmExportTryCompileFileGenerator.h" #include "cmGlobalGenerator.h" diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index 08a0f7e..9c53bdf 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -10,11 +10,10 @@ #include <vector> #include <cmext/algorithm> +#include <cmext/string_view> #include "cmsys/Process.h" -#include "cm_static_string_view.hxx" - #include "cmArgumentParser.h" #include "cmExecutionStatus.h" #include "cmMakefile.h" diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index ad632ee..9f8a821 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -8,11 +8,10 @@ #include <cm/memory> #include <cmext/algorithm> +#include <cmext/string_view> #include "cmsys/RegularExpression.hxx" -#include "cm_static_string_view.hxx" - #include "cmArgumentParser.h" #include "cmExecutionStatus.h" #include "cmExportBuildAndroidMKGenerator.h" diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index b65f097..80d61c3 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -243,8 +243,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out, const bool envVarSet = cmSystemTools::GetEnv(envVar, envVarValue); std::string cacheEntryName = cmStrCat("CMAKE_ECLIPSE_ENVVAR_", envVar); - const std::string* cacheValue = - lg.GetState()->GetInitializedCacheValue(cacheEntryName); + cmProp cacheValue = lg.GetState()->GetInitializedCacheValue(cacheEntryName); // now we have both, decide which one to use std::string valueToUse; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 4ec128e..161bbe8 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -17,13 +17,13 @@ #include <cm/memory> #include <cmext/algorithm> +#include <cmext/string_view> #include "cmsys/FStream.hxx" #include "cmsys/Glob.hxx" #include "cmsys/RegularExpression.hxx" #include "cm_kwiml.h" -#include "cm_static_string_view.hxx" #include "cm_sys_stat.h" #include "cmAlgorithms.h" diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index 82c5223..32e7892 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -18,8 +18,7 @@ #include <cm/memory> #include <cm/string_view> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmExecutionStatus.h" #include "cmFunctionBlocker.h" diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index a4c9072..b6f58bd 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -7,8 +7,7 @@ #include <cm/memory> #include <cm/string_view> #include <cmext/algorithm> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmExecutionStatus.h" #include "cmFunctionBlocker.h" diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index b4ba1a1..4f379cd 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -7,8 +7,7 @@ #include <utility> #include <cm/string_view> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmGeneratorExpressionContext.h" #include "cmGeneratorExpressionEvaluator.h" diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 68f466f..e3de2d8 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -17,12 +17,11 @@ #include <cm/string_view> #include <cm/vector> #include <cmext/algorithm> +#include <cmext/string_view> #include "cmsys/RegularExpression.hxx" #include "cmsys/String.h" -#include "cm_static_string_view.hxx" - #include "cmAlgorithms.h" #include "cmGeneratorExpression.h" #include "cmGeneratorExpressionContext.h" diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 509df93..62427f6 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -18,11 +18,10 @@ #include <cm/memory> #include <cm/string_view> #include <cmext/algorithm> +#include <cmext/string_view> #include "cmsys/RegularExpression.hxx" -#include "cm_static_string_view.hxx" - #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" #include "cmCustomCommand.h" @@ -388,14 +387,16 @@ cmProp cmGeneratorTarget::GetProperty(const std::string& prop) const return this->Target->GetProperty(prop); } -const char* cmGeneratorTarget::GetSafeProperty(const std::string& prop) const +std::string const& cmGeneratorTarget::GetSafeProperty( + std::string const& prop) const { cmProp ret = this->GetProperty(prop); - if (!ret) { - return ""; + if (ret) { + return *ret; } - return ret->c_str(); + static std::string const s_empty; + return s_empty; } const char* cmGeneratorTarget::GetOutputTargetType( @@ -3988,7 +3989,8 @@ std::string cmGeneratorTarget::GetPchUseCompileOptions( const std::string useOptVar = cmStrCat(language, "_COMPILE_OPTIONS_USE_PCH"); - const std::string useOptionListProperty = this->GetSafeProperty(useOptVar); + std::string const& useOptionListProperty = + this->GetSafeProperty(useOptVar); useOptionList = cmStrCat( useOptionList, ";", diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index dc98407..2ef7b43 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -80,7 +80,7 @@ public: //! Might return a nullptr if the property is not set or invalid cmProp GetProperty(const std::string& prop) const; //! Always returns a valid pointer - const char* GetSafeProperty(const std::string& prop) const; + std::string const& GetSafeProperty(std::string const& prop) const; bool GetPropertyAsBool(const std::string& prop) const; void GetSourceFiles(std::vector<cmSourceFile*>& files, const std::string& config) const; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2664fb0..de6a649 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -232,7 +232,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang, if (!optional && (path.empty() || !cmSystemTools::FileExists(path))) { return; } - const std::string* cname = + cmProp cname = this->GetCMakeInstance()->GetState()->GetInitializedCacheValue(langComp); std::string changeVars; if (cname && !optional) { @@ -384,9 +384,9 @@ bool cmGlobalGenerator::CheckTargetsForPchCompilePdb() const } } - const std::string reuseFrom = + std::string const& reuseFrom = target->GetSafeProperty("PRECOMPILE_HEADERS_REUSE_FROM"); - const std::string compilePdb = + std::string const& compilePdb = target->GetSafeProperty("COMPILE_PDB_NAME"); if (!reuseFrom.empty() && reuseFrom != compilePdb) { @@ -2057,9 +2057,8 @@ void cmGlobalGenerator::AddMakefile(std::unique_ptr<cmMakefile> mf) // update progress // estimate how many lg there will be - const std::string* numGenC = - this->CMakeInstance->GetState()->GetInitializedCacheValue( - "CMAKE_NUMBER_OF_MAKEFILES"); + cmProp numGenC = this->CMakeInstance->GetState()->GetInitializedCacheValue( + "CMAKE_NUMBER_OF_MAKEFILES"); if (!numGenC) { // If CMAKE_NUMBER_OF_MAKEFILES is not set diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 77fa6fa..cda3338 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -808,7 +808,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( // Add flags from target and source file properties. std::string flags; - const std::string srcfmt = sf->GetSafeProperty("Fortran_FORMAT"); + std::string const& srcfmt = sf->GetSafeProperty("Fortran_FORMAT"); switch (cmOutputConverter::GetFortranFormat(srcfmt)) { case cmOutputConverter::FortranFormatFixed: flags = "-fixed " + flags; @@ -2289,7 +2289,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Add Fortran source format attribute if property is set. const char* format = nullptr; - const std::string tgtfmt = gtgt->GetSafeProperty("Fortran_FORMAT"); + std::string const& tgtfmt = gtgt->GetSafeProperty("Fortran_FORMAT"); switch (cmOutputConverter::GetFortranFormat(tgtfmt)) { case cmOutputConverter::FortranFormatFixed: format = "fixed"; @@ -2416,7 +2416,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string attribute = prop.substr(16); this->FilterConfigurationAttribute(configName, attribute); if (!attribute.empty()) { - const std::string pr = gtgt->GetSafeProperty(prop); + std::string const& pr = gtgt->GetSafeProperty(prop); std::string processed = cmGeneratorExpression::Evaluate( pr, this->CurrentLocalGenerator, configName); buildSettings->AddAttribute(attribute, diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index 290e064..5808f90 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -7,8 +7,7 @@ #include <cm/memory> #include <cm/string_view> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmConditionEvaluator.h" #include "cmExecutionStatus.h" diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index c9b22b6..ac57bc2 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -8,11 +8,10 @@ #include <utility> #include <cm/memory> +#include <cmext/string_view> #include "cmsys/Glob.hxx" -#include "cm_static_string_view.hxx" - #include "cmArgumentParser.h" #include "cmExecutionStatus.h" #include "cmExportSet.h" diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx index 31ba63f..a034689 100644 --- a/Source/cmInstallCommandArguments.cxx +++ b/Source/cmInstallCommandArguments.cxx @@ -4,7 +4,7 @@ #include <utility> -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmRange.h" #include "cmSystemTools.h" diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 1d82dfc..edec613 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -17,11 +17,10 @@ #include <cm/memory> #include <cmext/algorithm> +#include <cmext/string_view> #include "cmsys/RegularExpression.hxx" -#include "cm_static_string_view.hxx" - #include "cmAlgorithms.h" #include "cmExecutionStatus.h" #include "cmGeneratorExpression.h" diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a2208e5..b862449 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2670,7 +2670,8 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) std::string dest_file = to_file; - const std::string prefix = target->GetSafeProperty("PREFIX"); + std::string const& prefix = + target->GetSafeProperty("PREFIX"); if (!prefix.empty()) { dest_file = cmStrCat(to_dir, prefix, *ReuseFrom, extension); diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 0b0d9ac..c88b343 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -8,8 +8,7 @@ #include <cm/memory> #include <cm/string_view> #include <cmext/algorithm> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmExecutionStatus.h" #include "cmFunctionBlocker.h" diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 028b0f5..6c46353 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -18,13 +18,13 @@ #include <cm/optional> #include <cm/vector> #include <cmext/algorithm> +#include <cmext/string_view> #include "cmsys/FStream.hxx" #include "cmsys/RegularExpression.hxx" #include "cm_jsoncpp_value.h" #include "cm_jsoncpp_writer.h" -#include "cm_static_string_view.hxx" #include "cm_sys_stat.h" #include "cmCommandArgumentParserHelper.h" @@ -1880,8 +1880,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, cmStateEnums::CacheEntryType type, bool force) { - const std::string* existingValue = - this->GetState()->GetInitializedCacheValue(name); + cmProp existingValue = this->GetState()->GetInitializedCacheValue(name); // must be outside the following if() to keep it alive long enough std::string nvalue; @@ -2682,7 +2681,7 @@ const std::string& cmMakefile::GetRequiredDefinition( bool cmMakefile::IsDefinitionSet(const std::string& name) const { - const std::string* def = this->StateSnapshot.GetDefinition(name); + cmProp def = this->StateSnapshot.GetDefinition(name); if (!def) { def = this->GetState()->GetInitializedCacheValue(name); } @@ -2699,7 +2698,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const const std::string* cmMakefile::GetDef(const std::string& name) const { - const std::string* def = this->StateSnapshot.GetDefinition(name); + cmProp def = this->StateSnapshot.GetDefinition(name); if (!def) { def = this->GetState()->GetInitializedCacheValue(name); } diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index bf8183b..c7bb9a7 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -6,8 +6,7 @@ #include <utility> #include <cm/string_view> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmExecutionStatus.h" #include "cmMakefile.h" diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index 18b135d..a32f3e7 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -95,11 +95,11 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( bool const uic = target->GetPropertyAsBool(kw().AUTOUIC); bool const rcc = target->GetPropertyAsBool(kw().AUTORCC); if (moc || uic || rcc) { - std::string const mocExec = + std::string const& mocExec = target->GetSafeProperty(kw().AUTOMOC_EXECUTABLE); - std::string const uicExec = + std::string const& uicExec = target->GetSafeProperty(kw().AUTOUIC_EXECUTABLE); - std::string const rccExec = + std::string const& rccExec = target->GetSafeProperty(kw().AUTORCC_EXECUTABLE); // We support Qt4, Qt5 and Qt6 diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index fa523cc..235ee38 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -440,7 +440,8 @@ bool cmQtAutoGenInitializer::InitCustomTargets() // Autogen target parallel processing { - std::string prop = this->GenTarget->GetSafeProperty("AUTOGEN_PARALLEL"); + std::string const& prop = + this->GenTarget->GetSafeProperty("AUTOGEN_PARALLEL"); if (prop.empty() || (prop == "AUTO")) { // Autodetect number of CPUs this->AutogenTarget.Parallel = GetParallelCPUCount(); @@ -471,7 +472,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() this->AutogenTarget.DependOrigin = this->GenTarget->GetPropertyAsBool("AUTOGEN_ORIGIN_DEPENDS"); - std::string const deps = + std::string const& deps = this->GenTarget->GetSafeProperty("AUTOGEN_TARGET_DEPENDS"); if (!deps.empty()) { for (std::string const& depName : cmExpandedList(deps)) { @@ -654,7 +655,7 @@ bool cmQtAutoGenInitializer::InitUic() { // Uic search paths { - std::string const usp = + std::string const& usp = this->GenTarget->GetSafeProperty("AUTOUIC_SEARCH_PATHS"); if (!usp.empty()) { this->Uic.SearchPaths = @@ -1794,7 +1795,7 @@ bool cmQtAutoGenInitializer::GetQtExecutable(GenVarsT& genVars, // Custom executable { std::string const prop = cmStrCat(genVars.GenNameUpper, "_EXECUTABLE"); - std::string const val = this->GenTarget->Target->GetSafeProperty(prop); + std::string const& val = this->GenTarget->Target->GetSafeProperty(prop); if (!val.empty()) { // Evaluate generator expression { diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 10e6317..f6154eb 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -26,6 +26,8 @@ #include "cmSystemTools.h" #include "cmake.h" +using cmProp = const std::string*; // just to silence IWYU + // Get rid of some windows macros: #undef max @@ -562,7 +564,7 @@ cmServerResponse cmServerProtocol1::ProcessConfigure( if (cm->LoadCache(buildDir)) { // build directory has been set up before - const std::string* cachedSourceDir = + cmProp cachedSourceDir = cm->GetState()->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY"); if (!cachedSourceDir) { return request.ReportError("No CMAKE_HOME_DIRECTORY found in cache."); @@ -572,7 +574,7 @@ cmServerResponse cmServerProtocol1::ProcessConfigure( cm->SetHomeDirectory(sourceDir); } - const std::string* cachedGenerator = + cmProp cachedGenerator = cm->GetState()->GetInitializedCacheValue("CMAKE_GENERATOR"); if (cachedGenerator) { if (gg && gg->GetName() != *cachedGenerator) { diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 2e748d3..df013f4 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -155,8 +155,7 @@ std::string cmState::GetSafeCacheEntryValue(std::string const& key) const return std::string(); } -const std::string* cmState::GetInitializedCacheValue( - std::string const& key) const +cmProp cmState::GetInitializedCacheValue(std::string const& key) const { return this->CacheManager->GetInitializedCacheValue(key); } diff --git a/Source/cmState.h b/Source/cmState.h index e3fbfdc..e966935 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -92,7 +92,7 @@ public: std::vector<std::string> GetCacheEntryKeys() const; cmProp GetCacheEntryValue(std::string const& key) const; std::string GetSafeCacheEntryValue(std::string const& key) const; - const std::string* GetInitializedCacheValue(std::string const& key) const; + cmProp GetInitializedCacheValue(std::string const& key) const; cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key) const; void SetCacheEntryValue(std::string const& key, std::string const& value); void SetCacheValue(std::string const& key, std::string const& value); diff --git a/Source/cmString.hxx b/Source/cmString.hxx index 9e91986..87bfdff 100644 --- a/Source/cmString.hxx +++ b/Source/cmString.hxx @@ -16,8 +16,7 @@ #include <utility> #include <cm/string_view> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> namespace cm { diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 7662204..a7c21cc 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -11,11 +11,10 @@ #include <memory> #include <cm/iterator> +#include <cmext/string_view> #include "cmsys/RegularExpression.hxx" -#include "cm_static_string_view.hxx" - #include "cmCryptoHash.h" #include "cmExecutionStatus.h" #include "cmGeneratorExpression.h" diff --git a/Source/cmSubcommandTable.h b/Source/cmSubcommandTable.h index 65eb8c7..7deaaed 100644 --- a/Source/cmSubcommandTable.h +++ b/Source/cmSubcommandTable.h @@ -11,8 +11,7 @@ #include <vector> #include <cm/string_view> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> class cmExecutionStatus; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 955a5cc..a776398 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1789,13 +1789,15 @@ cmProp cmTarget::GetProperty(const std::string& prop) const return retVal; } -const char* cmTarget::GetSafeProperty(const std::string& prop) const +std::string const& cmTarget::GetSafeProperty(std::string const& prop) const { cmProp ret = this->GetProperty(prop); - if (!ret) { - return ""; + if (ret) { + return *ret; } - return ret->c_str(); + + static std::string const s_empty; + return s_empty; } bool cmTarget::GetPropertyAsBool(const std::string& prop) const diff --git a/Source/cmTarget.h b/Source/cmTarget.h index ddc3b9b..8fecd41 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -174,7 +174,7 @@ public: //! Might return a nullptr if the property is not set or invalid cmProp GetProperty(const std::string& prop) const; //! Always returns a valid pointer - const char* GetSafeProperty(const std::string& prop) const; + std::string const& GetSafeProperty(std::string const& prop) const; bool GetPropertyAsBool(const std::string& prop) const; void CheckProperty(const std::string& prop, cmMakefile* context) const; cmProp GetComputedProperty(const std::string& prop, cmMessenger* messenger, diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9c2b302..2b20a00 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -909,7 +909,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferenceCustomTags( void cmVisualStudio10TargetGenerator::WriteDotNetDocumentationFile(Elem& e0) { - std::string const documentationFile = + std::string const& documentationFile = this->GeneratorTarget->GetSafeProperty("VS_DOTNET_DOCUMENTATION_FILE"); if (this->ProjectType == csproj && !documentationFile.empty()) { diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index 26e7c75..0d8e894 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -7,8 +7,7 @@ #include <cm/memory> #include <cm/string_view> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmConditionEvaluator.h" #include "cmExecutionStatus.h" diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index aab367a..9ac1457 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -405,8 +405,9 @@ void cmXCodeScheme::WriteBuildableReference(cmXMLWriter& xout, void cmXCodeScheme::WriteCustomWorkingDirectory( cmXMLWriter& xout, const std::string& configuration) { - std::string propertyValue = this->Target->GetTarget()->GetSafeProperty( - "XCODE_SCHEME_WORKING_DIRECTORY"); + std::string const& propertyValue = + this->Target->GetTarget()->GetSafeProperty( + "XCODE_SCHEME_WORKING_DIRECTORY"); if (propertyValue.empty()) { xout.Attribute("useCustomWorkingDirectory", "NO"); } else { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c619e1e..057d54d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -19,12 +19,12 @@ #endif #include <cmext/algorithm> +#include <cmext/string_view> #include "cmsys/FStream.hxx" #include "cmsys/Glob.hxx" #include "cmsys/RegularExpression.hxx" -#include "cm_static_string_view.hxx" #include "cm_sys_stat.h" #include "cmCommands.h" @@ -138,6 +138,7 @@ using JsonValueMapType = std::unordered_map<std::string, Json::Value>; static bool cmakeCheckStampFile(const std::string& stampName); static bool cmakeCheckStampList(const std::string& stampList); +#ifndef CMAKE_BOOTSTRAP static void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/, void* ctx, const char* /*unused*/, const cmMakefile* /*unused*/) @@ -145,6 +146,7 @@ static void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/, cmake* cm = reinterpret_cast<cmake*>(ctx); cm->MarkCliAsUsed(variable); } +#endif cmake::cmake(Role role, cmState::Mode mode) : FileTimeCache(cm::make_unique<cmFileTimeCache>()) @@ -313,8 +315,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) bool haveValue = false; std::string cachedValue; if (this->WarnUnusedCli) { - if (const std::string* v = - this->State->GetInitializedCacheValue(var)) { + if (cmProp v = this->State->GetInitializedCacheValue(var)) { haveValue = true; cachedValue = *v; } @@ -1529,9 +1530,8 @@ int cmake::ActualConfigure() // no generator specified on the command line if (!this->GlobalGenerator) { - const std::string* genName = - this->State->GetInitializedCacheValue("CMAKE_GENERATOR"); - const std::string* extraGenName = + cmProp genName = this->State->GetInitializedCacheValue("CMAKE_GENERATOR"); + cmProp extraGenName = this->State->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR"); if (genName) { std::string fullName = @@ -1554,8 +1554,7 @@ int cmake::ActualConfigure() } } - const std::string* genName = - this->State->GetInitializedCacheValue("CMAKE_GENERATOR"); + cmProp genName = this->State->GetInitializedCacheValue("CMAKE_GENERATOR"); if (genName) { if (!this->GlobalGenerator->MatchesGeneratorName(*genName)) { std::string message = @@ -1577,7 +1576,7 @@ int cmake::ActualConfigure() cmStateEnums::INTERNAL); } - if (const std::string* instance = + if (cmProp instance = this->State->GetInitializedCacheValue("CMAKE_GENERATOR_INSTANCE")) { if (this->GeneratorInstanceSet && this->GeneratorInstance != *instance) { std::string message = @@ -1594,7 +1593,7 @@ int cmake::ActualConfigure() "Generator instance identifier.", cmStateEnums::INTERNAL); } - if (const std::string* platformName = + if (cmProp platformName = this->State->GetInitializedCacheValue("CMAKE_GENERATOR_PLATFORM")) { if (this->GeneratorPlatformSet && this->GeneratorPlatform != *platformName) { @@ -1612,7 +1611,7 @@ int cmake::ActualConfigure() "Name of generator platform.", cmStateEnums::INTERNAL); } - if (const std::string* tsName = + if (cmProp tsName = this->State->GetInitializedCacheValue("CMAKE_GENERATOR_TOOLSET")) { if (this->GeneratorToolsetSet && this->GeneratorToolset != *tsName) { std::string message = @@ -1983,7 +1982,7 @@ std::string cmake::StripExtension(const std::string& file) const const char* cmake::GetCacheDefinition(const std::string& name) const { - const std::string* p = this->State->GetInitializedCacheValue(name); + cmProp p = this->State->GetInitializedCacheValue(name); return p ? p->c_str() : nullptr; } @@ -2190,7 +2189,7 @@ void cmake::PrintGeneratorList() void cmake::UpdateConversionPathTable() { // Update the path conversion table with any specified file: - const std::string* tablepath = + cmProp tablepath = this->State->GetInitializedCacheValue("CMAKE_PATH_TRANSLATION_FILE"); if (tablepath) { @@ -2834,7 +2833,7 @@ bool cmake::Open(const std::string& dir, bool dryRun) std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n"; return false; } - const std::string* extraGenName = + cmProp extraGenName = this->State->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR"); std::string fullName = cmExternalMakefileProjectGenerator::CreateFullGeneratorName( diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 84d0538..2828116 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -318,6 +318,7 @@ int do_cmake(int ac, char const* const* av) return 0; } +#ifndef CMAKE_BOOTSTRAP int extract_job_number(int& index, char const* current, char const* next, int len_of_flag) { @@ -347,6 +348,7 @@ int extract_job_number(int& index, char const* current, char const* next, } return jobs; } +#endif int do_build(int ac, char const* const* av) { diff --git a/Tests/CMakeLib/testArgumentParser.cxx b/Tests/CMakeLib/testArgumentParser.cxx index 20f98c2..965690c 100644 --- a/Tests/CMakeLib/testArgumentParser.cxx +++ b/Tests/CMakeLib/testArgumentParser.cxx @@ -7,8 +7,7 @@ #include <vector> #include <cm/string_view> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmArgumentParser.h" diff --git a/Tests/CMakeLib/testString.cxx b/Tests/CMakeLib/testString.cxx index 48d2590..ad800cf 100644 --- a/Tests/CMakeLib/testString.cxx +++ b/Tests/CMakeLib/testString.cxx @@ -12,8 +12,7 @@ #include <utility> #include <cm/string_view> - -#include "cm_static_string_view.hxx" +#include <cmext/string_view> #include "cmString.hxx" diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index f44a209..32e6582 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1477,7 +1477,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH endif() if(CMake_TEST_FindPython OR CMake_TEST_FindPython_NumPy - OR CMake_TEST_FindPython_Conda OR CMake_TEST_FindPython_IronPython) + OR CMake_TEST_FindPython_Conda OR CMake_TEST_FindPython_IronPython OR CMake_TEST_FindPython_PyPy) add_subdirectory(FindPython) endif() @@ -2695,9 +2695,6 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH -S "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake" -VV --output-log "${CMake_BINARY_DIR}/Tests/CTestCoverageCollectGCOV/testOut.log" ) - set_tests_properties(CTestCoverageCollectGCOV PROPERTIES - PASS_REGULAR_EXPRESSION - "PASSED with correct output.*Testing/CoverageInfo/main.cpp.gcov") set_property(TEST CTestCoverageCollectGCOV PROPERTY ENVIRONMENT CTEST_PARALLEL_LEVEL=) configure_file( diff --git a/Tests/CTestCoverageCollectGCOV/test.cmake.in b/Tests/CTestCoverageCollectGCOV/test.cmake.in index 2c98876..1818888 100644 --- a/Tests/CTestCoverageCollectGCOV/test.cmake.in +++ b/Tests/CTestCoverageCollectGCOV/test.cmake.in @@ -3,13 +3,15 @@ set(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestCoverageCollectGCOV/Te set(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestCoverageCollectGCOV/TestProject") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) - ctest_start(Experimental) ctest_configure() ctest_build() ctest_test() +#------------------------------------------------------------------------------# +# Common setup for all tests. +#------------------------------------------------------------------------------# + list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE "/foo/something" "/3rdparty/" @@ -17,15 +19,118 @@ list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE "/CMakeFiles/" ) list(APPEND CTEST_EXTRA_COVERAGE_GLOB "*.cpp") - include(CTestCoverageCollectGCOV) +set(expected_out + CMakeFiles/myexecutable.dir/Labels.json + Testing/CoverageInfo/data.json + Testing/CoverageInfo/extra.cpp.gcov + Testing/CoverageInfo/main.cpp.gcov + uncovered/extra/uncovered1.cpp + uncovered/uncovered2.cpp +) + +#------------------------------------------------------------------------------# +# Test 1: with standard arguments +#------------------------------------------------------------------------------# + +set(tar_file ${CTEST_BINARY_DIRECTORY}/gcov.tbz) +ctest_coverage_collect_gcov( + TARBALL "${tar_file}" + SOURCE "${CTEST_SOURCE_DIRECTORY}" + BUILD "${CTEST_BINARY_DIRECTORY}" + GCOV_COMMAND "${CMAKE_COMMAND}" + GCOV_OPTIONS -P "@CMake_SOURCE_DIR@/Tests/CTestCoverageCollectGCOV/fakegcov.cmake") +file(REMOVE_RECURSE "${CTEST_BINARY_DIRECTORY}/uncovered") + +execute_process(COMMAND + ${CMAKE_COMMAND} -E tar tf ${tar_file} + OUTPUT_VARIABLE out + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +string(REPLACE "\n" ";" out "${out}") +list(SORT out) + +if("${out}" STREQUAL "${expected_out}") + message("PASSED with correct output: ${out}") +else() + message(FATAL_ERROR "FAILED: expected:\n${expected_out}\nGot:\n${out}") +endif() + +#------------------------------------------------------------------------------# +# Test 2: with optional argument: TARBALL_COMPRESSION "GZIP" +#------------------------------------------------------------------------------# + +set(tar_file ${CTEST_BINARY_DIRECTORY}/gcov.tgz) +ctest_coverage_collect_gcov( + TARBALL "${tar_file}" + TARBALL_COMPRESSION "GZIP" + SOURCE "${CTEST_SOURCE_DIRECTORY}" + BUILD "${CTEST_BINARY_DIRECTORY}" + GCOV_COMMAND "${CMAKE_COMMAND}" + GCOV_OPTIONS -P "@CMake_SOURCE_DIR@/Tests/CTestCoverageCollectGCOV/fakegcov.cmake") +file(REMOVE_RECURSE "${CTEST_BINARY_DIRECTORY}/uncovered") + +execute_process(COMMAND + ${CMAKE_COMMAND} -E tar tf ${tar_file} + OUTPUT_VARIABLE out + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +string(REPLACE "\n" ";" out "${out}") +list(SORT out) + +if("${out}" STREQUAL "${expected_out}") + message("PASSED with correct output: ${out}") +else() + message(FATAL_ERROR "FAILED: expected:\n${expected_out}\nGot:\n${out}") +endif() + +#------------------------------------------------------------------------------# +# Test 3: with optional argument: TARBALL_COMPRESSION "FROM_EXT" +#------------------------------------------------------------------------------# + +set(tar_file ${CTEST_BINARY_DIRECTORY}/gcov.txz) +ctest_coverage_collect_gcov( + TARBALL "${tar_file}" + TARBALL_COMPRESSION "FROM_EXT" + SOURCE "${CTEST_SOURCE_DIRECTORY}" + BUILD "${CTEST_BINARY_DIRECTORY}" + GCOV_COMMAND "${CMAKE_COMMAND}" + GCOV_OPTIONS -P "@CMake_SOURCE_DIR@/Tests/CTestCoverageCollectGCOV/fakegcov.cmake") +file(REMOVE_RECURSE "${CTEST_BINARY_DIRECTORY}/uncovered") + +execute_process(COMMAND + ${CMAKE_COMMAND} -E tar tf ${tar_file} + OUTPUT_VARIABLE out + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +string(REPLACE "\n" ";" out "${out}") +list(SORT out) + +if("${out}" STREQUAL "${expected_out}") + message("PASSED with correct output: ${out}") +else() + message(FATAL_ERROR "FAILED: expected:\n${expected_out}\nGot:\n${out}") +endif() + +#------------------------------------------------------------------------------# +# Test 4: with optional argument: TARBALL_COMPRESSION "FALSE" +#------------------------------------------------------------------------------# + set(tar_file ${CTEST_BINARY_DIRECTORY}/gcov.tar) ctest_coverage_collect_gcov( TARBALL "${tar_file}" + TARBALL_COMPRESSION "FALSE" SOURCE "${CTEST_SOURCE_DIRECTORY}" BUILD "${CTEST_BINARY_DIRECTORY}" GCOV_COMMAND "${CMAKE_COMMAND}" GCOV_OPTIONS -P "@CMake_SOURCE_DIR@/Tests/CTestCoverageCollectGCOV/fakegcov.cmake") +file(REMOVE_RECURSE "${CTEST_BINARY_DIRECTORY}/uncovered") execute_process(COMMAND ${CMAKE_COMMAND} -E tar tf ${tar_file} @@ -37,15 +142,36 @@ execute_process(COMMAND string(REPLACE "\n" ";" out "${out}") list(SORT out) -set(expected_out - CMakeFiles/myexecutable.dir/Labels.json - Testing/CoverageInfo/data.json - Testing/CoverageInfo/extra.cpp.gcov - Testing/CoverageInfo/main.cpp.gcov - uncovered/extra/uncovered1.cpp - uncovered/uncovered2.cpp +if("${out}" STREQUAL "${expected_out}") + message("PASSED with correct output: ${out}") +else() + message(FATAL_ERROR "FAILED: expected:\n${expected_out}\nGot:\n${out}") +endif() + +#------------------------------------------------------------------------------# +# Test 5: with optional argument: TARBALL_COMPRESSION "ZSTD" +#------------------------------------------------------------------------------# + +set(tar_file ${CTEST_BINARY_DIRECTORY}/gcov.zstd) +ctest_coverage_collect_gcov( + TARBALL "${tar_file}" + TARBALL_COMPRESSION "ZSTD" + SOURCE "${CTEST_SOURCE_DIRECTORY}" + BUILD "${CTEST_BINARY_DIRECTORY}" + GCOV_COMMAND "${CMAKE_COMMAND}" + GCOV_OPTIONS -P "@CMake_SOURCE_DIR@/Tests/CTestCoverageCollectGCOV/fakegcov.cmake") +file(REMOVE_RECURSE "${CTEST_BINARY_DIRECTORY}/uncovered") + +execute_process(COMMAND + ${CMAKE_COMMAND} -E tar tf ${tar_file} + OUTPUT_VARIABLE out + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + OUTPUT_STRIP_TRAILING_WHITESPACE ) +string(REPLACE "\n" ";" out "${out}") +list(SORT out) + if("${out}" STREQUAL "${expected_out}") message("PASSED with correct output: ${out}") else() diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index 072a993..2cec030 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -400,3 +400,108 @@ if(CMake_TEST_FindPython_IronPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) endif() + +if(CMake_TEST_FindPython_PyPy) + add_test(NAME FindPython.PyPy2.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy2" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy2.LOCATION" + ${build_generator_args} + --build-project TestPyPy2 + --build-options ${build_options} -DPython2_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.PyPy2.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy2" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy2.VERSION" + ${build_generator_args} + --build-project TestPyPy2 + --build-options ${build_options} -DPython2_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + + add_test(NAME FindPython.PyPy3.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.LOCATION" + ${build_generator_args} + --build-project TestPyPy3 + --build-options ${build_options} -DPython3_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.PyPy3.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.VERSION" + ${build_generator_args} + --build-project TestPyPy3 + --build-options ${build_options} -DPython3_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + + add_test(NAME FindPython.PyPy.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.LOCATION" + ${build_generator_args} + --build-project TestPyPy + --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.PyPy.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.VERSION" + ${build_generator_args} + --build-project TestPyPy + --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.PyPy.V2.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.LOCATION" + ${build_generator_args} + --build-project TestPyPy + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.PyPy.V2.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.VERSION" + ${build_generator_args} + --build-project TestPyPy + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.PyPy.V3.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.LOCATION" + ${build_generator_args} + --build-project TestPyPy + --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.PyPy.V3.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.VERSION" + ${build_generator_args} + --build-project TestPyPy + --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +endif() diff --git a/Tests/FindPython/PyPy/CMakeLists.txt b/Tests/FindPython/PyPy/CMakeLists.txt new file mode 100644 index 0000000..b4ade8c --- /dev/null +++ b/Tests/FindPython/PyPy/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPyPy C) + +set (Python_FIND_IMPLEMENTATIONS PyPy) + +find_package(Python ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Development) +if (NOT Python_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION}") +endif() + +if (NOT Python_Interpreter_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy Interpreter") +endif() +if (NOT Python_INTERPRETER_ID STREQUAL "PyPy") + message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})") +endif() + +if (NOT Python_Development.Module_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development.Module") +endif() +if (NOT Python_Development.Embed_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development.Embed") +endif() +if (NOT Python_Development_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development") +endif() + +if(NOT TARGET Python::Interpreter) + message(SEND_ERROR "Python::Interpreter not found") +endif() +if(NOT TARGET Python::Module) + message(SEND_ERROR "Python::Module not found") +endif() +if(NOT TARGET Python::Python) + message(SEND_ERROR "Python::Python not found") +endif() diff --git a/Tests/FindPython/PyPy2/CMakeLists.txt b/Tests/FindPython/PyPy2/CMakeLists.txt new file mode 100644 index 0000000..2f0ddc9 --- /dev/null +++ b/Tests/FindPython/PyPy2/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPyPy2 C) + +set (Python2_FIND_IMPLEMENTATIONS "PyPy") + +find_package(Python2 COMPONENTS Interpreter Development) +if (NOT Python2_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 2") +endif() + +if (NOT Python2_Interpreter_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 2 Interpreter") +endif() +if (NOT Python2_INTERPRETER_ID STREQUAL "PyPy") + message (FATAL_ERROR "Erroneous interpreter ID (${Python2_INTERPRETER_ID})") +endif() + +if (NOT Python2_Development.Module_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 2 Development.Module") +endif() +if (NOT Python2_Development.Embed_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 2 Development.Embed") +endif() +if (NOT Python2_Development_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 2 Development") +endif() + +if(NOT TARGET Python2::Interpreter) + message(SEND_ERROR "Python2::Interpreter not found") +endif() +if(NOT TARGET Python2::Module) + message(SEND_ERROR "Python2::Module not found") +endif() +if(NOT TARGET Python2::Python) + message(SEND_ERROR "Python2::Python not found") +endif() diff --git a/Tests/FindPython/PyPy3/CMakeLists.txt b/Tests/FindPython/PyPy3/CMakeLists.txt new file mode 100644 index 0000000..5562d57 --- /dev/null +++ b/Tests/FindPython/PyPy3/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPyPy3 C) + +set (Python3_FIND_IMPLEMENTATIONS "PyPy") + +find_package(Python3 COMPONENTS Interpreter Development) +if (NOT Python3_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 3") +endif() + +if (NOT Python3_Interpreter_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 3 Interpreter") +endif() +if (NOT Python3_INTERPRETER_ID STREQUAL "PyPy") + message (FATAL_ERROR "Erroneous interpreter ID (${Python3_INTERPRETER_ID})") +endif() + +if (NOT Python3_Development.Module_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 3 Development.Module") +endif() +if (NOT Python3_Development.Embed_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 3 Development.Embed") +endif() +if (NOT Python3_Development_FOUND) + message (FATAL_ERROR "Fail to found Python PyPy 3 Development") +endif() + +if(NOT TARGET Python3::Interpreter) + message(SEND_ERROR "Python3::Interpreter not found") +endif() +if(NOT TARGET Python3::Module) + message(SEND_ERROR "Python3::Module not found") +endif() +if(NOT TARGET Python3::Python) + message(SEND_ERROR "Python3::Python not found") +endif() diff --git a/Tests/RunCMake/FPHSA/FindUseComponents.cmake b/Tests/RunCMake/FPHSA/FindUseComponents.cmake new file mode 100644 index 0000000..4168f1d --- /dev/null +++ b/Tests/RunCMake/FPHSA/FindUseComponents.cmake @@ -0,0 +1,15 @@ +# pseudo find_module + +if (UseComponents_REQUIRE_VARS) + set(FOOBAR TRUE) + set(REQUIRED_VARS REQUIRED_VARS FOOBAR) +endif() + +set (UseComponents_Comp1_FOUND TRUE) +set (UseComponents_Comp2_FOUND TRUE) +set (UseComponents_Comp3_FOUND FALSE) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(UseComponents ${REQUIRED_VARS} + VERSION_VAR Pseudo_VERSION + HANDLE_COMPONENTS) diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake index 286915d..8e39090 100644 --- a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake +++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake @@ -47,3 +47,11 @@ run_cmake(custom_message_1) set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DCONFIG_MODE=TRUE") run_cmake(custom_message_2) run_cmake(custom_message_3) + +# check handling of components +set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DUseComponents_VERSION=1.2.3.4") +run_cmake(required_components) +run_cmake(required_and_optional_components) +run_cmake(all_optional_components) +list(APPEND RunCMake_TEST_OPTIONS "-DUseComponents_REQUIRE_VARS=TRUE") +run_cmake(required_components_with_vars) diff --git a/Tests/RunCMake/FPHSA/all_optional_components.cmake b/Tests/RunCMake/FPHSA/all_optional_components.cmake new file mode 100644 index 0000000..f4d8b5e --- /dev/null +++ b/Tests/RunCMake/FPHSA/all_optional_components.cmake @@ -0,0 +1,14 @@ +find_package(UseComponents OPTIONAL_COMPONENTS Comp1 Comp2 Comp3) + +if (NOT UseComponents_FOUND) + message (FATAL_ERROR "package UseComponents Not Found.") +endif() +if (NOT UseComponents_Comp1_FOUND) + message (FATAL_ERROR "package UseComponents, component Comp1 not found.") +endif() +if (NOT UseComponents_Comp2_FOUND) + message (FATAL_ERROR "package UseComponents, component Comp2 not found.") +endif() +if (UseComponents_Comp3_FOUND) + message (FATAL_ERROR "package UseComponents, component Comp2 unexpectedly found.") +endif() diff --git a/Tests/RunCMake/FPHSA/required_and_optional_components.cmake b/Tests/RunCMake/FPHSA/required_and_optional_components.cmake new file mode 100644 index 0000000..836dcac --- /dev/null +++ b/Tests/RunCMake/FPHSA/required_and_optional_components.cmake @@ -0,0 +1,14 @@ +find_package(UseComponents COMPONENTS Comp1 Comp2 OPTIONAL_COMPONENTS Comp3) + +if (NOT UseComponents_FOUND) + message (FATAL_ERROR "package UseComponents Not Found.") +endif() +if (NOT UseComponents_Comp1_FOUND) + message (FATAL_ERROR "package UseComponents, component Comp1 not found.") +endif() +if (NOT UseComponents_Comp2_FOUND) + message (FATAL_ERROR "package UseComponents, component Comp2 not found.") +endif() +if (UseComponents_Comp3_FOUND) + message (FATAL_ERROR "package UseComponents, component Comp2 unexpectedly found.") +endif() diff --git a/Tests/RunCMake/FPHSA/required_components.cmake b/Tests/RunCMake/FPHSA/required_components.cmake new file mode 100644 index 0000000..0dd8e9c --- /dev/null +++ b/Tests/RunCMake/FPHSA/required_components.cmake @@ -0,0 +1,11 @@ +find_package(UseComponents COMPONENTS Comp1 Comp2) + +if (NOT UseComponents_FOUND) + message (FATAL_ERROR "package UseComponents Not Found.") +endif() +if (NOT UseComponents_Comp1_FOUND) + message (FATAL_ERROR "package UseComponents, component Comp1 Not Found.") +endif() +if (NOT UseComponents_Comp2_FOUND) + message (FATAL_ERROR "package UseComponents, component Comp2 Not Found.") +endif() diff --git a/Tests/RunCMake/FPHSA/required_components_with_vars.cmake b/Tests/RunCMake/FPHSA/required_components_with_vars.cmake new file mode 100644 index 0000000..842ef15 --- /dev/null +++ b/Tests/RunCMake/FPHSA/required_components_with_vars.cmake @@ -0,0 +1 @@ +include ("required_components.cmake") diff --git a/Tests/RunCMake/ctest_start/NoStartTimeNightly-result.txt b/Tests/RunCMake/ctest_start/NoStartTimeNightly-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/ctest_start/NoStartTimeNightly-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/ctest_start/NoStartTimeNightly-stderr.txt b/Tests/RunCMake/ctest_start/NoStartTimeNightly-stderr.txt new file mode 100644 index 0000000..79756eb --- /dev/null +++ b/Tests/RunCMake/ctest_start/NoStartTimeNightly-stderr.txt @@ -0,0 +1,4 @@ +^WARNING: No nightly start time found please set in CTestConfig\.cmake or DartConfig\.cmake +CMake Error at [^ +]*/Tests/RunCMake/ctest_start/NoStartTimeNightly/test\.cmake:[0-9]+ \(ctest_start\): + ctest_start unknown error\.$ diff --git a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake index da85b39..f11f1ec 100644 --- a/Tests/RunCMake/ctest_start/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_start/RunCMakeTest.cmake @@ -48,6 +48,8 @@ run_ctest_start(TooManyArgs Experimental ${RunCMake_BINARY_DIR}/TooManyArgs-build ${RunCMake_BINARY_DIR}/TooManyArgs-build ${RunCMake_BINARY_DIR}/TooManyArgs-build) +run_ctest_start(NoStartTimeExperimental Experimental) +run_ctest_start(NoStartTimeNightly Nightly) function(run_ConfigInBuild) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ConfigInBuild-build) diff --git a/Tests/RunCMake/ctest_start/test.cmake.in b/Tests/RunCMake/ctest_start/test.cmake.in index 8cd3cff..4063ece 100644 --- a/Tests/RunCMake/ctest_start/test.cmake.in +++ b/Tests/RunCMake/ctest_start/test.cmake.in @@ -8,7 +8,9 @@ set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") -set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") +if(NOT "@CASE_NAME@" MATCHES "^NoStartTime") + set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") +endif() function(setup_tests) ctest_start(${ctest_start_args}) diff --git a/Utilities/std/CMakeLists.txt b/Utilities/std/CMakeLists.txt index a72abb7..17a7aaa 100644 --- a/Utilities/std/CMakeLists.txt +++ b/Utilities/std/CMakeLists.txt @@ -9,6 +9,7 @@ set(SRCS cm/bits/string_view.cxx cm/optional cm/shared_mutex cm/string_view - cm/utility) + cm/utility + cmext/string_view) add_library(cmstd STATIC ${SRCS}) diff --git a/Source/cm_static_string_view.hxx b/Utilities/std/cmext/string_view index 708ac95..ad52b11 100644 --- a/Source/cm_static_string_view.hxx +++ b/Utilities/std/cmext/string_view @@ -1,9 +1,10 @@ +// -*-c++-*- +// vim: set ft=cpp: + /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cm_static_string_view_hxx -#define cm_static_string_view_hxx - -#include "cmConfigure.h" // IWYU pragma: keep +#ifndef cmext_string_view +#define cmext_string_view #include <cstddef> |