diff options
55 files changed, 438 insertions, 212 deletions
diff --git a/Copyright.txt b/Copyright.txt index 743c634..0b0fbf1 100644 --- a/Copyright.txt +++ b/Copyright.txt @@ -39,6 +39,7 @@ The following individuals and institutions are among the Contributors: * Alexander Neundorf <neundorf@kde.org> * Alexander Smorkalov <alexander.smorkalov@itseez.com> * Alexey Sokolov <sokolov@google.com> +* Alex Merry <alex.merry@kde.org> * Alex Turbov <i.zaufi@gmail.com> * Andreas Pakulat <apaku@gmx.de> * Andreas Schneider <asn@cryptomilk.org> @@ -65,6 +66,7 @@ The following individuals and institutions are among the Contributors: * Kelly Thompson <kgt@lanl.gov> * Konstantin Podsvirov <konstantin@podsvirov.pro> * Mario Bensi <mbensi@ipsquad.net> +* Martin Gräßlin <mgraesslin@kde.org> * Mathieu Malaterre <mathieu.malaterre@gmail.com> * Matthaeus G. Chajdas * Matthias Kretz <kretz@kde.org> diff --git a/Help/command/install.rst b/Help/command/install.rst index 08c5718..98074d0 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -442,10 +442,6 @@ example, the code will print a message during installation. -The contents of ``SCRIPT`` or ``CODE`` may use "generator expressions" with -the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` -manual for available expressions. - Installing Exports ^^^^^^^^^^^^^^^^^^ diff --git a/Help/manual/cmake-language.7.rst b/Help/manual/cmake-language.7.rst index 591f73d..71649ba 100644 --- a/Help/manual/cmake-language.7.rst +++ b/Help/manual/cmake-language.7.rst @@ -391,8 +391,9 @@ inside out, e.g. ``${outer_${inner_variable}_variable}``. Literal variable references may consist of alphanumeric characters, the characters ``/_.+-``, and `Escape Sequences`_. Nested references -may be used to evaluate variables of any name. (See also policy -:policy:`CMP0053` documentation for historical considerations.) +may be used to evaluate variables of any name. See also policy +:policy:`CMP0053` documentation for historical considerations and reasons why +the ``$`` is also technically permitted but is discouraged. The `Variables`_ section documents the scope of variable names and how their values are set. diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index af8e33f..f9b4afb 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -165,6 +165,7 @@ They are normally called through the :command:`find_package` command. /module/FindLAPACK /module/FindLATEX /module/FindLibArchive + /module/FindLibinput /module/FindLibLZMA /module/FindLibXml2 /module/FindLibXslt diff --git a/Help/module/FindLibinput.rst b/Help/module/FindLibinput.rst new file mode 100644 index 0000000..a8ca0b0 --- /dev/null +++ b/Help/module/FindLibinput.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindLibinput.cmake diff --git a/Help/policy/CMP0053.rst b/Help/policy/CMP0053.rst index 2620a60..032b3e5 100644 --- a/Help/policy/CMP0053.rst +++ b/Help/policy/CMP0053.rst @@ -16,6 +16,10 @@ cleaned up to simplify the behavior. Specifically: * Literal ``${VAR}`` reference syntax may contain only alphanumeric characters (``A-Z``, ``a-z``, ``0-9``) and the characters ``_``, ``.``, ``/``, ``-``, and ``+``. + Note that ``$`` is technically allowed in the ``NEW`` behavior, but is + invalid for ``OLD`` behavior. This is due to an oversight during the + implementation of :policy:`CMP0053` and its use as a literal variable + reference is discouraged for this reason. Variables with other characters in their name may still be referenced indirectly, e.g. diff --git a/Help/prop_tgt/LANG_CPPCHECK.rst b/Help/prop_tgt/LANG_CPPCHECK.rst index 5f8be00..16b0f48 100644 --- a/Help/prop_tgt/LANG_CPPCHECK.rst +++ b/Help/prop_tgt/LANG_CPPCHECK.rst @@ -6,7 +6,9 @@ This property is supported only when ``<LANG>`` is ``C`` or ``CXX``. Specify a :ref:`;-list <CMake Language Lists>` containing a command line for the ``cppcheck`` static analysis tool. The :ref:`Makefile Generators` and the :generator:`Ninja` generator will run ``cppcheck`` along with the -compiler and report any problems. +compiler and report any problems. If the command-line specifies the +exit code options to ``cppcheck`` then the build will fail if the +tool returns non-zero. This property is initialized by the value of the :variable:`CMAKE_<LANG>_CPPCHECK` variable if it is set when a target is diff --git a/Help/release/3.13.rst b/Help/release/3.13.rst index b993775..ed5f17f 100644 --- a/Help/release/3.13.rst +++ b/Help/release/3.13.rst @@ -61,9 +61,6 @@ Commands * The :command:`add_link_options` command was created to add link options in the current directory. -* The :command:`install(CODE)` and :command:`install(SCRIPT)` commands - learned to support generator expressions. - * The :command:`install(TARGETS)` command learned to install targets created outside the current directory. diff --git a/Help/release/dev/cppcheck-exit-code.rst b/Help/release/dev/cppcheck-exit-code.rst new file mode 100644 index 0000000..d66c762 --- /dev/null +++ b/Help/release/dev/cppcheck-exit-code.rst @@ -0,0 +1,6 @@ +cppcheck-exit-code +------------------ + +* When using cppcheck via the :variable:`CMAKE_<LANG>_CPPCHECK` variable + or :prop_tgt:`<LANG>_CPPCHECK` property, the build will now fail if + ``cppcheck`` returns non-zero as configured by its command-line options. diff --git a/Help/release/dev/find_libinput.rst b/Help/release/dev/find_libinput.rst new file mode 100644 index 0000000..ebb9e7a --- /dev/null +++ b/Help/release/dev/find_libinput.rst @@ -0,0 +1,6 @@ +find_libinput +------------- + +* The :module:`FindLibinput` module was added to find `libinput`_. + +.. _`libinput`: https://www.freedesktop.org/wiki/Software/libinput/ diff --git a/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst b/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst index 513276e..a1fa1ff 100644 --- a/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst +++ b/Help/variable/CMAKE_DEBUG_TARGET_PROPERTIES.rst @@ -5,10 +5,19 @@ Enables tracing output for target properties. This variable can be populated with a list of properties to generate debug output for when evaluating target properties. Currently it can -only be used when evaluating the :prop_tgt:`INCLUDE_DIRECTORIES`, -:prop_tgt:`COMPILE_DEFINITIONS`, :prop_tgt:`COMPILE_OPTIONS`, -:prop_tgt:`AUTOUIC_OPTIONS`, :prop_tgt:`SOURCES`, :prop_tgt:`COMPILE_FEATURES`, -:prop_tgt:`POSITION_INDEPENDENT_CODE` target properties and any other property -listed in :prop_tgt:`COMPATIBLE_INTERFACE_STRING` and other -``COMPATIBLE_INTERFACE_`` properties. It outputs an origin for each entry in -the target property. Default is unset. +only be used when evaluating: + +* :prop_tgt:`AUTOUIC_OPTIONS` +* :prop_tgt:`COMPILE_DEFINITIONS` +* :prop_tgt:`COMPILE_FEATURES` +* :prop_tgt:`COMPILE_OPTIONS` +* :prop_tgt:`INCLUDE_DIRECTORIES` +* :prop_tgt:`LINK_DIRECTORIES` +* :prop_tgt:`LINK_OPTIONS` +* :prop_tgt:`POSITION_INDEPENDENT_CODE` +* :prop_tgt:`SOURCES` + +target properties and any other property listed in +:prop_tgt:`COMPATIBLE_INTERFACE_STRING` and other +``COMPATIBLE_INTERFACE_`` properties. It outputs an origin for each entry +in the target property. Default is unset. diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 37539ba..5090c60 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1740,6 +1740,7 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) list(APPEND _boost_RELEASE_NAMES ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED} ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} ) if(_boost_STATIC_RUNTIME_WORKAROUND) set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") diff --git a/Modules/FindLibinput.cmake b/Modules/FindLibinput.cmake new file mode 100644 index 0000000..1057c91 --- /dev/null +++ b/Modules/FindLibinput.cmake @@ -0,0 +1,83 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindLibinput +------------ + +Find libinput headers and library. + +Imported Targets +^^^^^^^^^^^^^^^^ + +``Libinput::Libinput`` + The libinput library, if found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables in your project: + +``Libinput_FOUND`` + true if (the requested version of) libinput is available. +``Libinput_VERSION`` + the version of libinput. +``Libinput_LIBRARIES`` + the libraries to link against to use libinput. +``Libinput_INCLUDE_DIRS`` + where to find the libinput headers. +``Libinput_COMPILE_OPTIONS`` + this should be passed to target_compile_options(), if the + target is not used for linking + +#]=======================================================================] + + +# Use pkg-config to get the directories and then use these values +# in the FIND_PATH() and FIND_LIBRARY() calls +find_package(PkgConfig QUIET) +pkg_check_modules(PKG_Libinput QUIET libinput) + +set(Libinput_COMPILE_OPTIONS ${PKG_Libinput_CFLAGS_OTHER}) +set(Libinput_VERSION ${PKG_Libinput_VERSION}) + +find_path(Libinput_INCLUDE_DIR + NAMES + libinput.h + HINTS + ${PKG_Libinput_INCLUDE_DIRS} +) +find_library(Libinput_LIBRARY + NAMES + input + HINTS + ${PKG_Libinput_LIBRARY_DIRS} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libinput + FOUND_VAR + Libinput_FOUND + REQUIRED_VARS + Libinput_LIBRARY + Libinput_INCLUDE_DIR + VERSION_VAR + Libinput_VERSION +) + +if(Libinput_FOUND AND NOT TARGET Libinput::Libinput) + add_library(Libinput::Libinput UNKNOWN IMPORTED) + set_target_properties(Libinput::Libinput PROPERTIES + IMPORTED_LOCATION "${Libinput_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${Libinput_COMPILE_OPTIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${Libinput_INCLUDE_DIR}" + ) +endif() + +mark_as_advanced(Libinput_LIBRARY Libinput_INCLUDE_DIR) + +if(Libinput_FOUND) + set(Libinput_LIBRARIES ${Libinput_LIBRARY}) + set(Libinput_INCLUDE_DIRS ${Libinput_INCLUDE_DIR}) + set(Libinput_VERSION_STRING ${Libinput_VERSION}) +endif() diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index a96df99..06beb7d 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -540,12 +540,15 @@ endmacro() :command:`target_link_libraries`. The ``GLOBAL`` argument will make the imported target available in global scope. - Each ``<moduleSpec>`` must be in one of the following formats:: - - {moduleName} ... matches any version - {moduleName}>={version} ... at least version <version> is required - {moduleName}={version} ... exactly version <version> is required - {moduleName}<={version} ... modules must not be newer than <version> + Each ``<moduleSpec>`` can be either a bare module name or it can be a + module name with a version constraint (operators ``=``, ``<``, ``>``, + ``<=`` and ``>=`` are supported). The following are examples for a module + named ``foo`` with various constraints:: + + foo # Any version matches + foo<2 # Only match versions before 2 + foo>=3.1 # Match any version from 3.1 or later + foo=1.2.3 # Foo must be exactly version 1.2.3 The following variables may be set upon return. Two sets of values exist, one for the common case (``<XXX> = <prefix>``) and another for the diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index a8a73a7..5b1ed4b 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -230,7 +230,7 @@ if (${_PYTHON_PREFIX}_FIND_VERSION_COUNT GREATER 1) endif() endif() -# Anaconda distribution: define which architectures can be used +# Python and Anaconda distributions: define which architectures can be used if (CMAKE_SIZEOF_VOID_P) # In this case, search only for 64bit or 32bit math (EXPR _${_PYTHON_PREFIX}_ARCH "${CMAKE_SIZEOF_VOID_P} * 8") @@ -336,9 +336,13 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) NAMES_PER_DIR HINTS ${_${_PYTHON_PREFIX}_HINTS} PATHS [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath] [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\IronPython\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] @@ -393,9 +397,13 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES} NAMES_PER_DIR PATHS [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath] [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\IronPython\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] @@ -463,6 +471,23 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) endif() if (${_PYTHON_PREFIX}_Interpreter_FOUND) + if (NOT CMAKE_SIZEOF_VOID_P) + # determine interpreter architecture + execute_process (COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; print(sys.maxsize > 2**32)" + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE ${_PYTHON_PREFIX}_IS64BIT + ERROR_VARIABLE ${_PYTHON_PREFIX}_IS64BIT) + if (NOT _${_PYTHON_PREFIX}_RESULT) + if (${_PYTHON_PREFIX}_IS64BIT) + set (_${_PYTHON_PREFIX}_ARCH 64) + set (_${_PYTHON_PREFIX}_ARCH2 64) + else() + set (_${_PYTHON_PREFIX}_ARCH 32) + set (_${_PYTHON_PREFIX}_ARCH2 32) + endif() + endif() + endif() + # retrieve interpreter identity execute_process (COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -V RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT @@ -769,9 +794,15 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS set (_${_PYTHON_PREFIX}_REGISTRY_PATHS [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath] [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath]) + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath]) if (APPLE AND _${_PYTHON_PREFIX}_FIND_FRAMEWORK STREQUAL "FIRST") find_library (${_PYTHON_PREFIX}_LIBRARY_RELEASE diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 3ac1ce2..6da87a8 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -121,6 +121,34 @@ unset(_PYTHON1_VERSIONS) unset(_PYTHON2_VERSIONS) unset(_PYTHON3_VERSIONS) +# Python distribution: define which architectures can be used +if (CMAKE_SIZEOF_VOID_P) + # In this case, search only for 64bit or 32bit + math (EXPR _PYTHON_ARCH "${CMAKE_SIZEOF_VOID_P} * 8") + set (_PYTHON_ARCH2 _PYTHON_PREFIX_ARCH}) +else() + if (PYTHON_EXECUTABLE) + # determine interpreter architecture + execute_process (COMMAND "${PYTHON_EXECUTABLE}" -c "import sys; print(sys.maxsize > 2**32)" + RESULT_VARIABLE _PYTHON_RESULT + OUTPUT_VARIABLE _PYTHON_IS64BIT + ERROR_VARIABLE _PYTHON_IS64BIT) + if (NOT _PYTHON_RESULT) + if (_PYTHON_IS64BIT) + set (_PYTHON_ARCH 64) + set (_PYTHON_ARCH2 64) + else() + set (_PYTHON_ARCH 32) + set (_PYTHON_ARCH2 32) + endif() + endif() + else() + # architecture unknown, search for both 64bit and 32bit + set (_PYTHON_ARCH 64) + set (_PYTHON_ARCH2 32) + endif() +endif() + foreach(_CURRENT_VERSION ${_Python_VERSIONS}) string(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION}) if(WIN32) @@ -130,9 +158,17 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) HINTS ${_Python_LIBRARY_PATH_HINT} PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH}\\InstallPath]/libs/Debug + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH2}\\InstallPath]/libs/Debug [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH}\\InstallPath]/libs/Debug + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH2}\\InstallPath]/libs/Debug [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH}\\InstallPath]/libs + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH2}\\InstallPath]/libs [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH}\\InstallPath]/libs + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH2}\\InstallPath]/libs ) endif() @@ -156,7 +192,11 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) PATHS ${PYTHON_FRAMEWORK_LIBRARIES} [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH}\\InstallPath]/libs + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH2}\\InstallPath]/libs [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH}\\InstallPath]/libs + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH2}\\InstallPath]/libs ) # Look for the static library in the Python config directory find_library(PYTHON_LIBRARY @@ -201,7 +241,11 @@ foreach(_CURRENT_VERSION ${_Python_VERSIONS}) PATHS ${PYTHON_FRAMEWORK_INCLUDES} [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH}\\InstallPath]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH2}\\InstallPath]/include [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH}\\InstallPath]/include + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}-${_PYTHON_ARCH2}\\InstallPath]/include PATH_SUFFIXES python${_CURRENT_VERSION}mu python${_CURRENT_VERSION}m diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4d3e783..afd6f42 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 13) -set(CMake_VERSION_PATCH 20181011) +set(CMake_VERSION_PATCH 20181017) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 6ad0e03..98872a5 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -467,6 +467,17 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP( cmSystemTools::ComputeFileHash(local_file, cmCryptoHash::AlgoMD5); } + // Generate Done.xml right before it is submitted. + // The reason for this is two-fold: + // 1) It must be generated after some other part has been submitted + // so we have a buildId to refer to in its contents. + // 2) By generating Done.xml here its timestamp will be as late as + // possible. This gives us a more accurate record of how long the + // entire build took to complete. + if (file == "Done.xml") { + this->CTest->GenerateDoneFile(); + } + if (!cmSystemTools::FileExists(local_file)) { cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find file: " << local_file << std::endl); @@ -1420,7 +1431,6 @@ int cmCTestSubmitHandler::ProcessHandler() // Submit Done.xml last if (this->SubmitPart[cmCTest::PartDone]) { - this->CTest->GenerateDoneFile(); files.push_back("Done.xml"); } diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx index 83dde3f..0722753 100644 --- a/Source/CTest/cmParseGTMCoverage.cxx +++ b/Source/CTest/cmParseGTMCoverage.cxx @@ -1,5 +1,6 @@ #include "cmParseGTMCoverage.h" +#include "cmAlgorithms.h" #include "cmCTest.h" #include "cmCTestCoverageHandler.h" #include "cmSystemTools.h" @@ -86,6 +87,10 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file) } // Find the full path to the file bool found = this->FindMumpsFile(routine, filepath); + if (!found && cmHasLiteralSuffix(routine, "%")) { + routine.erase(0, 1); + found = this->FindMumpsFile(routine, filepath); + } if (found) { int lineoffset = 0; if (this->FindFunctionInMumpsFile(filepath, function, lineoffset)) { @@ -192,8 +197,8 @@ bool cmParseGTMCoverage::ParseMCOVLine(std::string const& line, done = true; } } else { - // all chars except ", (, and % get stored in the arg string - if (cur != '\"' && cur != '(' && cur != '%') { + // all chars except " and ( get stored in the arg string + if (cur != '\"' && cur != '(') { arg.append(1, line[pos]); } } diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index cfd260c..e87eb1e 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -4,16 +4,6 @@ #include "cmMakefile.h" -cmCustomCommand::cmCustomCommand() - : Backtrace() -{ - this->HaveComment = false; - this->EscapeOldStyle = true; - this->EscapeAllowMakeVars = false; - this->UsesTerminal = false; - this->CommandExpandLists = false; -} - cmCustomCommand::cmCustomCommand(cmMakefile const* mf, const std::vector<std::string>& outputs, const std::vector<std::string>& byproducts, diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index 9e82f25..d82160b 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -22,9 +22,6 @@ class cmMakefile; class cmCustomCommand { public: - /** Default and copy constructors for STL containers. */ - cmCustomCommand(); - /** Main constructor specifies all information for the command. */ cmCustomCommand(cmMakefile const* mf, const std::vector<std::string>& outputs, @@ -103,11 +100,11 @@ private: std::string Comment; std::string WorkingDirectory; std::string Depfile; - bool HaveComment; - bool EscapeAllowMakeVars; - bool EscapeOldStyle; - bool UsesTerminal; - bool CommandExpandLists; + bool HaveComment = false; + bool EscapeAllowMakeVars = false; + bool EscapeOldStyle = true; + bool UsesTerminal = false; + bool CommandExpandLists = false; }; #endif diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 80fb621..ea283c6 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1730,7 +1730,7 @@ bool cmGeneratorTarget::HaveWellDefinedOutputFiles() const this->GetType() == cmStateEnums::EXECUTABLE; } -const char* cmGeneratorTarget::GetExportMacro() const +const std::string* cmGeneratorTarget::GetExportMacro() const { // Define the symbol for targets that export symbols. if (this->GetType() == cmStateEnums::SHARED_LIBRARY || @@ -1743,7 +1743,7 @@ const char* cmGeneratorTarget::GetExportMacro() const in += "_EXPORTS"; this->ExportMacro = cmSystemTools::MakeCidentifier(in); } - return this->ExportMacro.c_str(); + return &this->ExportMacro; } return nullptr; } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index b1daa53..98669c3 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -283,7 +283,7 @@ public: /** Get the macro to define when building sources in this target. If no macro should be defined null is returned. */ - const char* GetExportMacro() const; + const std::string* GetExportMacro() const; /** Get the soname of the target. Allowed only for a shared library. */ std::string GetSOName(const std::string& config) const; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e353a37..596bc6b 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1814,9 +1814,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, BuildObjectListOrString ppDefs(this, true); this->AppendDefines( ppDefs, "CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\""); - if (const char* exportMacro = gtgt->GetExportMacro()) { + if (const std::string* exportMacro = gtgt->GetExportMacro()) { // Add the export symbol definition for shared library objects. - this->AppendDefines(ppDefs, exportMacro); + this->AppendDefines(ppDefs, exportMacro->c_str()); } std::vector<std::string> targetDefines; if (!langForPreprocessor.empty()) { diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index 1d7784e..7d77b7c 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -2,7 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmInstallScriptGenerator.h" -#include "cmGeneratorExpression.h" #include "cmScriptGenerator.h" #include <ostream> @@ -17,47 +16,24 @@ cmInstallScriptGenerator::cmInstallScriptGenerator(const char* script, , Script(script) , Code(code) { - // We need per-config actions if the script has generator expressions. - if (cmGeneratorExpression::Find(Script) != std::string::npos) { - this->ActionsPerConfig = true; - } } cmInstallScriptGenerator::~cmInstallScriptGenerator() { } -void cmInstallScriptGenerator::Compute(cmLocalGenerator* lg) +void cmInstallScriptGenerator::GenerateScript(std::ostream& os) { - this->LocalGenerator = lg; -} + Indent indent; + std::string component_test = + this->CreateComponentTest(this->Component.c_str(), this->ExcludeFromAll); + os << indent << "if(" << component_test << ")\n"; -void cmInstallScriptGenerator::AddScriptInstallRule(std::ostream& os, - Indent indent, - std::string const& script) -{ if (this->Code) { - os << indent << script << "\n"; - } else { - os << indent << "include(\"" << script << "\")\n"; - } -} - -void cmInstallScriptGenerator::GenerateScriptActions(std::ostream& os, - Indent indent) -{ - if (this->ActionsPerConfig) { - this->cmInstallGenerator::GenerateScriptActions(os, indent); + os << indent << this->Script << "\n"; } else { - this->AddScriptInstallRule(os, indent, this->Script); + os << indent << "include(\"" << this->Script << "\")\n"; } -} -void cmInstallScriptGenerator::GenerateScriptForConfig( - std::ostream& os, const std::string& config, Indent indent) -{ - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(this->Script); - this->AddScriptInstallRule(os, indent, - cge->Evaluate(this->LocalGenerator, config)); + os << indent << "endif()\n\n"; } diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index 534bc1d..fe0f7c6 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -6,13 +6,10 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmInstallGenerator.h" -#include "cmScriptGenerator.h" #include <iosfwd> #include <string> -class cmLocalGenerator; - /** \class cmInstallScriptGenerator * \brief Generate target installation rules. */ @@ -23,18 +20,10 @@ public: const char* component, bool exclude_from_all); ~cmInstallScriptGenerator() override; - void Compute(cmLocalGenerator* lg) override; - protected: - void GenerateScriptActions(std::ostream& os, Indent indent) override; - void GenerateScriptForConfig(std::ostream& os, const std::string& config, - Indent indent) override; - void AddScriptInstallRule(std::ostream& os, Indent indent, - std::string const& script); - + void GenerateScript(std::ostream& os) override; std::string Script; bool Code; - cmLocalGenerator* LocalGenerator; }; #endif diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 229f884..941d787 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1253,8 +1253,8 @@ void cmLocalGenerator::GetTargetDefines(cmGeneratorTarget const* target, std::set<std::string>& defines) const { // Add the export symbol definition for shared library objects. - if (const char* exportMacro = target->GetExportMacro()) { - this->AppendDefines(defines, exportMacro); + if (const std::string* exportMacro = target->GetExportMacro()) { + this->AppendDefines(defines, *exportMacro); } // Add preprocessor definitions for this target and configuration. diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 8428672..1da077e 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -735,8 +735,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( targetOptions.AddDefine(configDefine); // Add the export symbol definition for shared library objects. - if (const char* exportMacro = target->GetExportMacro()) { - targetOptions.AddDefine(exportMacro); + if (const std::string* exportMacro = target->GetExportMacro()) { + targetOptions.AddDefine(*exportMacro); } // The intermediate directory name consists of a directory for the diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 2d39cbb..7383efd 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -45,24 +45,21 @@ struct cmVisualStudio10TargetGenerator::Elem bool HasContent = false; std::string Tag; - Elem(std::ostream& s) + Elem(std::ostream& s, const char* tag) : S(s) , Indent(0) + , Tag(tag) { + this->StartElement(); } Elem(const Elem&) = delete; - Elem(Elem& par) - : S(par.S) - , Indent(par.Indent + 1) - { - par.SetHasElements(); - } Elem(Elem& par, const char* tag) : S(par.S) , Indent(par.Indent + 1) + , Tag(tag) { par.SetHasElements(); - this->StartElement(tag); + this->StartElement(); } void SetHasElements() { @@ -72,12 +69,7 @@ struct cmVisualStudio10TargetGenerator::Elem } } std::ostream& WriteString(const char* line); - Elem& StartElement(const std::string& tag) - { - this->Tag = tag; - this->WriteString("<") << tag; - return *this; - } + void StartElement() { this->WriteString("<") << this->Tag; } void Element(const char* tag, const std::string& val) { Elem(*this, tag).Content(val); @@ -87,8 +79,6 @@ struct cmVisualStudio10TargetGenerator::Elem this->S << " " << an << "=\"" << cmVS10EscapeAttr(av) << "\""; return *this; } - // This method for now assumes that this->Tag has been set, e.g. by calling - // StartElement(). void Content(const std::string& val) { if (!this->HasContent) { @@ -380,8 +370,7 @@ void cmVisualStudio10TargetGenerator::Generate() << this->GlobalGenerator->Encoding() << "\"?>" << "\n"; { - Elem e0(BuildFileStream); - e0.StartElement("Project"); + Elem e0(BuildFileStream, "Project"); e0.Attribute("DefaultTargets", "Build"); e0.Attribute("ToolsVersion", this->GlobalGenerator->GetToolsVersion()); e0.Attribute("xmlns", @@ -922,8 +911,8 @@ void cmVisualStudio10TargetGenerator::WriteXamlFilesGroup(Elem& e0) xamlType = "Page"; } - Elem e2(e1); - this->WriteSource(e2, xamlType, oi); + Elem e2(e1, xamlType); + this->WriteSource(e2, oi); e2.SetHasElements(); if (this->ProjectType == csproj && !this->InSourceBuild) { // add <Link> tag to written XAML source if necessary @@ -1275,15 +1264,15 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( std::unique_ptr<Elem> spe2; if (this->ProjectType != csproj) { spe1 = cm::make_unique<Elem>(e0, "ItemGroup"); - spe2 = cm::make_unique<Elem>(*spe1); - this->WriteSource(*spe2, "CustomBuild", source); + spe2 = cm::make_unique<Elem>(*spe1, "CustomBuild"); + this->WriteSource(*spe2, source); spe2->SetHasElements(); } else { Elem e1(e0, "ItemGroup"); - Elem e2(e1); + Elem e2(e1, "None"); std::string link; this->GetCSharpSourceLink(source, link); - this->WriteSource(e2, "None", source); + this->WriteSource(e2, source); e2.SetHasElements(); if (!link.empty()) { e2.Element("Link", link); @@ -1417,8 +1406,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() << this->GlobalGenerator->Encoding() << "\"?>" << "\n"; { - Elem e0(fout); - e0.StartElement("Project"); + Elem e0(fout, "Project"); e0.Attribute("ToolsVersion", this->GlobalGenerator->GetToolsVersion()); e0.Attribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003"); @@ -1569,8 +1557,8 @@ void cmVisualStudio10TargetGenerator::WriteHeaderSource(Elem& e1, cmSourceFile const* sf) { std::string const& fileName = sf->GetFullPath(); - Elem e2(e1); - this->WriteSource(e2, "ClInclude", sf); + Elem e2(e1, "ClInclude"); + this->WriteSource(e2, sf); if (this->IsResxHeader(fileName)) { e2.Element("FileType", "CppForm"); } else if (this->IsXamlHeader(fileName)) { @@ -1738,8 +1726,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1, } } - Elem e2(e1); - this->WriteSource(e2, tool, sf); + Elem e2(e1, tool); + this->WriteSource(e2, sf); if (toolHasSettings) { e2.SetHasElements(); @@ -1859,7 +1847,6 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1, } void cmVisualStudio10TargetGenerator::WriteSource(Elem& e2, - std::string const& tool, cmSourceFile const* sf) { // Visual Studio tools append relative paths to the current dir, as in: @@ -1895,11 +1882,10 @@ void cmVisualStudio10TargetGenerator::WriteSource(Elem& e2, } } ConvertToWindowsSlash(sourceFile); - e2.StartElement(tool); e2.Attribute("Include", sourceFile); ToolSource toolSource = { sf, forceRelative }; - this->Tools[tool].push_back(toolSource); + this->Tools[e2.Tag].push_back(toolSource); } void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) @@ -2003,8 +1989,8 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) include_configs.begin(), include_configs.end(), std::back_inserter(exclude_configs)); - Elem e2(e1); - this->WriteSource(e2, tool, si.Source); + Elem e2(e1, tool); + this->WriteSource(e2, si.Source); if (si.Kind == cmGeneratorTarget::SourceKindObjectSource) { this->OutputSourceSpecificFlags(e2, si.Source); } @@ -2580,8 +2566,9 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( configDefine += configName; configDefine += "\""; clOptions.AddDefine(configDefine); - if (const char* exportMacro = this->GeneratorTarget->GetExportMacro()) { - clOptions.AddDefine(exportMacro); + if (const std::string* exportMacro = + this->GeneratorTarget->GetExportMacro()) { + clOptions.AddDefine(*exportMacro); } if (this->MSTools) { @@ -2877,8 +2864,9 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( configDefine += configName; configDefine += "\""; cudaOptions.AddDefine(configDefine); - if (const char* exportMacro = this->GeneratorTarget->GetExportMacro()) { - cudaOptions.AddDefine(exportMacro); + if (const std::string* exportMacro = + this->GeneratorTarget->GetExportMacro()) { + cudaOptions.AddDefine(*exportMacro); } // Get includes for this target @@ -3882,15 +3870,13 @@ void cmVisualStudio10TargetGenerator::WriteSinglePlatformExtension( void cmVisualStudio10TargetGenerator::WriteSDKReferences(Elem& e0) { std::vector<std::string> sdkReferences; - Elem e1(e0); - bool hasWrittenItemGroup = false; + std::unique_ptr<Elem> spe1; if (const char* vsSDKReferences = this->GeneratorTarget->GetProperty("VS_SDK_REFERENCES")) { cmSystemTools::ExpandListArgument(vsSDKReferences, sdkReferences); - e1.StartElement("ItemGroup"); - hasWrittenItemGroup = true; + spe1 = cm::make_unique<Elem>(e0, "ItemGroup"); for (std::string const& ri : sdkReferences) { - Elem(e1, "SDKReference").Attribute("Include", ri); + Elem(*spe1, "SDKReference").Attribute("Include", ri); } } @@ -3906,19 +3892,20 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences(Elem& e0) if (desktopExtensionsVersion || mobileExtensionsVersion || iotExtensionsVersion) { - if (!hasWrittenItemGroup) { - e1.StartElement("ItemGroup"); + if (!spe1) { + spe1 = cm::make_unique<Elem>(e0, "ItemGroup"); } if (desktopExtensionsVersion) { - this->WriteSingleSDKReference(e1, "WindowsDesktop", + this->WriteSingleSDKReference(*spe1, "WindowsDesktop", desktopExtensionsVersion); } if (mobileExtensionsVersion) { - this->WriteSingleSDKReference(e1, "WindowsMobile", + this->WriteSingleSDKReference(*spe1, "WindowsMobile", mobileExtensionsVersion); } if (iotExtensionsVersion) { - this->WriteSingleSDKReference(e1, "WindowsIoT", iotExtensionsVersion); + this->WriteSingleSDKReference(*spe1, "WindowsIoT", + iotExtensionsVersion); } } } diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 0dc03b6..b17b5f8 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -63,7 +63,7 @@ private: void WriteExtraSource(Elem& e1, cmSourceFile const* sf); void WriteNsightTegraConfigurationValues(Elem& e1, std::string const& config); - void WriteSource(Elem& e2, std::string const& tool, cmSourceFile const* sf); + void WriteSource(Elem& e2, cmSourceFile const* sf); void WriteExcludeFromBuild(Elem& e2, std::vector<size_t> const& exclude_configs); void WriteAllSources(Elem& e0); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 1d2f741..e2225ff 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -323,11 +323,15 @@ static int HandleCppCheck(const std::string& runCmd, stdErr.find("(performance)") != std::string::npos || stdErr.find("(portability)") != std::string::npos || stdErr.find("(information)") != std::string::npos) { - std::cerr << "Warning: cppcheck reported diagnostics:\n"; + if (ret == 0) { + std::cerr << "Warning: cppcheck reported diagnostics:\n"; + } else { + std::cerr << "Error: cppcheck reported failure:\n"; + } } std::cerr << stdErr; - // ignore errors so build continues - return 0; + + return ret; } typedef int (*CoCompileHandler)(const std::string&, const std::string&, diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 0de6c41..2b2ac95 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1409,6 +1409,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindLibRHash) endif() + if(CMake_TEST_FindLibinput) + add_subdirectory(FindLibinput) + endif() + if(CMake_TEST_FindLibUV) add_subdirectory(FindLibUV) endif() @@ -2665,7 +2669,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release $<TARGET_FILE:ctest> -T Coverage --debug) set_tests_properties(CTestGTMCoverage PROPERTIES PASS_REGULAR_EXPRESSION - "Process file.*ZZCOVTST.m.*Total LOC:.*30.*Percentage Coverage: 80.00*" + "Process file.*ZZCOVTST.m.*Total LOC:.*32.*Percentage Coverage: 81.25*" ENVIRONMENT COVFILE=) configure_file( @@ -2683,7 +2687,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release $<TARGET_FILE:ctest> -T Coverage --debug) set_tests_properties(CTestCacheCoverage PROPERTIES PASS_REGULAR_EXPRESSION - "Process file.*ZZCOVTST.m.*Total LOC:.*29.*Percentage Coverage: 86.21.*" + "Process file.*ZZCOVTST.m.*Total LOC:.*32.*Percentage Coverage: 87.50.*" ENVIRONMENT COVFILE=) # Adding a test case for Python Coverage diff --git a/Tests/FindLibinput/CMakeLists.txt b/Tests/FindLibinput/CMakeLists.txt new file mode 100644 index 0000000..8538a55 --- /dev/null +++ b/Tests/FindLibinput/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindLibinput.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindLibinput/Test" + "${CMake_BINARY_DIR}/Tests/FindLibinput/Test" + ${build_generator_args} + --build-project TestFindLibinput + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindLibinput/Test/CMakeLists.txt b/Tests/FindLibinput/Test/CMakeLists.txt new file mode 100644 index 0000000..1cc68d4 --- /dev/null +++ b/Tests/FindLibinput/Test/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.10) +project(TestFindLibinput C) +include(CTest) + +find_package(Libinput REQUIRED) + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt Libinput::Libinput) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${Libinput_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${Libinput_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindLibinput/Test/main.c b/Tests/FindLibinput/Test/main.c new file mode 100644 index 0000000..3919962 --- /dev/null +++ b/Tests/FindLibinput/Test/main.c @@ -0,0 +1,13 @@ +#include <libinput.h> +#include <stdio.h> + +int main() +{ + struct libinput_interface interface; + interface.open_restricted = 0; + interface.close_restricted = 0; + struct libinput* li; + li = libinput_udev_create_context(&interface, NULL, NULL); + printf("Found Libinput.\n"); + return 0; +} diff --git a/Tests/MumpsCoverage/VistA-FOIA/Packages/Uncategorized/ZZCOVTST.m b/Tests/MumpsCoverage/VistA-FOIA/Packages/Uncategorized/ZZCOVTST.m index ee70682..5567c4e 100644 --- a/Tests/MumpsCoverage/VistA-FOIA/Packages/Uncategorized/ZZCOVTST.m +++ b/Tests/MumpsCoverage/VistA-FOIA/Packages/Uncategorized/ZZCOVTST.m @@ -12,6 +12,9 @@ EN ; This entry point shouldn't be found without fixing ; This line not executable D T6^ZZCOVTST ; +% ; a line to test for a problem where % was dropped + N Do,Re,Mi + S Do="A#" T1 ; This line should always be found N D S D=2 diff --git a/Tests/MumpsCoverage/ZZCOVTST.cmcov b/Tests/MumpsCoverage/ZZCOVTST.cmcov index aec9336..12f2aa6 100644 --- a/Tests/MumpsCoverage/ZZCOVTST.cmcov +++ b/Tests/MumpsCoverage/ZZCOVTST.cmcov @@ -13,33 +13,36 @@ ZZCOVTST,1,1,"ZZCOVTST;OSEHRA/JPS -- Test routine for Coverage Parsing;4/28/2014 ,12,1," Q" ,13,0," ; This line not executable" ,14,0," ;" -,15,0,"T1 ; This line should always be found" -,16,1," N D" -,17,1," S D=2" -,18,1," W !,D,!,""This is the second entry point"",!" -,19,1," D T2^ZZCOVTST(D)" -,20,1," Q" -,21,0," ;" -,22,0,"T2(EQ) ; This is debatable and only called with ENT^ROU notation" -,23,1," N D" -,24,1," S D=3" -,25,1," W !,D,!,EQ,""This is the third entry point"",!" -,26,1," D T3^ZZCOVTST" -,27,1," Q" -,28,0," ;" -,29,1,"T3 N D S D=4 W D,!,""Fourth Entry point"",! Q" -,30,0," ;" -,31,0,"T4 N D S D=5 W ""Shouldn't be executed""" -,32,0," W ""Lots to not do""" -,33,0," Q" -,34,1,"T5(EQ) ;this entry point is called with a $$ notation" -,35,1," W ""THIS IS THE $$ NOTATION!"",!" -,36,1," Q 0" -,37,0,"T6 ; An entry point to show comments inside of ""DO"" blocks" -,38,1," D" -,39,1," . W ""This is executable code"",!" -,40,0," . ; This is a comment inside the do block, not executable" -,41,1," . S ZZBLAH=""blah""" -,42,1," W ""Ending T6"",!" -,43,0," ;" -Totals for ZZCOVTST,,25, +,15,1,"% ; a line to test for a problem where % was dropped" +,16,1,"N Do,Re,Mi" +,17,1,"S Do=""A#""" +,18,0,"T1 ; This line should always be found" +,19,1," N D" +,20,1," S D=2" +,21,1," W !,D,!,""This is the second entry point"",!" +,22,1," D T2^ZZCOVTST(D)" +,23,1," Q" +,24,0," ;" +,25,0,"T2(EQ) ; This is debatable and only called with ENT^ROU notation" +,26,1," N D" +,27,1," S D=3" +,28,1," W !,D,!,EQ,""This is the third entry point"",!" +,29,1," D T3^ZZCOVTST" +,30,1," Q" +,31,0," ;" +,32,1,"T3 N D S D=4 W D,!,""Fourth Entry point"",! Q" +,33,0," ;" +,34,0,"T4 N D S D=5 W ""Shouldn't be executed""" +,35,0," W ""Lots to not do""" +,36,0," Q" +,37,1,"T5(EQ) ;this entry point is called with a $$ notation" +,38,1," W ""THIS IS THE $$ NOTATION!"",!" +,39,1," Q 0" +,40,0,"T6 ; An entry point to show comments inside of ""DO"" blocks" +,41,1," D" +,42,1," . W ""This is executable code"",!" +,43,0," . ; This is a comment inside the do block, not executable" +,44,1," . S ZZBLAH=""blah""" +,45,1," W ""Ending T6"",!" +,46,0," ;" +Toals for ZZCOVTST,,28, diff --git a/Tests/MumpsCoverage/ZZCOVTST.mcov b/Tests/MumpsCoverage/ZZCOVTST.mcov index b2608d9..e1fa18c 100644 --- a/Tests/MumpsCoverage/ZZCOVTST.mcov +++ b/Tests/MumpsCoverage/ZZCOVTST.mcov @@ -9,6 +9,9 @@ GT.M 15-AUG-2014 10:14:32 ZWR ^ZZCOVERAGE("ZZCOVTST","EN",4)="1:0:0:0:74" ^ZZCOVERAGE("ZZCOVTST","EN",5)="1:0:0:0:66" ^ZZCOVERAGE("ZZCOVTST","EN",6)="1:0:0:0:40" +^ZZCOVERAGE("ZZCOVTST","%")="2:0:0:0:208" +^ZZCOVERAGE("ZZCOVTST","%",1)="2:0:0:0:208" +^ZZCOVERAGE("ZZCOVTST","%",2)="2:0:0:0:208" ^ZZCOVERAGE("ZZCOVTST","T1")="1:0:0:0:208" ^ZZCOVERAGE("ZZCOVTST","T1",1)="1:0:0:0:23" ^ZZCOVERAGE("ZZCOVTST","T1",2)="1:0:0:0:24" diff --git a/Tests/RunCMake/Cppcheck/C-bad-Build-result.txt b/Tests/RunCMake/Cppcheck/C-bad-Build-result.txt index 573541a..d197c91 100644 --- a/Tests/RunCMake/Cppcheck/C-bad-Build-result.txt +++ b/Tests/RunCMake/Cppcheck/C-bad-Build-result.txt @@ -1 +1 @@ -0 +[^0] diff --git a/Tests/RunCMake/Cppcheck/C-error-Build-result.txt b/Tests/RunCMake/Cppcheck/C-error-Build-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/C-error-Build-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/Cppcheck/C-error-Build-stdout.txt b/Tests/RunCMake/Cppcheck/C-error-Build-stdout.txt new file mode 100644 index 0000000..4a24c0c --- /dev/null +++ b/Tests/RunCMake/Cppcheck/C-error-Build-stdout.txt @@ -0,0 +1 @@ +.*Error: cppcheck reported failure.*error.*warning.*style.*performance.*information.* diff --git a/Tests/RunCMake/Cppcheck/C-error.cmake b/Tests/RunCMake/Cppcheck/C-error.cmake new file mode 100644 index 0000000..2254d75 --- /dev/null +++ b/Tests/RunCMake/Cppcheck/C-error.cmake @@ -0,0 +1,3 @@ +enable_language(C) +set(CMAKE_C_CPPCHECK "${PSEUDO_CPPCHECK}" -error) +add_executable(main main.c) diff --git a/Tests/RunCMake/Cppcheck/RunCMakeTest.cmake b/Tests/RunCMake/Cppcheck/RunCMakeTest.cmake index 5fd4ead..e395f36 100644 --- a/Tests/RunCMake/Cppcheck/RunCMakeTest.cmake +++ b/Tests/RunCMake/Cppcheck/RunCMakeTest.cmake @@ -15,6 +15,7 @@ endfunction() run_cppcheck(C) run_cppcheck(CXX) +run_cppcheck(C-error) run_cppcheck(C-bad) if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW-stderr.txt new file mode 100644 index 0000000..7f248ae --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW-stderr.txt @@ -0,0 +1,2 @@ +^-->value<-- +-->value<--$ diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW.cmake b/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW.cmake new file mode 100644 index 0000000..b81fd56 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-NEW.cmake @@ -0,0 +1,6 @@ +cmake_policy(SET CMP0053 NEW) + +set($ value) +set(dollar $) +message("-->${${dollar}}<--") +message("-->${$}<--") diff --git a/Tests/RunCMake/install/CODE-genex-bad-result.txt b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/install/CODE-genex-bad-result.txt +++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-result.txt diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt new file mode 100644 index 0000000..aecd4d3 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD-stderr.txt @@ -0,0 +1,24 @@ +^CMake Deprecation Warning at CMP0053-Dollar-OLD.cmake:1 \(cmake_policy\): + The OLD behavior for policy CMP0053 will be removed from a future version + of CMake. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +-->value<-- +CMake Error at CMP0053-Dollar-OLD.cmake:6 \(message\): + Syntax error in cmake code at + + .*CMP0053-Dollar-OLD.cmake:6 + + when parsing string + + -->\${\$}<-- + + syntax error, unexpected \$, expecting } \(7\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD.cmake b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD.cmake new file mode 100644 index 0000000..647f464 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-Dollar-OLD.cmake @@ -0,0 +1,6 @@ +cmake_policy(SET CMP0053 OLD) + +set($ value) +set(dollar $) +message("-->${${dollar}}<--") +message("-->${$}<--") diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index a397620..8d74dc1 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -111,6 +111,8 @@ run_cmake(CMP0053-NameWithNewlineQuoted) run_cmake(CMP0053-NameWithCarriageReturnQuoted) run_cmake(CMP0053-NameWithEscapedSpacesQuoted) run_cmake(CMP0053-NameWithEscapedTabsQuoted) +run_cmake(CMP0053-Dollar-OLD) +run_cmake(CMP0053-Dollar-NEW) # Variable special types run_cmake(QueryCache) diff --git a/Tests/RunCMake/install/CODE-genex-bad-stderr.txt b/Tests/RunCMake/install/CODE-genex-bad-stderr.txt deleted file mode 100644 index 9844158..0000000 --- a/Tests/RunCMake/install/CODE-genex-bad-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error: - Error evaluating generator expression: - - \$<NOTAGENEX> - - Expression did not evaluate to a known generator expression diff --git a/Tests/RunCMake/install/CODE-genex-bad.cmake b/Tests/RunCMake/install/CODE-genex-bad.cmake deleted file mode 100644 index 1663b39..0000000 --- a/Tests/RunCMake/install/CODE-genex-bad.cmake +++ /dev/null @@ -1 +0,0 @@ -install(CODE "message(\"$<NOTAGENEX>\")") diff --git a/Tests/RunCMake/install/CODE-genex-check.cmake b/Tests/RunCMake/install/CODE-genex-check.cmake deleted file mode 100644 index 422c532..0000000 --- a/Tests/RunCMake/install/CODE-genex-check.cmake +++ /dev/null @@ -1,7 +0,0 @@ -execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake - OUTPUT_VARIABLE out ERROR_VARIABLE err) -if(NOT out MATCHES "-- Install configuration: .*-- codegenexlib") - string(REGEX REPLACE "\n" "\n " out " ${out}") - string(APPEND RunCMake_TEST_FAILED - "\"-- codegenexlib\" was not found:\n${out}") -endif() diff --git a/Tests/RunCMake/install/CODE-genex.cmake b/Tests/RunCMake/install/CODE-genex.cmake deleted file mode 100644 index 3b8513d..0000000 --- a/Tests/RunCMake/install/CODE-genex.cmake +++ /dev/null @@ -1,2 +0,0 @@ -add_library( codegenexlib INTERFACE ) -install(CODE "message( STATUS \"$<TARGET_PROPERTY:codegenexlib,NAME>\")") diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index 91524a6..ec022ca 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -65,8 +65,6 @@ run_cmake(CMP0062-NEW) run_cmake(CMP0062-WARN) run_cmake(TARGETS-NAMELINK_COMPONENT-bad-all) run_cmake(TARGETS-NAMELINK_COMPONENT-bad-exc) -run_cmake(CODE-genex) -run_cmake(CODE-genex-bad) if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") run_install_test(FILES-TARGET_OBJECTS) diff --git a/Tests/RunCMake/pseudo_cppcheck.c b/Tests/RunCMake/pseudo_cppcheck.c index 75f3cec..5b1531b 100644 --- a/Tests/RunCMake/pseudo_cppcheck.c +++ b/Tests/RunCMake/pseudo_cppcheck.c @@ -5,13 +5,16 @@ int main(int argc, char* argv[]) { int i; + int result = 0; for (i = 1; i < argc; ++i) { - if (strcmp(argv[i], "-bad") == 0) - if (strcmp(argv[i], "-bad") == 0) { - fprintf(stdout, "stdout from bad command line arg '-bad'\n"); - fprintf(stderr, "stderr from bad command line arg '-bad'\n"); - return 1; - } + if (strcmp(argv[i], "-bad") == 0) { + fprintf(stdout, "stdout from bad command line arg '-bad'\n"); + fprintf(stderr, "stderr from bad command line arg '-bad'\n"); + return 1; + } else if (strcmp(argv[i], "-error") == 0) { + // The real cppcheck allows to set the exitcode with --error-exitcode + result = 5; + } } fprintf(stderr, "[/foo/bar.c:2]: (error) Array 'abc[10]' accessed at index 12," @@ -31,6 +34,6 @@ int main(int argc, char* argv[]) fprintf(stderr, "[/foo/bar.c:2]: (information) cannot find all the include " "files (use --check-config for details)\n"); - // we allow this to return 1 as we ignore it - return 1; + + return result; } |