diff options
67 files changed, 1568 insertions, 391 deletions
diff --git a/.clang-tidy b/.clang-tidy index 8d79b0c..0ba4b0b 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,8 @@ --- Checks: "-*,\ +bugprone-*,\ +-bugprone-macro-parentheses,\ +-bugprone-misplaced-widening-cast,\ google-readability-casting,\ misc-*,\ -misc-incorrect-roundings,\ @@ -21,15 +24,18 @@ modernize-*,\ -modernize-use-using,\ performance-*,\ -performance-inefficient-string-concatenation,\ +-performance-inefficient-vector-operation,\ readability-*,\ -readability-function-size,\ -readability-identifier-naming,\ -readability-implicit-bool-cast,\ +-readability-implicit-bool-conversion,\ -readability-inconsistent-declaration-parameter-name,\ -readability-named-parameter,\ -readability-redundant-declaration,\ -readability-redundant-member-init,\ -readability-simplify-boolean-expr,\ +-readability-static-accessed-through-instance,\ " HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$' ... diff --git a/Help/command/macro.rst b/Help/command/macro.rst index 42a99fc..464940f 100644 --- a/Help/command/macro.rst +++ b/Help/command/macro.rst @@ -76,16 +76,16 @@ Macro vs Function The ``macro`` command is very similar to the :command:`function` command. Nonetheless, there are a few important differences. -In a function, ``ARGC``, ``ARGC`` and ``ARGV0``, ``ARGV1``, ... are -true variables in the usual CMake sense. In a macro, they are not. -They are string replacements much like the C preprocessor would do +In a function, ``ARGN``, ``ARGC``, ``ARGV`` and ``ARGV0``, ``ARGV1``, ... +are true variables in the usual CMake sense. In a macro, they are not, +they are string replacements much like the C preprocessor would do with a macro. This has a number of consequences, as explained in the :ref:`Argument Caveats` section below. Another difference between macros and functions is the control flow. A function is executed by transfering control from the calling statement to the function body. A macro is executed as if the macro -body were pasted in place of the calling statement. This has for +body were pasted in place of the calling statement. This has the consequence that a :command:`return()` in a macro body does not just terminate execution of the macro; rather, control is returned from the scope of the macro call. To avoid confusion, it is recommended @@ -96,7 +96,7 @@ to avoid :command:`return()` in macros altogether. Argument Caveats ^^^^^^^^^^^^^^^^ -Since ``ARGC``, ``ARGC``, ``ARGV0`` etc are not variables, +Since ``ARGN``, ``ARGC``, ``ARGV``, ``ARGV0`` etc. are not variables, you will NOT be able to use commands like .. code-block:: cmake diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst index 28caa7c..310ad11 100644 --- a/Help/command/try_compile.rst +++ b/Help/command/try_compile.rst @@ -127,7 +127,8 @@ default values: If :policy:`CMP0056` is set to ``NEW``, then :variable:`CMAKE_EXE_LINKER_FLAGS` is passed in as well. -The current setting of :policy:`CMP0065` is set in the generated project. +The current settings of :policy:`CMP0065` and :policy:`CMP0083` are set in the +generated project. Set the :variable:`CMAKE_TRY_COMPILE_CONFIGURATION` variable to choose a build configuration. diff --git a/Help/dev/documentation.rst b/Help/dev/documentation.rst index 1b2c942..c302790 100644 --- a/Help/dev/documentation.rst +++ b/Help/dev/documentation.rst @@ -458,32 +458,22 @@ reStructuredText markup from comment blocks that start in ``.rst:``. At the top of ``Modules/<module-name>.cmake``, begin with the following license notice: -.. code-block:: cmake +:: # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. After this notice, add a *BLANK* line. Then, add documentation using -a `Line Comment`_ block of the form: - -.. code-block:: cmake - - #.rst: - # <module-name> - # ------------- - # - # <reStructuredText documentation of module> - -or a `Bracket Comment`_ of the form: +a `Bracket Comment`_ of the form: :: - #[[.rst: - <module-name> - ------------- + #[=======================================================================[.rst: + <module-name> + ------------- - <reStructuredText documentation of module> - #]] + <reStructuredText documentation of module> + #]=======================================================================] Any number of ``=`` may be used in the opening and closing brackets as long as they match. Content on the line containing the closing @@ -496,35 +486,38 @@ For example, a ``Findxxx.cmake`` module may contain: :: - # Distributed under the OSI-approved BSD 3-Clause License. See accompanying - # file Copyright.txt or https://cmake.org/licensing for details. + # Distributed under the OSI-approved BSD 3-Clause License. See accompanying + # file Copyright.txt or https://cmake.org/licensing for details. + + #[=======================================================================[.rst: + FindXxx + ------- + + This is a cool module. + This module does really cool stuff. + It can do even more than you think. + + It even needs two paragraphs to tell you about it. + And it defines the following variables: + + ``VAR_COOL`` + this is great isn't it? + ``VAR_REALLY_COOL`` + cool right? + #]=======================================================================] + + <code> + + #[=======================================================================[.rst: + .. command:: xxx_do_something + + This command does something for Xxx:: - #.rst: - # FindXxx - # ------- - # - # This is a cool module. - # This module does really cool stuff. - # It can do even more than you think. - # - # It even needs two paragraphs to tell you about it. - # And it defines the following variables: - # - # * VAR_COOL: this is great isn't it? - # * VAR_REALLY_COOL: cool right? - - <code> - - #[========================================[.rst: - .. command:: xxx_do_something - - This command does something for Xxx:: - - xxx_do_something(some arguments) - #]========================================] - macro(xxx_do_something) - <code> - endmacro() + xxx_do_something(some arguments) + #]=======================================================================] + macro(xxx_do_something) + <code> + endmacro() Test the documentation formatting by running ``cmake --help-module <module-name>``, and also by enabling the @@ -534,5 +527,4 @@ have a .cmake file in this directory NOT show up in the modules documentation, simply leave out the ``Help/module/<module-name>.rst`` file and the ``Help/manual/cmake-modules.7.rst`` toctree entry. -.. _`Line Comment`: https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#line-comment .. _`Bracket Comment`: https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#bracket-comment diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index b949464..85ed935 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -196,49 +196,78 @@ them. A Sample Find Module -------------------- -We will describe how to create a simple find module for a library -``Foo``. +We will describe how to create a simple find module for a library ``Foo``. -The first thing that is needed is a license notice. +The top of the module should begin with a license notice, followed by +a blank line, and then followed by a :ref:`Bracket Comment`. The comment +should begin with ``.rst:`` to indicate that the rest of its content is +reStructuredText-format documentation. For example: -.. code-block:: cmake +:: - # Distributed under the OSI-approved BSD 3-Clause License. See accompanying - # file Copyright.txt or https://cmake.org/licensing for details. + # Distributed under the OSI-approved BSD 3-Clause License. See accompanying + # file Copyright.txt or https://cmake.org/licensing for details. -Next we need module documentation. CMake's documentation system requires you -to follow the license notice with a blank line and then with a documentation -marker and the name of the module. You should follow this with a simple -statement of what the module does. + #[=======================================================================[.rst: + FindFoo + ------- -.. code-block:: cmake + Finds the Foo library. - #.rst: - # FindFoo - # ------- - # - # Finds the Foo library - # + Imported Targets + ^^^^^^^^^^^^^^^^ -More description may be required for some packages. If there are -caveats or other details users of the module should be aware of, you can -add further paragraphs below this. Then you need to document what -variables and imported targets are set by the module, such as + This module provides the following imported targets, if found: -.. code-block:: cmake + ``Foo::Foo`` + The Foo library + + Result Variables + ^^^^^^^^^^^^^^^^ + + This will define the following variables: + + ``Foo_FOUND`` + True if the system has the Foo library. + ``Foo_VERSION`` + The version of the Foo library which was found. + ``Foo_INCLUDE_DIRS`` + Include directories needed to use Foo. + ``Foo_LIBRARIES`` + Libraries needed to link to Foo. + + Cache Variables + ^^^^^^^^^^^^^^^ + + The following cache variables may also be set: + + ``Foo_INCLUDE_DIR`` + The directory containing ``foo.h``. + ``Foo_LIBRARY`` + The path to the Foo library. + + #]=======================================================================] + +The module documentation consists of: + +* An underlined heading specifying the module name. + +* A simple description of what the module finds. + More description may be required for some packages. If there are + caveats or other details users of the module should be aware of, + specify them here. + +* A section listing imported targets provided by the module, if any. + +* A section listing result variables provided by the module. - # This will define the following variables:: - # - # Foo_FOUND - True if the system has the Foo library - # Foo_VERSION - The version of the Foo library which was found - # - # and the following imported targets:: - # - # Foo::Foo - The Foo library +* Optionally a section listing cache variables used by the module, if any. -If the package provides any macros, they should be listed here, but can -be documented where they are defined. +If the package provides any macros or functions, they should be listed in +an additional section, but can be documented by additional ``.rst:`` +comment blocks immediately above where those macros or functions are defined. +The find module implementation may begin below the documentation block. Now the actual libraries and so on have to be found. The code here will obviously vary from module to module (dealing with that, after all, is the point of find modules), but there tends to be a common pattern for libraries. diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 7c0fe6d..044a06e 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,7 @@ Policies Introduced by CMake 3.14 .. toctree:: :maxdepth: 1 + CMP0085: IN_LIST generator expression handles empty list items. </policy/CMP0085> CMP0084: The FindQt module does not exist for find_package(). </policy/CMP0084> CMP0083: Add PIE options when linking executable. </policy/CMP0083> CMP0082: Install rules from add_subdirectory() are interleaved with those in caller. </policy/CMP0082> diff --git a/Help/policy/CMP0085.rst b/Help/policy/CMP0085.rst new file mode 100644 index 0000000..d9ec9a2 --- /dev/null +++ b/Help/policy/CMP0085.rst @@ -0,0 +1,21 @@ +CMP0085 +------- + +``$<IN_LIST:...>`` handles empty list items. + +In CMake 3.13 and lower, the ``$<IN_LIST:...>`` generator expression always +returned ``0`` if the first argument was empty, even if the list contained an +empty item. This behavior is inconsistent with the ``IN_LIST`` behavior of +:command:`if`, which this generator expression is meant to emulate. CMake 3.14 +and later handles this case correctly. + +The ``OLD`` behavior of this policy is for ``$<IN_LIST:...>`` to always return +``0`` if the first argument is empty. The ``NEW`` behavior is to return ``1`` +if the first argument is empty and the list contains an empty item. + +This policy was introduced in CMake version 3.14. CMake version +|release| warns when the policy is not set and uses ``OLD`` behavior. +Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` +explicitly. + +.. include:: DEPRECATED.txt diff --git a/Help/release/dev/FindGIF-modernize.rst b/Help/release/dev/FindGIF-modernize.rst new file mode 100644 index 0000000..3bb4821 --- /dev/null +++ b/Help/release/dev/FindGIF-modernize.rst @@ -0,0 +1,4 @@ +FindGIF-modernize +----------------- + +* The :module:`FindGIF` module now provides imported targets. diff --git a/Help/release/dev/FindX11-imported-targets.rst b/Help/release/dev/FindX11-imported-targets.rst new file mode 100644 index 0000000..4df753d --- /dev/null +++ b/Help/release/dev/FindX11-imported-targets.rst @@ -0,0 +1,32 @@ +FindX11-imported-targets +------------------------ + +* The :module:`FindX11` had the following variables renamed in order to match + their library names rather than header names. The old variables are provided + for compatibility: + + - ``X11_Xxf86misc_INCLUDE_PATH`` instead of ``X11_xf86misc_INCLUDE_PATH`` + - ``X11_Xxf86misc_LIB`` instead of ``X11_xf86misc_LIB`` + - ``X11_Xxf86misc_FOUND`` instead of ``X11_xf86misc_FOUND`` + - ``X11_Xxf86vm_INCLUDE_PATH`` instead of ``X11_xf86vmode_INCLUDE_PATH`` + - ``X11_Xxf86vm_LIB`` instead of ``X11_xf86vmode_LIB`` + - ``X11_Xxf86vm_FOUND`` instead of ``X11_xf86vmode_FOUND`` + - ``X11_xkbfile_INCLUDE_PATH`` instead of ``X11_Xkbfile_INCLUDE_PATH`` + - ``X11_xkbfile_LIB`` instead of ``X11_Xkbfile_LIB`` + - ``X11_xkbfile_FOUND`` instead of ``X11_Xkbfile_FOUND`` + - ``X11_Xtst_INCLUDE_PATH`` instead of ``X11_XTest_INCLUDE_PATH`` + - ``X11_Xtst_LIB`` instead of ``X11_XTest_LIB`` + - ``X11_Xtst_FOUND`` instead of ``X11_XTest_FOUND`` + - ``X11_Xss_INCLUDE_PATH`` instead of ``X11_Xscreensaver_INCLUDE_PATH`` + - ``X11_Xss_LIB`` instead of ``X11_Xscreensaver_LIB`` + - ``X11_Xss_FOUND`` instead of ``X11_Xscreensaver_FOUND`` + + The following variables are deprecated completely since they were + essentially duplicates: + + - ``X11_Xinput_INCLUDE_PATH`` (use ``X11_Xi_INCLUDE_PATH``) + - ``X11_Xinput_LIB`` (use ``X11_Xi_LIB``) + - ``X11_Xinput_FOUND`` (use ``X11_Xi_FOUND``) + +* The :module:`FindX11` now provides ``X11_Xext_INCLUDE_PATH``. +* The :module:`FindX11` now provides imported targets. diff --git a/Help/release/dev/genex-in_list-empty-args.rst b/Help/release/dev/genex-in_list-empty-args.rst new file mode 100644 index 0000000..ec1c6c0 --- /dev/null +++ b/Help/release/dev/genex-in_list-empty-args.rst @@ -0,0 +1,5 @@ +genex-in_list-empty-args +------------------------ + +* The $<IN_LIST:...> generator expression now correctly handles an empty + argument. See :policy:`CMP0085` for details. diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index cd6ed8f..b6348fd 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -94,6 +94,7 @@ if(BLA_PREFER_PKGCONFIG) find_package(PkgConfig) pkg_check_modules(PKGC_BLAS blas) if(PKGC_BLAS_FOUND) + set(BLAS_FOUND ${PKGC_BLAS_FOUND}) set(BLAS_LIBRARIES "${PKGC_BLAS_LINK_LIBRARIES}") return() endif() diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index ccd245b..ce307fa 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -35,6 +35,7 @@ case results are reported in variables:: Boost_MAJOR_VERSION - Boost major version number (X in X.y.z) Boost_MINOR_VERSION - Boost minor version number (Y in x.Y.z) Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z) + Boost_VERSION_STRING - Boost version number in x.y.z format Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows) - Pass to add_definitions() to have diagnostic information about Boost's automatic linking @@ -410,15 +411,12 @@ endmacro() #------------------------------------------------------------------------------- -# -# Runs compiler with "-dumpversion" and parses major/minor -# version with a regex. -# +# Convert CMAKE_CXX_COMPILER_VERSION to boost compiler suffix version. function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION _OUTPUT_VERSION_MAJOR _OUTPUT_VERSION_MINOR) string(REGEX REPLACE "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" "\\1" - _boost_COMPILER_VERSION_MAJOR ${CMAKE_CXX_COMPILER_VERSION}) + _boost_COMPILER_VERSION_MAJOR "${CMAKE_CXX_COMPILER_VERSION}") string(REGEX REPLACE "([0-9]+)\\.([0-9]+)(\\.[0-9]+)?" "\\2" - _boost_COMPILER_VERSION_MINOR ${CMAKE_CXX_COMPILER_VERSION}) + _boost_COMPILER_VERSION_MINOR "${CMAKE_CXX_COMPILER_VERSION}") set(_boost_COMPILER_VERSION "${_boost_COMPILER_VERSION_MAJOR}${_boost_COMPILER_VERSION_MINOR}") @@ -1371,6 +1369,7 @@ if(Boost_INCLUDE_DIR) math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") + set(Boost_VERSION_STRING "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") string(APPEND Boost_ERROR_REASON "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake index 9a995af..9687b57 100644 --- a/Modules/FindGIF.cmake +++ b/Modules/FindGIF.cmake @@ -7,22 +7,43 @@ FindGIF This finds the GIF library (giflib) -The module defines the following variables: +Imported targets +^^^^^^^^^^^^^^^^ + +This module defines the following :prop_tgt:`IMPORTED` target: + +``GIF::GIF`` + The giflib library, if found. + +Result variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project: ``GIF_FOUND`` - True if giflib was found + If false, do not try to use GIF. +``GIF_INCLUDE_DIRS`` + where to find gif_lib.h, etc. ``GIF_LIBRARIES`` - Libraries to link to in order to use giflib -``GIF_INCLUDE_DIR`` - where to find the headers + the libraries needed to use GIF. ``GIF_VERSION`` - 3, 4 or a full version string (eg 5.1.4) for versions >= 4.1.6 + 3, 4 or a full version string (eg 5.1.4) for versions >= 4.1.6. + +Cache variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: -The minimum required version of giflib can be specified using the -standard syntax, e.g. find_package(GIF 4) +``GIF_INCLUDE_DIR`` + where to find the GIF headers. +``GIF_LIBRARY`` + where to find the GIF library. + +Hints +^^^^^ -$GIF_DIR is an environment variable that would correspond to the -./configure --prefix=$GIF_DIR +``GIF_DIR`` is an environment variable that would correspond to the +``./configure --prefix=$GIF_DIR``. #]=======================================================================] # Created by Eric Wing. @@ -44,9 +65,6 @@ find_library(GIF_LIBRARY PATH_SUFFIXES lib ) -# see readme.txt -set(GIF_LIBRARIES ${GIF_LIBRARY}) - # Very basic version detection. # The GIF_LIB_VERSION string in gif_lib.h seems to be unreliable, since it seems # to be always " Version 2.0, " in versions 3.x of giflib. @@ -90,4 +108,20 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GIF REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR VERSION_VAR GIF_VERSION ) +if(GIF_FOUND) + set(GIF_INCLUDE_DIRS "${GIF_INCLUDE_DIR}") + set(GIF_LIBRARIES ${GIF_LIBRARY}) + + if(NOT TARGET GIF::GIF) + add_library(GIF::GIF UNKNOWN IMPORTED) + set_target_properties(GIF::GIF PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GIF_INCLUDE_DIRS}") + if(EXISTS "${GIF_LIBRARY}") + set_target_properties(GIF::GIF PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${GIF_LIBRARY}") + endif() + endif() +endif() + mark_as_advanced(GIF_INCLUDE_DIR GIF_LIBRARY) diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 5b1ed4b..e0ebb90 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -711,6 +711,23 @@ if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS if (NOT _${_PYTHON_PREFIX}_CONFIG) continue() endif() + if (DEFINED CMAKE_LIBRARY_ARCHITECTURE) + # check that config tool match library architecture + execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --configdir + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_CONFIGDIR + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (_${_PYTHON_PREFIX}_RESULT) + unset (_${_PYTHON_PREFIX}_CONFIG CACHE) + continue() + endif() + string(FIND "${_${_PYTHON_PREFIX}_CONFIGDIR}" "${CMAKE_LIBRARY_ARCHITECTURE}" _${_PYTHON_PREFIX}_RESULT) + if (_${_PYTHON_PREFIX}_RESULT EQUAL -1) + unset (_${_PYTHON_PREFIX}_CONFIG CACHE) + continue() + endif() + endif() # retrieve root install directory execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --prefix diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake index 232804a..46a7449 100644 --- a/Modules/FindX11.cmake +++ b/Modules/FindX11.cmake @@ -15,43 +15,43 @@ Try to find X11 on UNIX systems. The following values are defined X11_INCLUDE_DIR - include directories to use X11 X11_LIBRARIES - link against these to use X11 -and also the following more fine grained variables: +and also the following more fine grained variables and targets: :: - X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND - X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND - X11_X11_INCLUDE_PATH, X11_X11_LIB - X11_Xaccessrules_INCLUDE_PATH, X11_Xaccess_FOUND + X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND, X11::ICE + X11_SM_INCLUDE_PATH, X11_SM_LIB, X11_SM_FOUND, X11::SM + X11_X11_INCLUDE_PATH, X11_X11_LIB, X11::X11 + X11_Xaccessrules_INCLUDE_PATH, X11_Xaccessstr_INCLUDE_PATH, X11_Xaccess_FOUND - X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND - X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND - X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND - X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND - X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND - X11_Xext_LIB, X11_Xext_FOUND + X11_Xau_INCLUDE_PATH, X11_Xau_LIB, X11_Xau_FOUND, X11::Xau + X11_Xcomposite_INCLUDE_PATH, X11_Xcomposite_LIB, X11_Xcomposite_FOUND, X11::Xcomposite + X11_Xcursor_INCLUDE_PATH, X11_Xcursor_LIB, X11_Xcursor_FOUND, X11::Xcursor + X11_Xdamage_INCLUDE_PATH, X11_Xdamage_LIB, X11_Xdamage_FOUND, X11::Xdamage + X11_Xdmcp_INCLUDE_PATH, X11_Xdmcp_LIB, X11_Xdmcp_FOUND, X11::Xdmcp + X11_Xext_INCLUDE_PATH, X11_Xext_LIB, X11_Xext_FOUND, X11::Xext + X11_Xxf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_Xxf86misc_FOUND, X11::Xxf86misc + X11_Xxf86vm_INCLUDE_PATH, X11_Xxf86vm_LIB X11_Xxf86vm_FOUND, X11::Xxf86vm + X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND, X11::Xfixes + X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND, X11::Xft + X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND, X11::Xi + X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND, X11::Xinerama + X11_Xkb_INCLUDE_PATH, + X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND, X11::Xkb + X11_xkbfile_INCLUDE_PATH, X11_xkbfile_LIB, X11_xkbfile_FOUND, X11::xkbfile + X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND, X11::Xmu + X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND, X11::Xpm + X11_Xtst_INCLUDE_PATH, X11_Xtst_LIB, X11_Xtst_FOUND, X11::Xtst + X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND, X11::Xrandr + X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND, X11::Xrender + X11_XRes_INCLUDE_PATH, X11_XRes_LIB, X11_XRes_FOUND, X11::XRes + X11_Xss_INCLUDE_PATH, X11_Xss_LIB, X11_Xss_FOUND, X11::Xss + X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND, X11::Xt + X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND, X11::Xutil + X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND, X11::Xv X11_dpms_INCLUDE_PATH, (in X11_Xext_LIB), X11_dpms_FOUND X11_XShm_INCLUDE_PATH, (in X11_Xext_LIB), X11_XShm_FOUND X11_Xshape_INCLUDE_PATH, (in X11_Xext_LIB), X11_Xshape_FOUND - X11_xf86misc_INCLUDE_PATH, X11_Xxf86misc_LIB, X11_xf86misc_FOUND - X11_xf86vmode_INCLUDE_PATH, X11_Xxf86vm_LIB X11_xf86vmode_FOUND - X11_Xfixes_INCLUDE_PATH, X11_Xfixes_LIB, X11_Xfixes_FOUND - X11_Xft_INCLUDE_PATH, X11_Xft_LIB, X11_Xft_FOUND - X11_Xi_INCLUDE_PATH, X11_Xi_LIB, X11_Xi_FOUND - X11_Xinerama_INCLUDE_PATH, X11_Xinerama_LIB, X11_Xinerama_FOUND - X11_Xinput_INCLUDE_PATH, X11_Xinput_LIB, X11_Xinput_FOUND - X11_Xkb_INCLUDE_PATH, X11_Xkb_FOUND - X11_Xkblib_INCLUDE_PATH, X11_Xkb_FOUND - X11_Xkbfile_INCLUDE_PATH, X11_Xkbfile_LIB, X11_Xkbfile_FOUND - X11_Xmu_INCLUDE_PATH, X11_Xmu_LIB, X11_Xmu_FOUND - X11_Xpm_INCLUDE_PATH, X11_Xpm_LIB, X11_Xpm_FOUND - X11_XTest_INCLUDE_PATH, X11_XTest_LIB, X11_XTest_FOUND - X11_Xrandr_INCLUDE_PATH, X11_Xrandr_LIB, X11_Xrandr_FOUND - X11_Xrender_INCLUDE_PATH, X11_Xrender_LIB, X11_Xrender_FOUND - X11_Xscreensaver_INCLUDE_PATH, X11_Xscreensaver_LIB, X11_Xscreensaver_FOUND - X11_Xt_INCLUDE_PATH, X11_Xt_LIB, X11_Xt_FOUND - X11_Xutil_INCLUDE_PATH, X11_Xutil_FOUND - X11_Xv_INCLUDE_PATH, X11_Xv_LIB, X11_Xv_FOUND X11_XSync_INCLUDE_PATH, (in X11_Xext_LIB), X11_XSync_FOUND #]=======================================================================] @@ -98,31 +98,38 @@ if (UNIX) find_path(X11_Xcursor_INCLUDE_PATH X11/Xcursor/Xcursor.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xdamage_INCLUDE_PATH X11/extensions/Xdamage.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xdmcp_INCLUDE_PATH X11/Xdmcp.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xext_INCLUDE_PATH X11/extensions/Xext.h ${X11_INC_SEARCH_PATH}) find_path(X11_dpms_INCLUDE_PATH X11/extensions/dpms.h ${X11_INC_SEARCH_PATH}) - find_path(X11_xf86misc_INCLUDE_PATH X11/extensions/xf86misc.h ${X11_INC_SEARCH_PATH}) - find_path(X11_xf86vmode_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xxf86misc_INCLUDE_PATH X11/extensions/xf86misc.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xxf86vm_INCLUDE_PATH X11/extensions/xf86vmode.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xfixes_INCLUDE_PATH X11/extensions/Xfixes.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xft_INCLUDE_PATH X11/Xft/Xft.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xi_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xinerama_INCLUDE_PATH X11/extensions/Xinerama.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xinput_INCLUDE_PATH X11/extensions/XInput.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xkb_INCLUDE_PATH X11/extensions/XKB.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xkblib_INCLUDE_PATH X11/XKBlib.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xkbfile_INCLUDE_PATH X11/extensions/XKBfile.h ${X11_INC_SEARCH_PATH}) + find_path(X11_xkbfile_INCLUDE_PATH X11/extensions/XKBfile.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xmu_INCLUDE_PATH X11/Xmu/Xmu.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xpm_INCLUDE_PATH X11/xpm.h ${X11_INC_SEARCH_PATH}) - find_path(X11_XTest_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xtst_INCLUDE_PATH X11/extensions/XTest.h ${X11_INC_SEARCH_PATH}) find_path(X11_XShm_INCLUDE_PATH X11/extensions/XShm.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xrandr_INCLUDE_PATH X11/extensions/Xrandr.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xrender_INCLUDE_PATH X11/extensions/Xrender.h ${X11_INC_SEARCH_PATH}) find_path(X11_XRes_INCLUDE_PATH X11/extensions/XRes.h ${X11_INC_SEARCH_PATH}) - find_path(X11_Xscreensaver_INCLUDE_PATH X11/extensions/scrnsaver.h ${X11_INC_SEARCH_PATH}) + find_path(X11_Xss_INCLUDE_PATH X11/extensions/scrnsaver.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xshape_INCLUDE_PATH X11/extensions/shape.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xutil_INCLUDE_PATH X11/Xutil.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xt_INCLUDE_PATH X11/Intrinsic.h ${X11_INC_SEARCH_PATH}) find_path(X11_Xv_INCLUDE_PATH X11/extensions/Xvlib.h ${X11_INC_SEARCH_PATH}) find_path(X11_XSync_INCLUDE_PATH X11/extensions/sync.h ${X11_INC_SEARCH_PATH}) + # Backwards compatibility. + set(X11_Xinput_INCLUDE_PATH "${X11_Xi_INCLUDE_PATH}") + set(X11_xf86misc_INCLUDE_PATH "${X11_Xxf86misc_INCLUDE_PATH}") + set(X11_xf86vmode_INCLUDE_PATH "${X11_Xxf8vm_INCLUDE_PATH}") + set(X11_Xkbfile_INCLUDE_PATH "${X11_xkbfile_INCLUDE_PATH}") + set(X11_XTest_INCLUDE_PATH "${X11_Xtst_INCLUDE_PATH}") + set(X11_Xscreensaver_INCLUDE_PATH "${X11_Xss_INCLUDE_PATH}") find_library(X11_X11_LIB X11 ${X11_LIB_SEARCH_PATH}) @@ -139,20 +146,25 @@ if (UNIX) find_library(X11_Xft_LIB Xft ${X11_LIB_SEARCH_PATH}) find_library(X11_Xi_LIB Xi ${X11_LIB_SEARCH_PATH}) find_library(X11_Xinerama_LIB Xinerama ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xinput_LIB Xi ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xkbfile_LIB xkbfile ${X11_LIB_SEARCH_PATH}) + find_library(X11_xkbfile_LIB xkbfile ${X11_LIB_SEARCH_PATH}) find_library(X11_Xmu_LIB Xmu ${X11_LIB_SEARCH_PATH}) find_library(X11_Xpm_LIB Xpm ${X11_LIB_SEARCH_PATH}) find_library(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH}) find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH}) find_library(X11_XRes_LIB XRes ${X11_LIB_SEARCH_PATH}) - find_library(X11_Xscreensaver_LIB Xss ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xss_LIB Xss ${X11_LIB_SEARCH_PATH}) find_library(X11_Xt_LIB Xt ${X11_LIB_SEARCH_PATH}) - find_library(X11_XTest_LIB Xtst ${X11_LIB_SEARCH_PATH}) + find_library(X11_Xtst_LIB Xtst ${X11_LIB_SEARCH_PATH}) find_library(X11_Xv_LIB Xv ${X11_LIB_SEARCH_PATH}) find_library(X11_Xxf86misc_LIB Xxf86misc ${X11_LIB_SEARCH_PATH}) find_library(X11_Xxf86vm_LIB Xxf86vm ${X11_LIB_SEARCH_PATH}) + # Backwards compatibility. + set(X11_Xinput_LIB "${X11_Xi_LIB}") + set(X11_Xkbfile_LIB "${X11_xkbfile_LIB}") + set(X11_XTest_LIB "${X11_Xtst_LIB}") + set(X11_Xscreensaver_LIB "${X11_Xss_LIB}") + set(X11_LIBRARY_DIR "") if(X11_X11_LIB) get_filename_component(X11_LIBRARY_DIR ${X11_X11_LIB} PATH) @@ -160,31 +172,31 @@ if (UNIX) set(X11_INCLUDE_DIR) # start with empty list if(X11_X11_INCLUDE_PATH) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_X11_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_X11_INCLUDE_PATH}) endif() if(X11_Xlib_INCLUDE_PATH) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xlib_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xlib_INCLUDE_PATH}) endif() if(X11_Xutil_INCLUDE_PATH) set(X11_Xutil_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xutil_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xutil_INCLUDE_PATH}) endif() if(X11_Xshape_INCLUDE_PATH) set(X11_Xshape_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xshape_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xshape_INCLUDE_PATH}) endif() set(X11_LIBRARIES) # start with empty list if(X11_X11_LIB) - set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_X11_LIB}) + list(APPEND X11_LIBRARIES ${X11_X11_LIB}) endif() if(X11_Xext_LIB) set(X11_Xext_FOUND TRUE) - set(X11_LIBRARIES ${X11_LIBRARIES} ${X11_Xext_LIB}) + list(APPEND X11_LIBRARIES ${X11_Xext_LIB}) endif() if(X11_Xt_LIB AND X11_Xt_INCLUDE_PATH) @@ -192,13 +204,17 @@ if (UNIX) endif() if(X11_Xft_LIB AND X11_Xft_INCLUDE_PATH) - set(X11_Xft_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xft_INCLUDE_PATH}) + find_package(Freetype QUIET) + find_package(Fontconfig QUIET) + if (FREETYPE_FOUND AND FONTCONFIG_FOUND) + set(X11_Xft_FOUND TRUE) + endif () + list(APPEND X11_INCLUDE_DIR ${X11_Xft_INCLUDE_PATH}) endif() if(X11_Xv_LIB AND X11_Xv_INCLUDE_PATH) set(X11_Xv_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xv_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xv_INCLUDE_PATH}) endif() if (X11_Xau_LIB AND X11_Xau_INCLUDE_PATH) @@ -207,118 +223,124 @@ if (UNIX) if (X11_Xdmcp_INCLUDE_PATH AND X11_Xdmcp_LIB) set(X11_Xdmcp_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdmcp_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xdmcp_INCLUDE_PATH}) endif () if (X11_Xaccessrules_INCLUDE_PATH AND X11_Xaccessstr_INCLUDE_PATH) set(X11_Xaccess_FOUND TRUE) set(X11_Xaccess_INCLUDE_PATH ${X11_Xaccessstr_INCLUDE_PATH}) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xaccess_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xaccess_INCLUDE_PATH}) endif () if (X11_Xpm_INCLUDE_PATH AND X11_Xpm_LIB) set(X11_Xpm_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xpm_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xpm_INCLUDE_PATH}) endif () if (X11_Xcomposite_INCLUDE_PATH AND X11_Xcomposite_LIB) set(X11_Xcomposite_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcomposite_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xcomposite_INCLUDE_PATH}) endif () if (X11_Xdamage_INCLUDE_PATH AND X11_Xdamage_LIB) set(X11_Xdamage_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdamage_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xdamage_INCLUDE_PATH}) endif () if (X11_XShm_INCLUDE_PATH) set(X11_XShm_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XShm_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_XShm_INCLUDE_PATH}) endif () - if (X11_XTest_INCLUDE_PATH AND X11_XTest_LIB) + if (X11_Xtst_INCLUDE_PATH AND X11_Xtst_LIB) + set(X11_Xtst_FOUND TRUE) + # Backwards compatibility. set(X11_XTest_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XTest_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xtst_INCLUDE_PATH}) endif () if (X11_Xi_INCLUDE_PATH AND X11_Xi_LIB) set(X11_Xi_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xi_INCLUDE_PATH}) + # Backwards compatibility. + set(X11_Xinput_FOUND TRUE) + list(APPEND X11_INCLUDE_DIR ${X11_Xi_INCLUDE_PATH}) endif () if (X11_Xinerama_INCLUDE_PATH AND X11_Xinerama_LIB) set(X11_Xinerama_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinerama_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xinerama_INCLUDE_PATH}) endif () if (X11_Xfixes_INCLUDE_PATH AND X11_Xfixes_LIB) set(X11_Xfixes_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xfixes_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xfixes_INCLUDE_PATH}) endif () if (X11_Xrender_INCLUDE_PATH AND X11_Xrender_LIB) set(X11_Xrender_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrender_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xrender_INCLUDE_PATH}) endif () if (X11_XRes_INCLUDE_PATH AND X11_XRes_LIB) set(X11_XRes_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XRes_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_XRes_INCLUDE_PATH}) endif () if (X11_Xrandr_INCLUDE_PATH AND X11_Xrandr_LIB) set(X11_Xrandr_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xrandr_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xrandr_INCLUDE_PATH}) endif () - if (X11_xf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB) + if (X11_Xxf86misc_INCLUDE_PATH AND X11_Xxf86misc_LIB) + set(X11_Xxf86misc_FOUND TRUE) + # Backwards compatibility. set(X11_xf86misc_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86misc_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xxf86misc_INCLUDE_PATH}) endif () - if (X11_xf86vmode_INCLUDE_PATH AND X11_Xxf86vm_LIB) + if (X11_Xxf86vm_INCLUDE_PATH AND X11_Xxf86vm_LIB) + set(X11_Xxf86vm_FOUND TRUE) + # Backwards compatibility. set(X11_xf86vmode_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_xf86vmode_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xxf86vm_INCLUDE_PATH}) endif () if (X11_Xcursor_INCLUDE_PATH AND X11_Xcursor_LIB) set(X11_Xcursor_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xcursor_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xcursor_INCLUDE_PATH}) endif () - if (X11_Xscreensaver_INCLUDE_PATH AND X11_Xscreensaver_LIB) + if (X11_Xss_INCLUDE_PATH AND X11_Xss_LIB) + set(X11_Xss_FOUND TRUE) set(X11_Xscreensaver_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xscreensaver_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xss_INCLUDE_PATH}) endif () if (X11_dpms_INCLUDE_PATH) set(X11_dpms_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_dpms_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_dpms_INCLUDE_PATH}) endif () if (X11_Xkb_INCLUDE_PATH AND X11_Xkblib_INCLUDE_PATH AND X11_Xlib_INCLUDE_PATH) set(X11_Xkb_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkb_INCLUDE_PATH} ) + list(APPEND X11_INCLUDE_DIR ${X11_Xkb_INCLUDE_PATH} ) endif () - if (X11_Xkbfile_INCLUDE_PATH AND X11_Xkbfile_LIB AND X11_Xlib_INCLUDE_PATH) + if (X11_xkbfile_INCLUDE_PATH AND X11_xkbfile_LIB AND X11_Xlib_INCLUDE_PATH) + set(X11_xkbfile_FOUND TRUE) + # Backwards compatibility. set(X11_Xkbfile_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xkbfile_INCLUDE_PATH} ) + list(APPEND X11_INCLUDE_DIR ${X11_xkbfile_INCLUDE_PATH} ) endif () if (X11_Xmu_INCLUDE_PATH AND X11_Xmu_LIB) set(X11_Xmu_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xmu_INCLUDE_PATH}) - endif () - - if (X11_Xinput_INCLUDE_PATH AND X11_Xinput_LIB) - set(X11_Xinput_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xinput_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_Xmu_INCLUDE_PATH}) endif () if (X11_XSync_INCLUDE_PATH) set(X11_XSync_FOUND TRUE) - set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_XSync_INCLUDE_PATH}) + list(APPEND X11_INCLUDE_DIR ${X11_XSync_INCLUDE_PATH}) endif () if(X11_ICE_LIB AND X11_ICE_INCLUDE_PATH) @@ -340,6 +362,11 @@ if (UNIX) set(X11_FOUND 1) endif () + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + find_package_handle_standard_args(X11 + REQUIRED_VARS X11_X11_INCLUDE_PATH X11_X11_LIB + HANDLE_COMPONENTS) + if(X11_FOUND) include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) @@ -352,69 +379,69 @@ if (UNIX) set(X11_X_EXTRA_LIBS "") # See if XOpenDisplay in X11 works by itself. - CHECK_LIBRARY_EXISTS("${X11_LIBRARIES}" "XOpenDisplay" "${X11_LIBRARY_DIR}" X11_LIB_X11_SOLO) + check_library_exists("${X11_LIBRARIES}" "XOpenDisplay" "${X11_LIBRARY_DIR}" X11_LIB_X11_SOLO) if(NOT X11_LIB_X11_SOLO) # Find library needed for dnet_ntoa. - CHECK_LIBRARY_EXISTS("dnet" "dnet_ntoa" "" X11_LIB_DNET_HAS_DNET_NTOA) + check_library_exists("dnet" "dnet_ntoa" "" X11_LIB_DNET_HAS_DNET_NTOA) if (X11_LIB_DNET_HAS_DNET_NTOA) - set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet) + list(APPEND X11_X_EXTRA_LIBS -ldnet) else () - CHECK_LIBRARY_EXISTS("dnet_stub" "dnet_ntoa" "" X11_LIB_DNET_STUB_HAS_DNET_NTOA) + check_library_exists("dnet_stub" "dnet_ntoa" "" X11_LIB_DNET_STUB_HAS_DNET_NTOA) if (X11_LIB_DNET_STUB_HAS_DNET_NTOA) - set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -ldnet_stub) + list(APPEND X11_X_EXTRA_LIBS -ldnet_stub) endif () endif () endif() # Find library needed for gethostbyname. - CHECK_FUNCTION_EXISTS("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME) + check_function_exists("gethostbyname" CMAKE_HAVE_GETHOSTBYNAME) if(NOT CMAKE_HAVE_GETHOSTBYNAME) - CHECK_LIBRARY_EXISTS("nsl" "gethostbyname" "" CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) + check_library_exists("nsl" "gethostbyname" "" CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) if (CMAKE_LIB_NSL_HAS_GETHOSTBYNAME) - set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lnsl) + list(APPEND X11_X_EXTRA_LIBS -lnsl) else () - CHECK_LIBRARY_EXISTS("bsd" "gethostbyname" "" CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) + check_library_exists("bsd" "gethostbyname" "" CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) if (CMAKE_LIB_BSD_HAS_GETHOSTBYNAME) - set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lbsd) + list(APPEND X11_X_EXTRA_LIBS -lbsd) endif () endif () endif() # Find library needed for connect. - CHECK_FUNCTION_EXISTS("connect" CMAKE_HAVE_CONNECT) + check_function_exists("connect" CMAKE_HAVE_CONNECT) if(NOT CMAKE_HAVE_CONNECT) - CHECK_LIBRARY_EXISTS("socket" "connect" "" CMAKE_LIB_SOCKET_HAS_CONNECT) + check_library_exists("socket" "connect" "" CMAKE_LIB_SOCKET_HAS_CONNECT) if (CMAKE_LIB_SOCKET_HAS_CONNECT) - set (X11_X_EXTRA_LIBS -lsocket ${X11_X_EXTRA_LIBS}) + list(INSERT X11_X_EXTRA_LIBS 0 -lsocket) endif () endif() # Find library needed for remove. - CHECK_FUNCTION_EXISTS("remove" CMAKE_HAVE_REMOVE) + check_function_exists("remove" CMAKE_HAVE_REMOVE) if(NOT CMAKE_HAVE_REMOVE) - CHECK_LIBRARY_EXISTS("posix" "remove" "" CMAKE_LIB_POSIX_HAS_REMOVE) + check_library_exists("posix" "remove" "" CMAKE_LIB_POSIX_HAS_REMOVE) if (CMAKE_LIB_POSIX_HAS_REMOVE) - set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lposix) + list(APPEND X11_X_EXTRA_LIBS -lposix) endif () endif() # Find library needed for shmat. - CHECK_FUNCTION_EXISTS("shmat" CMAKE_HAVE_SHMAT) + check_function_exists("shmat" CMAKE_HAVE_SHMAT) if(NOT CMAKE_HAVE_SHMAT) - CHECK_LIBRARY_EXISTS("ipc" "shmat" "" CMAKE_LIB_IPS_HAS_SHMAT) + check_library_exists("ipc" "shmat" "" CMAKE_LIB_IPS_HAS_SHMAT) if (CMAKE_LIB_IPS_HAS_SHMAT) - set (X11_X_EXTRA_LIBS ${X11_X_EXTRA_LIBS} -lipc) + list(APPEND X11_X_EXTRA_LIBS -lipc) endif () endif() endif() if (X11_ICE_FOUND) - CHECK_LIBRARY_EXISTS("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}" + check_library_exists("ICE" "IceConnectionNumber" "${X11_LIBRARY_DIR}" CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) if(CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER) set (X11_X_PRE_LIBS ${X11_ICE_LIB}) if(X11_SM_LIB) - set (X11_X_PRE_LIBS ${X11_SM_LIB} ${X11_X_PRE_LIBS}) + list(INSERT X11_X_PRE_LIBS 0 ${X11_SM_LIB}) endif() endif() endif () @@ -422,18 +449,222 @@ if (UNIX) # Build the final list of libraries. set(X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS}) - include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake) - FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}" - "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]") - else () - if (X11_FIND_REQUIRED) - message(FATAL_ERROR "Could not find X11") + if (NOT TARGET X11::X11) + add_library(X11::X11 UNKNOWN IMPORTED) + set_target_properties(X11::X11 PROPERTIES + IMPORTED_LOCATION "${X11_X11_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_X11_INCLUDE_PATH}") endif () endif () + if (X11_ICE_FOUND AND NOT TARGET X11::ICE) + add_library(X11::ICE UNKNOWN IMPORTED) + set_target_properties(X11::ICE PROPERTIES + IMPORTED_LOCATION "${X11_ICE_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_ICE_INCLUDE_PATH}") + endif () + + if (X11_SM_FOUND AND NOT TARGET X11::SM) + add_library(X11::SM UNKNOWN IMPORTED) + set_target_properties(X11::SM PROPERTIES + IMPORTED_LOCATION "${X11_SM_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_SM_INCLUDE_PATH}") + endif () + + if (X11_Xau_FOUND AND NOT TARGET X11::Xau) + add_library(X11::Xau UNKNOWN IMPORTED) + set_target_properties(X11::Xau PROPERTIES + IMPORTED_LOCATION "${X11_Xau_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xau_INCLUDE_PATH}") + endif () + + if (X11_Xcomposite_FOUND AND NOT TARGET X11::Xcomposite) + add_library(X11::Xcomposite UNKNOWN IMPORTED) + set_target_properties(X11::Xcomposite PROPERTIES + IMPORTED_LOCATION "${X11_Xcomposite_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xcomposite_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::X11") + endif () + + if (X11_Xcursor_FOUND AND NOT TARGET X11::Xcursor) + add_library(X11::Xcursor UNKNOWN IMPORTED) + set_target_properties(X11::Xcursor PROPERTIES + IMPORTED_LOCATION "${X11_Xcursor_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xcursor_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::Xrender;X11::Xfixes;X11::X11") + endif () + + if (X11_Xdamage_FOUND AND NOT TARGET X11::Xdamage) + add_library(X11::Xdamage UNKNOWN IMPORTED) + set_target_properties(X11::Xdamage PROPERTIES + IMPORTED_LOCATION "${X11_Xdamage_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xdamage_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::Xfixes;X11::X11") + endif () + + if (X11_Xdmcp_FOUND AND NOT TARGET X11::Xdmcp) + add_library(X11::Xdmcp UNKNOWN IMPORTED) + set_target_properties(X11::Xdmcp PROPERTIES + IMPORTED_LOCATION "${X11_Xdmcp_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xdmcp_INCLUDE_PATH}") + endif () + + if (X11_Xext_FOUND AND NOT TARGET X11::Xext) + add_library(X11::Xext UNKNOWN IMPORTED) + set_target_properties(X11::Xext PROPERTIES + IMPORTED_LOCATION "${X11_Xext_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xext_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::X11") + endif () + + if (X11_Xxf86misc_FOUND AND NOT TARGET X11::Xxf86misc) + add_library(X11::Xxf86misc UNKNOWN IMPORTED) + set_target_properties(X11::Xxf86misc PROPERTIES + IMPORTED_LOCATION "${X11_Xxf86misc_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xxf86misc_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::X11;X11::Xext") + endif () + + if (X11_Xxf86vm_FOUND AND NOT TARGET X11::Xxf86vm) + add_library(X11::Xxf86vm UNKNOWN IMPORTED) + set_target_properties(X11::Xxf86vm PROPERTIES + IMPORTED_LOCATION "${X11_Xxf86vm_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xxf86vm_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::X11;X11::Xext") + endif () + + if (X11_Xfixes_FOUND AND NOT TARGET X11::Xfixes) + add_library(X11::Xfixes UNKNOWN IMPORTED) + set_target_properties(X11::Xfixes PROPERTIES + IMPORTED_LOCATION "${X11_Xfixes_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xfixes_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::X11") + endif () + + if (X11_Xft_FOUND AND NOT TARGET X11::Xft) + add_library(X11::Xft UNKNOWN IMPORTED) + set_target_properties(X11::Xft PROPERTIES + IMPORTED_LOCATION "${X11_Xft_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xft_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::Xrender;X11::X11;Fontconfig::Fontconfig;Freetype::Freetype") + endif () + + if (X11_Xi_FOUND AND NOT TARGET X11::Xi) + add_library(X11::Xi UNKNOWN IMPORTED) + set_target_properties(X11::Xi PROPERTIES + IMPORTED_LOCATION "${X11_Xi_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xi_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::Xext;X11::X11") + endif () + + if (X11_Xinerama_FOUND AND NOT TARGET X11::Xinerama) + add_library(X11::Xinerama UNKNOWN IMPORTED) + set_target_properties(X11::Xinerama PROPERTIES + IMPORTED_LOCATION "${X11_Xinerama_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xinerama_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::Xext;X11::X11") + endif () + + if (X11_Xkb_FOUND AND NOT TARGET X11::Xkb) + add_library(X11::Xkb INTERFACE IMPORTED) + set_target_properties(X11::Xkb PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xkb_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::X11") + endif () + + if (X11_xkbfile_FOUND AND NOT TARGET X11::xkbfile) + add_library(X11::xkbfile UNKNOWN IMPORTED) + set_target_properties(X11::xkbfile PROPERTIES + IMPORTED_LOCATION "${X11_xkbfile_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_xkbfile_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::X11") + endif () + + if (X11_Xmu_FOUND AND NOT TARGET X11::Xmu) + add_library(X11::Xmu UNKNOWN IMPORTED) + set_target_properties(X11::Xmu PROPERTIES + IMPORTED_LOCATION "${X11_Xmu_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xmu_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::Xt;X11::Xext;X11::X11") + endif () + + if (X11_Xpm_FOUND AND NOT TARGET X11::Xpm) + add_library(X11::Xpm UNKNOWN IMPORTED) + set_target_properties(X11::Xpm PROPERTIES + IMPORTED_LOCATION "${X11_Xpm_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xpm_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::X11") + endif () + + if (X11_Xtst_FOUND AND NOT TARGET X11::Xtst) + add_library(X11::Xtst UNKNOWN IMPORTED) + set_target_properties(X11::Xtst PROPERTIES + IMPORTED_LOCATION "${X11_Xtst_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xtst_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::Xi;X11::Xext;X11::X11") + endif () + + if (X11_Xrandr_FOUND AND NOT TARGET X11::Xrandr) + add_library(X11::Xrandr UNKNOWN IMPORTED) + set_target_properties(X11::Xrandr PROPERTIES + IMPORTED_LOCATION "${X11_Xrandr_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xrandr_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::Xrender;X11::Xext;X11::X11") + endif () + + if (X11_Xrender_FOUND AND NOT TARGET X11::Xrender) + add_library(X11::Xrender UNKNOWN IMPORTED) + set_target_properties(X11::Xrender PROPERTIES + IMPORTED_LOCATION "${X11_Xrender_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xrender_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::X11") + endif () + + if (X11_XRes_FOUND AND NOT TARGET X11::XRes) + add_library(X11::XRes UNKNOWN IMPORTED) + set_target_properties(X11::XRes PROPERTIES + IMPORTED_LOCATION "${X11_XRes_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_XRes_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::Xext;X11::X11") + endif () + + if (X11_Xss_FOUND AND NOT TARGET X11::Xss) + add_library(X11::Xss UNKNOWN IMPORTED) + set_target_properties(X11::Xss PROPERTIES + IMPORTED_LOCATION "${X11_Xss_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xss_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::Xext;X11::X11") + endif () + + if (X11_Xt_FOUND AND NOT TARGET X11::Xt) + add_library(X11::Xt UNKNOWN IMPORTED) + set_target_properties(X11::Xt PROPERTIES + IMPORTED_LOCATION "${X11_Xt_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xt_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::ICE;X11::SM;X11::X11") + endif () + + if (X11_Xutil_FOUND AND NOT TARGET X11::Xutil) + add_library(X11::Xutil INTERFACE IMPORTED) + set_target_properties(X11::Xutil PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xutil_INCLUDE_PATH}" + # libX11 contains the implementations for functions in the Xutil.h + # header. + INTERFACE_LINK_LIBRARIES "X11::X11") + endif () + + if (X11_Xv_FOUND AND NOT TARGET X11::Xv) + add_library(X11::Xv UNKNOWN IMPORTED) + set_target_properties(X11::Xv PROPERTIES + IMPORTED_LOCATION "${X11_Xv_LIB}" + INTERFACE_INCLUDE_DIRECTORIES "${X11_Xv_INCLUDE_PATH}" + INTERFACE_LINK_LIBRARIES "X11::Xext;X11::X11") + endif () + mark_as_advanced( X11_X11_INCLUDE_PATH X11_X11_LIB + X11_Xext_INCLUDE_PATH X11_Xext_LIB X11_Xau_LIB X11_Xau_INCLUDE_PATH @@ -441,7 +672,6 @@ if (UNIX) X11_Xutil_INCLUDE_PATH X11_Xcomposite_INCLUDE_PATH X11_Xcomposite_LIB - X11_Xaccess_INCLUDE_PATH X11_Xfixes_LIB X11_Xfixes_INCLUDE_PATH X11_Xrandr_LIB @@ -453,15 +683,15 @@ if (UNIX) X11_XRes_LIB X11_XRes_INCLUDE_PATH X11_Xxf86misc_LIB - X11_xf86misc_INCLUDE_PATH + X11_Xxf86misc_INCLUDE_PATH X11_Xxf86vm_LIB - X11_xf86vmode_INCLUDE_PATH + X11_Xxf86vm_INCLUDE_PATH X11_Xi_LIB X11_Xi_INCLUDE_PATH X11_Xinerama_LIB X11_Xinerama_INCLUDE_PATH - X11_XTest_LIB - X11_XTest_INCLUDE_PATH + X11_Xtst_LIB + X11_Xtst_INCLUDE_PATH X11_Xcursor_LIB X11_Xcursor_INCLUDE_PATH X11_dpms_INCLUDE_PATH @@ -474,16 +704,14 @@ if (UNIX) X11_Xdmcp_INCLUDE_PATH X11_Xkb_INCLUDE_PATH X11_Xkblib_INCLUDE_PATH - X11_Xkbfile_INCLUDE_PATH - X11_Xkbfile_LIB + X11_xkbfile_INCLUDE_PATH + X11_xkbfile_LIB X11_Xmu_INCLUDE_PATH X11_Xmu_LIB - X11_Xscreensaver_INCLUDE_PATH - X11_Xscreensaver_LIB + X11_Xss_INCLUDE_PATH + X11_Xss_LIB X11_Xpm_INCLUDE_PATH X11_Xpm_LIB - X11_Xinput_LIB - X11_Xinput_INCLUDE_PATH X11_Xft_LIB X11_Xft_INCLUDE_PATH X11_Xshape_INCLUDE_PATH @@ -499,5 +727,3 @@ if (UNIX) set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE}) set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE}) endif () - -# X11_FIND_REQUIRED_<component> could be checked too diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 9a5e64d..5ba8687 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -303,7 +303,15 @@ if(MSVC) get_filename_component(windows_kits_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" ABSOLUTE) set(programfilesx86 "ProgramFiles(x86)") - find_path(WINDOWS_KITS_DIR NAMES Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll + if(";${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION};$ENV{UCRTVersion};$ENV{WindowsSDKVersion};" MATCHES [=[;(10\.[0-9.]+)[;\]]=]) + set(__ucrt_version "${CMAKE_MATCH_1}/") + else() + set(__ucrt_version "") + endif() + find_path(WINDOWS_KITS_DIR + NAMES + Redist/${__ucrt_version}ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll + Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll PATHS $ENV{CMAKE_WINDOWS_KITS_10_DIR} "${windows_kits_dir}" @@ -314,11 +322,19 @@ if(MSVC) # Glob the list of UCRT DLLs. if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) - file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/*.dll") + if(EXISTS "${WINDOWS_KITS_DIR}/Redist/${__ucrt_version}ucrt/DLLs/${CMAKE_MSVC_ARCH}/ucrtbase.dll") + file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/Redist/${__ucrt_version}ucrt/DLLs/${CMAKE_MSVC_ARCH}/*.dll") + else() + file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/Redist/ucrt/DLLs/${CMAKE_MSVC_ARCH}/*.dll") + endif() list(APPEND __install__libs ${__ucrt_dlls}) endif() if(CMAKE_INSTALL_DEBUG_LIBRARIES) - file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/bin/${CMAKE_MSVC_ARCH}/ucrt/*.dll") + if(EXISTS "${WINDOWS_KITS_DIR}/bin/${__ucrt_version}${CMAKE_MSVC_ARCH}/ucrt/ucrtbased.dll") + file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/bin/${__ucrt_version}${CMAKE_MSVC_ARCH}/ucrt/*.dll") + else() + file(GLOB __ucrt_dlls "${WINDOWS_KITS_DIR}/bin/${CMAKE_MSVC_ARCH}/ucrt/*.dll") + endif() list(APPEND __install__libs ${__ucrt_dlls}) endif() endif() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index fdd6e83..63a1573 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 20181118) +set(CMake_VERSION_PATCH 20181127) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 1d938e6..2e1bb0a 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -3,6 +3,7 @@ #include "cmCTestTestHandler.h" #include <algorithm> #include <chrono> +#include <cmath> #include <cmsys/Base64.h> #include <cmsys/Directory.hxx> #include <cmsys/RegularExpression.hxx> @@ -544,8 +545,7 @@ int cmCTestTestHandler::ProcessHandler() } cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl - << passColorCode << static_cast<int>(percent + .5f) - << "% tests passed" + << passColorCode << std::lround(percent) << "% tests passed" << this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR) << ", " << failedColorCode << failed.size() << " tests failed" << this->CTest->GetColorCode(cmCTest::Color::CLEAR_COLOR) diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 39cea87..c4cf046 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -127,7 +127,8 @@ bool cmProcess::StartProcess(uv_loop_t& loop, std::vector<size_t>* affinity) uv_pipe_open(pipe_writer, fds[1]); uv_stdio_container_t stdio[3]; - stdio[0].flags = UV_IGNORE; + stdio[0].flags = UV_INHERIT_FD; + stdio[0].data.fd = 0; stdio[1].flags = UV_INHERIT_STREAM; stdio[1].data.stream = pipe_writer; stdio[2] = stdio[1]; diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index 1b57fd8..d941c16 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -22,6 +22,8 @@ function(cm_check_cxx_feature name) # Filter out warnings caused by local configuration. string(REGEX REPLACE "[^\n]*warning:[^\n]*directory not found for option[^\n]*" "" check_output "${check_output}") string(REGEX REPLACE "[^\n]*warning:[^\n]*object file compiled with -mlong-branch which is no longer needed[^\n]*" "" check_output "${check_output}") + # Filter out other warnings unrelated to feature checks. + string(REGEX REPLACE "[^\n]*warning:[^\n]*sprintf\\(\\) is often misused, please use snprintf[^\n]*" "" check_output "${check_output}") # Filter out xcodebuild warnings. string(REGEX REPLACE "[^\n]* xcodebuild\\[[0-9]*:[0-9]*\\] warning: [^\n]*" "" check_output "${check_output}") # If using the feature causes warnings, treat it as broken/unavailable. diff --git a/Source/LexerParser/cmFortranLexer.cxx b/Source/LexerParser/cmFortranLexer.cxx index dec0f5e..82048df 100644 --- a/Source/LexerParser/cmFortranLexer.cxx +++ b/Source/LexerParser/cmFortranLexer.cxx @@ -593,13 +593,13 @@ static const YY_CHAR yy_ec[256] = 13, 14, 1, 15, 1, 1, 1, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 18, 19, 20, 21, 22, 1, 23, 24, 25, 26, 27, 28, - 24, 24, 29, 24, 24, 30, 31, 32, 33, 24, - 24, 34, 35, 36, 37, 24, 24, 24, 24, 24, - 1, 38, 1, 1, 39, 1, 23, 40, 41, 42, + 29, 29, 30, 29, 29, 31, 32, 33, 34, 29, + 29, 35, 36, 37, 38, 29, 29, 29, 29, 29, + 1, 39, 1, 1, 40, 1, 23, 24, 41, 42, - 43, 44, 24, 24, 45, 24, 24, 46, 31, 47, - 33, 24, 24, 34, 48, 36, 49, 24, 24, 24, - 24, 24, 1, 1, 1, 1, 1, 1, 1, 1, + 43, 44, 29, 29, 45, 29, 29, 46, 32, 47, + 34, 29, 29, 35, 48, 37, 49, 29, 29, 29, + 29, 29, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -621,7 +621,7 @@ static const YY_CHAR yy_meta[50] = 1, 2, 2, 3, 4, 3, 3, 1, 1, 3, 3, 3, 3, 1, 3, 5, 3, 3, 1, 3, 6, 1, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 1, 5, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 1, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7 } ; @@ -629,28 +629,28 @@ static const flex_int16_t yy_base[219] = { 0, 0, 48, 0, 49, 464, 56, 52, 57, 62, 68, 466, 0, 468, 468, 462, 468, 74, 81, 468, 468, - 468, 468, 447, 468, 442, 440, 0, 41, 42, 428, - 43, 42, 91, 119, 97, 157, 455, 206, 245, 468, - 454, 101, 468, 468, 0, 455, 468, 105, 430, 424, - 62, 68, 119, 141, 468, 468, 468, 111, 0, 59, - 98, 88, 415, 109, 158, 468, 0, 162, 293, 0, - 163, 411, 107, 122, 408, 405, 446, 342, 447, 468, - 0, 444, 169, 173, 420, 421, 132, 404, 90, 404, - 179, 185, 191, 227, 295, 397, 0, 146, 178, 149, - - 412, 0, 208, 206, 398, 171, 399, 170, 399, 391, - 387, 422, 417, 221, 468, 374, 365, 347, 347, 334, - 335, 335, 330, 334, 259, 340, 188, 340, 327, 327, - 327, 324, 325, 325, 320, 322, 319, 355, 354, 325, - 327, 468, 468, 310, 309, 309, 300, 301, 273, 273, - 275, 277, 297, 468, 468, 293, 289, 283, 275, 305, - 261, 238, 237, 214, 468, 468, 468, 196, 197, 189, - 277, 181, 0, 274, 112, 468, 468, 105, 103, 311, - 468, 233, 0, 468, 468, 83, 76, 0, 281, 282, - 468, 468, 52, 468, 468, 468, 468, 23, 287, 298, - - 327, 468, 0, 0, 329, 0, 31, 468, 468, 381, - 388, 394, 397, 404, 411, 418, 425, 432 + 468, 468, 447, 468, 442, 440, 0, 19, 41, 427, + 47, 41, 90, 119, 97, 158, 455, 207, 247, 468, + 454, 101, 468, 468, 0, 455, 468, 105, 430, 423, + 62, 67, 119, 151, 468, 468, 468, 121, 0, 90, + 93, 110, 431, 112, 142, 468, 0, 160, 295, 0, + 162, 411, 123, 102, 408, 405, 446, 344, 447, 468, + 0, 444, 170, 174, 420, 421, 132, 404, 95, 404, + 180, 186, 192, 228, 297, 397, 0, 168, 144, 52, + + 411, 0, 204, 217, 397, 179, 390, 170, 389, 378, + 364, 390, 389, 230, 468, 363, 355, 337, 337, 334, + 335, 335, 330, 334, 187, 339, 267, 339, 327, 327, + 327, 324, 325, 325, 318, 319, 318, 354, 352, 323, + 327, 468, 468, 310, 307, 305, 297, 297, 275, 275, + 277, 279, 287, 468, 468, 286, 283, 273, 196, 307, + 200, 238, 234, 210, 468, 468, 468, 174, 171, 162, + 279, 182, 0, 269, 150, 468, 468, 137, 109, 323, + 468, 239, 0, 468, 468, 72, 71, 0, 283, 283, + 468, 468, 51, 468, 468, 468, 468, 37, 283, 288, + + 330, 468, 0, 0, 331, 0, 52, 468, 468, 384, + 391, 397, 400, 407, 414, 421, 428, 435 } ; static const flex_int16_t yy_def[219] = @@ -685,53 +685,53 @@ static const flex_int16_t yy_nxt[518] = { 0, 12, 13, 14, 13, 13, 15, 16, 12, 17, 18, 19, 20, 21, 12, 22, 12, 23, 24, 12, 25, - 12, 26, 27, 27, 27, 27, 28, 27, 29, 27, - 30, 27, 27, 27, 31, 27, 32, 33, 34, 27, + 12, 26, 27, 27, 27, 27, 28, 27, 27, 29, + 27, 30, 27, 27, 27, 31, 27, 32, 33, 34, 27, 27, 28, 27, 29, 27, 27, 31, 32, 35, - 35, 208, 35, 35, 41, 36, 36, 35, 37, 41, - 35, 42, 43, 36, 41, 202, 42, 43, 44, 38, - 41, 42, 60, 61, 44, 48, 64, 42, 48, 63, - 39, 39, 53, 53, 97, 53, 54, 60, 61, 64, - 55, 63, 65, 66, 201, 65, 39, 39, 68, 49, - - 97, 68, 83, 84, 69, 83, 48, 87, 88, 48, - 50, 89, 95, 100, 90, 95, 51, 198, 52, 45, - 53, 53, 98, 53, 54, 197, 45, 45, 55, 100, - 49, 121, 45, 99, 67, 102, 122, 45, 98, 45, - 45, 50, 92, 53, 193, 92, 93, 51, 192, 52, - 94, 102, 106, 107, 191, 96, 45, 67, 70, 65, - 66, 70, 65, 68, 104, 108, 68, 104, 109, 69, - 83, 84, 71, 83, 114, 125, 118, 114, 71, 119, - 92, 53, 115, 92, 93, 127, 92, 53, 94, 92, - 93, 125, 92, 53, 94, 92, 93, 127, 72, 73, - - 94, 74, 75, 189, 126, 76, 78, 104, 80, 104, - 104, 133, 104, 78, 78, 130, 134, 151, 131, 78, - 126, 78, 114, 103, 78, 114, 78, 78, 92, 53, - 115, 92, 93, 151, 195, 195, 94, 187, 186, 185, - 184, 183, 182, 78, 78, 79, 79, 80, 79, 79, + 35, 60, 35, 35, 41, 36, 36, 35, 37, 41, + 35, 42, 43, 36, 41, 60, 42, 43, 44, 38, + 41, 42, 208, 61, 44, 48, 64, 42, 48, 202, + 39, 39, 53, 53, 63, 53, 54, 61, 64, 127, + 55, 65, 66, 201, 65, 63, 39, 39, 68, 49, + + 127, 68, 83, 84, 69, 83, 48, 87, 88, 48, + 89, 50, 198, 90, 197, 97, 51, 98, 52, 45, + 53, 53, 95, 53, 54, 95, 45, 45, 55, 99, + 49, 97, 45, 98, 67, 100, 121, 45, 102, 45, + 45, 122, 50, 65, 66, 108, 65, 51, 109, 52, + 193, 100, 92, 53, 102, 92, 93, 45, 67, 70, + 94, 68, 70, 104, 68, 96, 104, 69, 106, 107, + 126, 83, 84, 71, 83, 114, 118, 71, 114, 119, + 192, 92, 53, 115, 92, 93, 126, 92, 53, 94, + 92, 93, 191, 92, 53, 94, 92, 93, 125, 72, + + 73, 94, 74, 75, 189, 104, 76, 78, 104, 80, + 187, 133, 186, 125, 78, 78, 134, 185, 104, 103, + 78, 104, 78, 130, 149, 78, 131, 78, 78, 92, + 53, 114, 92, 93, 114, 149, 184, 94, 183, 115, + 195, 195, 182, 181, 179, 78, 78, 79, 79, 80, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 81, 79, 79, 79, 79, 79, 79, 81, 81, 81, + 79, 79, 81, 79, 79, 79, 79, 79, 79, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 79, 81, 81, 81, 81, 81, 81, 81, - 81, 81, 81, 81, 70, 149, 95, 70, 171, 95, - - 172, 173, 174, 188, 181, 199, 180, 149, 103, 180, - 190, 200, 180, 203, 171, 180, 172, 173, 174, 188, - 103, 199, 190, 179, 204, 178, 103, 200, 205, 203, - 205, 205, 177, 205, 72, 73, 176, 74, 75, 96, - 204, 76, 78, 175, 80, 206, 170, 206, 169, 78, - 78, 168, 167, 166, 165, 78, 164, 78, 163, 162, - 78, 161, 78, 78, 160, 159, 158, 157, 156, 155, - 154, 153, 152, 150, 148, 147, 146, 145, 144, 78, - 78, 40, 40, 40, 40, 40, 40, 40, 45, 143, - 142, 141, 45, 45, 46, 46, 46, 46, 46, 46, - - 46, 59, 140, 59, 79, 79, 79, 79, 79, 79, - 79, 91, 91, 91, 91, 91, 91, 91, 194, 194, - 194, 139, 194, 194, 194, 196, 138, 196, 137, 196, - 196, 196, 207, 207, 207, 207, 207, 136, 207, 135, - 132, 129, 128, 124, 123, 120, 117, 116, 113, 80, + 81, 81, 81, 81, 81, 79, 81, 81, 81, 81, + 81, 81, 81, 81, 81, 81, 70, 151, 95, 70, + + 171, 95, 172, 173, 174, 188, 190, 199, 180, 203, + 103, 180, 151, 200, 204, 178, 171, 190, 172, 173, + 174, 188, 103, 199, 180, 203, 177, 180, 200, 176, + 204, 205, 205, 175, 205, 205, 72, 73, 103, 74, + 75, 96, 170, 76, 78, 169, 80, 168, 206, 206, + 167, 78, 78, 166, 165, 164, 163, 78, 162, 78, + 161, 160, 78, 159, 78, 78, 158, 157, 156, 155, + 154, 153, 152, 150, 148, 147, 146, 145, 144, 143, + 142, 141, 78, 78, 40, 40, 40, 40, 40, 40, + 40, 45, 140, 139, 138, 45, 45, 46, 46, 46, + + 46, 46, 46, 46, 59, 137, 59, 79, 79, 79, + 79, 79, 79, 79, 91, 91, 91, 91, 91, 91, + 91, 194, 194, 194, 136, 194, 194, 194, 196, 135, + 196, 132, 196, 196, 196, 207, 207, 207, 207, 207, + 129, 207, 128, 124, 123, 120, 117, 116, 113, 80, 112, 111, 110, 105, 101, 86, 85, 47, 82, 77, 62, 58, 57, 56, 47, 209, 37, 11, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, @@ -749,50 +749,50 @@ static const flex_int16_t yy_chk[518] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 4, 207, 2, 4, 7, 2, 4, 6, 6, 8, - 6, 7, 7, 6, 9, 198, 8, 8, 9, 6, - 10, 9, 28, 29, 10, 17, 32, 10, 17, 31, - 6, 6, 18, 18, 60, 18, 18, 28, 29, 32, - 18, 31, 33, 33, 193, 33, 6, 6, 35, 17, - - 60, 35, 42, 42, 35, 42, 48, 51, 51, 48, - 17, 52, 58, 62, 52, 58, 17, 187, 17, 34, - 53, 53, 61, 53, 53, 186, 34, 34, 53, 62, - 48, 89, 34, 61, 34, 64, 89, 34, 61, 34, - 34, 48, 54, 54, 179, 54, 54, 48, 178, 48, - 54, 64, 73, 73, 175, 58, 34, 34, 36, 65, - 65, 36, 65, 68, 71, 74, 68, 71, 74, 68, - 83, 83, 36, 83, 84, 98, 87, 84, 71, 87, - 91, 91, 84, 91, 91, 100, 92, 92, 91, 92, - 92, 98, 93, 93, 92, 93, 93, 100, 36, 36, - - 93, 36, 36, 172, 99, 36, 38, 104, 38, 103, - 104, 108, 103, 38, 38, 106, 108, 127, 106, 38, - 99, 38, 114, 103, 38, 114, 38, 38, 94, 94, - 114, 94, 94, 127, 182, 182, 94, 170, 169, 168, - 164, 163, 162, 38, 38, 39, 39, 39, 39, 39, + 4, 28, 2, 4, 7, 2, 4, 6, 6, 8, + 6, 7, 7, 6, 9, 28, 8, 8, 9, 6, + 10, 9, 207, 29, 10, 17, 32, 10, 17, 198, + 6, 6, 18, 18, 31, 18, 18, 29, 32, 100, + 18, 33, 33, 193, 33, 31, 6, 6, 35, 17, + + 100, 35, 42, 42, 35, 42, 48, 51, 51, 48, + 52, 17, 187, 52, 186, 60, 17, 61, 17, 34, + 53, 53, 58, 53, 53, 58, 34, 34, 53, 61, + 48, 60, 34, 61, 34, 62, 89, 34, 64, 34, + 34, 89, 48, 65, 65, 74, 65, 48, 74, 48, + 179, 62, 54, 54, 64, 54, 54, 34, 34, 36, + 54, 68, 36, 71, 68, 58, 71, 68, 73, 73, + 99, 83, 83, 36, 83, 84, 87, 71, 84, 87, + 178, 91, 91, 84, 91, 91, 99, 92, 92, 91, + 92, 92, 175, 93, 93, 92, 93, 93, 98, 36, + + 36, 93, 36, 36, 172, 103, 36, 38, 103, 38, + 170, 108, 169, 98, 38, 38, 108, 168, 104, 103, + 38, 104, 38, 106, 125, 38, 106, 38, 38, 94, + 94, 114, 94, 94, 114, 125, 164, 94, 163, 114, + 182, 182, 162, 161, 159, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 69, 125, 95, 69, 149, 95, - - 150, 151, 152, 171, 161, 189, 160, 125, 69, 160, - 174, 190, 180, 199, 149, 180, 150, 151, 152, 171, - 160, 189, 174, 159, 200, 158, 180, 190, 201, 199, - 205, 201, 157, 205, 69, 69, 156, 69, 69, 95, - 200, 69, 78, 153, 78, 201, 148, 205, 147, 78, - 78, 146, 145, 144, 141, 78, 140, 78, 139, 138, - 78, 137, 78, 78, 136, 135, 134, 133, 132, 131, - 130, 129, 128, 126, 124, 123, 122, 121, 120, 78, - 78, 210, 210, 210, 210, 210, 210, 210, 211, 119, - 118, 117, 211, 211, 212, 212, 212, 212, 212, 212, - - 212, 213, 116, 213, 214, 214, 214, 214, 214, 214, - 214, 215, 215, 215, 215, 215, 215, 215, 216, 216, - 216, 113, 216, 216, 216, 217, 112, 217, 111, 217, - 217, 217, 218, 218, 218, 218, 218, 110, 218, 109, - 107, 105, 101, 96, 90, 88, 86, 85, 82, 79, + 39, 39, 39, 39, 39, 39, 69, 127, 95, 69, + + 149, 95, 150, 151, 152, 171, 174, 189, 160, 199, + 69, 160, 127, 190, 200, 158, 149, 174, 150, 151, + 152, 171, 160, 189, 180, 199, 157, 180, 190, 156, + 200, 201, 205, 153, 201, 205, 69, 69, 180, 69, + 69, 95, 148, 69, 78, 147, 78, 146, 201, 205, + 145, 78, 78, 144, 141, 140, 139, 78, 138, 78, + 137, 136, 78, 135, 78, 78, 134, 133, 132, 131, + 130, 129, 128, 126, 124, 123, 122, 121, 120, 119, + 118, 117, 78, 78, 210, 210, 210, 210, 210, 210, + 210, 211, 116, 113, 112, 211, 211, 212, 212, 212, + + 212, 212, 212, 212, 213, 111, 213, 214, 214, 214, + 214, 214, 214, 214, 215, 215, 215, 215, 215, 215, + 215, 216, 216, 216, 110, 216, 216, 216, 217, 109, + 217, 107, 217, 217, 217, 218, 218, 218, 218, 218, + 105, 218, 101, 96, 90, 88, 86, 85, 82, 79, 77, 76, 75, 72, 63, 50, 49, 46, 41, 37, 30, 26, 25, 23, 15, 11, 5, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, diff --git a/Source/LexerParser/cmFortranLexer.in.l b/Source/LexerParser/cmFortranLexer.in.l index 9acba4c..b7e837b 100644 --- a/Source/LexerParser/cmFortranLexer.in.l +++ b/Source/LexerParser/cmFortranLexer.in.l @@ -146,7 +146,7 @@ $[ \t]*endif { return F90PPR_ENDIF; } [Ii][Nn][Cc][Ll][Uu][Dd][Ee] { return INCLUDE; } [Ii][Nn][Tt][Ee][Rr][Ff][Aa][Cc][Ee] { return INTERFACE; } [Mm][Oo][Dd][Uu][Ll][Ee] { return MODULE; } -[Ss][Uu][bb][Mm][Oo][Dd][Uu][Ll][Ee] { return SUBMODULE; } +[Ss][Uu][Bb][Mm][Oo][Dd][Uu][Ll][Ee] { return SUBMODULE; } [Uu][Ss][Ee] { return USE; } [a-zA-Z_][a-zA-Z_0-9]* { diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx index 6284ac9..70610d7 100644 --- a/Source/QtDialog/AddCacheEntry.cxx +++ b/Source/QtDialog/AddCacheEntry.cxx @@ -21,8 +21,8 @@ AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames, , VarTypes(varTypes) { this->setupUi(this); - for (int i = 0; i < NumTypes; i++) { - this->Type->addItem(TypeStrings[i]); + for (auto const& elem : TypeStrings) { + this->Type->addItem(elem); } QWidget* cb = new QCheckBox(); QWidget* path = new QCMakePathEditor(); diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 330b747..9ce0323 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -19,9 +19,20 @@ if (Qt5Widgets_FOUND) macro(qt4_add_resources) qt5_add_resources(${ARGN}) endmacro() + set(CMake_QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) set(QT_QTMAIN_LIBRARY ${Qt5Core_QTMAIN_LIBRARIES}) + # Try to find the package WinExtras for the task bar progress + if(WIN32) + find_package(Qt5WinExtras QUIET) + if (Qt5WinExtras_FOUND) + include_directories(${Qt5WinExtras_INCLUDE_DIRS}) + add_definitions(-DQT_WINEXTRAS) + list(APPEND CMake_QT_LIBRARIES ${Qt5WinExtras_LIBRARIES}) + endif() + endif() + # Remove this when the minimum version of Qt is 4.6. add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 3761bd3..444a980 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -21,6 +21,11 @@ #include <QToolButton> #include <QUrl> +#ifdef QT_WINEXTRAS +# include <QWinTaskbarButton> +# include <QWinTaskbarProgress> +#endif + #include "AddCacheEntry.h" #include "FirstConfigure.h" #include "QCMake.h" @@ -294,6 +299,12 @@ void CMakeSetupDialog::initialize() } else { this->onBinaryDirectoryChanged(this->BinaryDirectory->lineEdit()->text()); } + +#ifdef QT_WINEXTRAS + this->TaskbarButton = new QWinTaskbarButton(this); + this->TaskbarButton->setWindow(this->windowHandle()); + this->TaskbarButton->setOverlayIcon(QIcon(":/loading.png")); +#endif } CMakeSetupDialog::~CMakeSetupDialog() @@ -381,6 +392,10 @@ void CMakeSetupDialog::doConfigure() this->CacheValues->scrollToTop(); } this->ProgressBar->reset(); + +#ifdef QT_WINEXTRAS + this->TaskbarButton->progress()->reset(); +#endif } bool CMakeSetupDialog::doConfigureInternal() @@ -495,6 +510,9 @@ void CMakeSetupDialog::doGenerate() this->enterState(ReadyConfigure); this->ProgressBar->reset(); +#ifdef QT_WINEXTRAS + this->TaskbarButton->progress()->reset(); +#endif this->ConfigureNeeded = true; } @@ -674,6 +692,12 @@ void CMakeSetupDialog::showProgress(const QString& /*msg*/, float percent) { percent = (percent * ProgressFactor) + ProgressOffset; this->ProgressBar->setValue(qRound(percent * 100)); + +#ifdef QT_WINEXTRAS + QWinTaskbarProgress* progress = this->TaskbarButton->progress(); + progress->setVisible(true); + progress->setValue(qRound(percent * 100)); +#endif } void CMakeSetupDialog::error(const QString& msg) diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index 1cce35c..39c1053 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -15,6 +15,10 @@ class CMakeCacheModel; class QProgressBar; class QToolButton; +#ifdef QT_WINEXTRAS +class QWinTaskbarButton; +#endif + /// Qt user interface for CMake class CMakeSetupDialog : public QMainWindow @@ -118,6 +122,10 @@ protected: QEventLoop LocalLoop; +#ifdef QT_WINEXTRAS + QWinTaskbarButton* TaskbarButton; +#endif + float ProgressOffset; float ProgressFactor; }; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 0b50121..f6ec606 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -656,6 +656,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, ? "NEW" : "OLD"); + /* Set the appropriate policy information for PIE link flags */ + fprintf(fout, "cmake_policy(SET CMP0083 %s)\n", + this->Makefile->GetPolicyStatus(cmPolicies::CMP0083) == + cmPolicies::NEW + ? "NEW" + : "OLD"); + if (targetType == cmStateEnums::EXECUTABLE) { /* Put the executable at a known location (for COPY_FILE). */ fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 0ccd68a..27f9131 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -684,7 +684,7 @@ cmELF::cmELF(const char* fname) std::unique_ptr<cmsys::ifstream> fin(new cmsys::ifstream(fname)); // Quit now if the file could not be opened. - if (!fin.get() || !*fin) { + if (!fin || !*fin) { this->ErrorMessage = "Error opening input file."; return; } diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index bddc3c4..df27c62 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -79,7 +79,7 @@ bool cmExportFileGenerator::GenerateImportFile() ap->SetCopyIfDifferent(true); foutPtr = std::move(ap); } - if (!foutPtr.get() || !*foutPtr) { + if (!foutPtr || !*foutPtr) { std::string se = cmSystemTools::GetLastSystemError(); std::ostringstream e; e << "cannot write to file \"" << this->MainImportFile << "\": " << se; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index f86e5e2..fa2a3e1 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -10,6 +10,7 @@ #include <algorithm> #include <assert.h> +#include <cmath> #include <ctype.h> #include <memory> // IWYU pragma: keep #include <sstream> @@ -2602,10 +2603,10 @@ public: bool UpdatePercentage(double value, double total, std::string& status) { - int OldPercentage = this->CurrentPercentage; + long OldPercentage = this->CurrentPercentage; if (total > 0.0) { - this->CurrentPercentage = static_cast<int>(value / total * 100.0 + 0.5); + this->CurrentPercentage = std::lround(value / total * 100.0); if (this->CurrentPercentage > 100) { // Avoid extra progress reports for unexpected data beyond total. this->CurrentPercentage = 100; @@ -2627,7 +2628,7 @@ public: cmFileCommand* GetFileCommand() { return this->FileCommand; } private: - int CurrentPercentage; + long CurrentPercentage; cmFileCommand* FileCommand; std::string Text; }; @@ -2824,7 +2825,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) std::string algo = i->substr(0, pos); expectedHash = cmSystemTools::LowerCase(i->substr(pos + 1)); hash = std::unique_ptr<cmCryptoHash>(cmCryptoHash::New(algo.c_str())); - if (!hash.get()) { + if (!hash) { std::string err = "DOWNLOAD EXPECTED_HASH given unknown ALGO: "; err += algo; this->SetError(err); diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index 9ff967c..739c9c0 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -38,7 +38,7 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, // Remove the function blocker for this scope or bail. std::unique_ptr<cmFunctionBlocker> fb( mf.RemoveFunctionBlocker(this, lff)); - if (!fb.get()) { + if (!fb) { return false; } diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 49b97fb..eb3df16 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -283,14 +283,39 @@ static const struct InListNode : public cmGeneratorExpressionNode std::string Evaluate( const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, + cmGeneratorExpressionContext* context, const GeneratorExpressionContent* /*content*/, cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { - std::vector<std::string> values; - cmSystemTools::ExpandListArgument(parameters[1], values); - if (values.empty()) { - return "0"; + std::vector<std::string> values, checkValues; + bool check = false; + switch (context->LG->GetPolicyStatus(cmPolicies::CMP0085)) { + case cmPolicies::WARN: + if (parameters.front().empty()) { + check = true; + cmSystemTools::ExpandListArgument(parameters[1], checkValues, true); + } + CM_FALLTHROUGH; + case cmPolicies::OLD: + cmSystemTools::ExpandListArgument(parameters[1], values); + if (check && values != checkValues) { + std::ostringstream e; + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0085) + << "\nSearch Item:\n \"" << parameters.front() + << "\"\nList:\n \"" << parameters[1] << "\"\n"; + context->LG->GetCMakeInstance()->IssueMessage( + cmake::AUTHOR_WARNING, e.str(), context->Backtrace); + return "0"; + } + if (values.empty()) { + return "0"; + } + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + cmSystemTools::ExpandListArgument(parameters[1], values, true); + break; } return std::find(values.cbegin(), values.cend(), parameters.front()) == diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 0b28d1e..80d81d5 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -4379,8 +4379,7 @@ const char* impliedValue<const char*>(const char* /*unused*/) return ""; } template <> -std::string impliedValue<std::string>( - std::string /*unused*/) // NOLINT(clang-tidy) +std::string impliedValue<std::string>(std::string /*unused*/) // NOLINT(*) { return std::string(); } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index fbc756c..0271b6f 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -112,7 +112,7 @@ std::string cmGlobalNinjaGenerator::EncodeLiteral(const std::string& lit) std::string cmGlobalNinjaGenerator::EncodePath(const std::string& path) { - std::string result = path; // NOLINT(clang-tidy) + std::string result = path; #ifdef _WIN32 if (this->IsGCCOnWindows()) std::replace(result.begin(), result.end(), '\\', '/'); @@ -254,7 +254,7 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild( bool restat, const cmNinjaDeps& outputs, const cmNinjaDeps& deps, const cmNinjaDeps& orderOnly) { - std::string cmd = command; // NOLINT(clang-tidy) + std::string cmd = command; // NOLINT(*) #ifdef _WIN32 if (cmd.empty()) // TODO Shouldn't an empty command be handled by ninja? @@ -1940,7 +1940,7 @@ int cmcmd_cmake_ninja_dyndep(std::vector<std::string>::const_iterator argBeg, cm.SetHomeOutputDirectory(dir_top_bld); std::unique_ptr<cmGlobalNinjaGenerator> ggd( static_cast<cmGlobalNinjaGenerator*>(cm.CreateGlobalGenerator("Ninja"))); - if (!ggd.get() || + if (!ggd || !ggd->WriteDyndepFile(dir_top_src, dir_top_bld, dir_cur_src, dir_cur_bld, arg_dd, arg_ddis, module_dir, linked_target_dirs)) { diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index c3ddb3e..92ee2e0 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -215,6 +215,10 @@ bool cmGlobalVisualStudio14Generator::IsWindowsStoreToolsetInstalled() const std::string cmGlobalVisualStudio14Generator::GetWindows10SDKMaxVersion() const { // The last Windows 10 SDK version that VS 2015 can target is 10.0.14393.0. + // + // "VS 2015 Users: The Windows 10 SDK (15063, 16299, 17134, 17763) is + // officially only supported for VS 2017." From: + // https://blogs.msdn.microsoft.com/chuckw/2018/10/02/windows-10-october-2018-update/ return "10.0.14393.0"; } @@ -287,28 +291,28 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion() // only the UCRT MSIs were installed for them. cmEraseIf(sdks, NoWindowsH()); - if (!sdks.empty()) { - // Only use the filename, which will be the SDK version. - for (std::string& i : sdks) { - i = cmSystemTools::GetFilenameName(i); - } + // Only use the filename, which will be the SDK version. + for (std::string& i : sdks) { + i = cmSystemTools::GetFilenameName(i); + } - // Sort the results to make sure we select the most recent one. - std::sort(sdks.begin(), sdks.end(), cmSystemTools::VersionCompareGreater); + // Skip SDKs that cannot be used with our toolset. + std::string maxVersion = this->GetWindows10SDKMaxVersion(); + if (!maxVersion.empty()) { + cmEraseIf(sdks, WindowsSDKTooRecent(maxVersion)); + } - // Skip SDKs that cannot be used with our toolset. - std::string maxVersion = this->GetWindows10SDKMaxVersion(); - if (!maxVersion.empty()) { - cmEraseIf(sdks, WindowsSDKTooRecent(maxVersion)); - } + // Sort the results to make sure we select the most recent one. + std::sort(sdks.begin(), sdks.end(), cmSystemTools::VersionCompareGreater); - // Look for a SDK exactly matching the requested target version. - for (std::string const& i : sdks) { - if (cmSystemTools::VersionCompareEqual(i, this->SystemVersion)) { - return i; - } + // Look for a SDK exactly matching the requested target version. + for (std::string const& i : sdks) { + if (cmSystemTools::VersionCompareEqual(i, this->SystemVersion)) { + return i; } + } + if (!sdks.empty()) { // Use the latest Windows 10 SDK since the exact version is not available. return sdks.at(0); } diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index ae4041d..5d952da 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -39,7 +39,7 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, // Remove the function blocker for this scope or bail. std::unique_ptr<cmFunctionBlocker> fb( mf.RemoveFunctionBlocker(this, lff)); - if (!fb.get()) { + if (!fb) { return false; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 790f6e0..5ad8ef6 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2342,7 +2342,7 @@ cmMakefile::AppleSDK cmMakefile::GetAppleSDKType() const { "watchsimulator", AppleSDK::WatchSimulator }, }; - for (auto entry : sdkDatabase) { + for (auto const& entry : sdkDatabase) { if (sdkRoot.find(entry.name) == 0 || sdkRoot.find(std::string("/") + entry.name) != std::string::npos) { return entry.sdk; diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 6b1314f..9985d63 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -249,7 +249,9 @@ class cmMakefile; 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0084, \ "The FindQt module does not exist for find_package().", 3, 14, 0, \ - cmPolicies::WARN) + cmPolicies::WARN) \ + SELECT(POLICY, CMP0085, "$<IN_LIST:...> handles empty list items.", 3, 14, \ + 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index d5bcfc2..9d43d19 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -37,7 +37,7 @@ bool cmWhileFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff, // Remove the function blocker for this scope or bail. std::unique_ptr<cmFunctionBlocker> fb( mf.RemoveFunctionBlocker(this, lff)); - if (!fb.get()) { + if (!fb) { return false; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 35730b8..2ac7f4d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2596,7 +2596,7 @@ bool cmake::Open(const std::string& dir, bool dryRun) std::unique_ptr<cmGlobalGenerator> gen( this->CreateGlobalGenerator(fullName)); - if (!gen.get()) { + if (!gen) { std::cerr << "Error: could create CMAKE_GENERATOR \"" << fullName << "\"\n"; return false; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 132855b..8b5f2e9 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1388,6 +1388,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindGDAL) endif() + if(CMake_TEST_FindGIF) + add_subdirectory(FindGIF) + endif() + if(CMake_TEST_FindGSL) add_subdirectory(FindGSL) endif() @@ -1485,6 +1489,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindVulkan) endif() + if(CMake_TEST_FindX11) + add_subdirectory(FindX11) + endif() + if(CMake_TEST_FindXalanC) add_subdirectory(FindXalanC) endif() diff --git a/Tests/FindBoost/Test/CMakeLists.txt b/Tests/FindBoost/Test/CMakeLists.txt index 663f414..39e92c1 100644 --- a/Tests/FindBoost/Test/CMakeLists.txt +++ b/Tests/FindBoost/Test/CMakeLists.txt @@ -13,6 +13,9 @@ if(NOT Boost_PROGRAM_OPTIONS_FOUND) message(FATAL_ERROR "Optional Boost component \"program_options\" not found which is unexpected") endif(NOT Boost_PROGRAM_OPTIONS_FOUND) +add_definitions(-DCMAKE_EXPECTED_BOOST_VERSION="${Boost_VERSION}") +add_definitions(-DCMAKE_EXPECTED_BOOST_VERSION_COMPONENTS="${Boost_VERSION_STRING}") + add_executable(test_boost_tgt main.cxx) target_link_libraries(test_boost_tgt Boost::dynamic_linking diff --git a/Tests/FindBoost/Test/main.cxx b/Tests/FindBoost/Test/main.cxx index 6e8b5da..50ddadf 100644 --- a/Tests/FindBoost/Test/main.cxx +++ b/Tests/FindBoost/Test/main.cxx @@ -20,5 +20,20 @@ int main() boost::thread foo(threadmain); foo.join(); - return 0; + int version = BOOST_VERSION; + int major = version / 100000; + int minor = version / 100 % 1000; + int patch = version % 100; + char version_string[100]; + snprintf(version_string, sizeof(version_string), "%d.%d.%d", major, minor, + patch); + printf("Found Boost version %s, expected version %s\n", version_string, + CMAKE_EXPECTED_BOOST_VERSION_COMPONENTS); + int ret = strcmp(version_string, CMAKE_EXPECTED_BOOST_VERSION_COMPONENTS); + char raw_version_string[100]; + snprintf(raw_version_string, sizeof(raw_version_string), "%d", + BOOST_VERSION); + printf("Found Boost version %s, expected version %s\n", raw_version_string, + CMAKE_EXPECTED_BOOST_VERSION); + return ret | strcmp(raw_version_string, CMAKE_EXPECTED_BOOST_VERSION); } diff --git a/Tests/FindGIF/CMakeLists.txt b/Tests/FindGIF/CMakeLists.txt new file mode 100644 index 0000000..bac64af --- /dev/null +++ b/Tests/FindGIF/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindGIF.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindGIF/Test" + "${CMake_BINARY_DIR}/Tests/FindGIF/Test" + ${build_generator_args} + --build-project TestFindGIF + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindGIF/Test/CMakeLists.txt b/Tests/FindGIF/Test/CMakeLists.txt new file mode 100644 index 0000000..961e636 --- /dev/null +++ b/Tests/FindGIF/Test/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.4) +project(TestFindGIF C) +include(CTest) + +find_package(GIF REQUIRED) + +add_definitions(-DCMAKE_EXPECTED_GIF_VERSION="${GIF_VERSION}") + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt GIF::GIF) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${GIF_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${GIF_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindGIF/Test/main.c b/Tests/FindGIF/Test/main.c new file mode 100644 index 0000000..4ed72ec --- /dev/null +++ b/Tests/FindGIF/Test/main.c @@ -0,0 +1,35 @@ +#include <assert.h> +#include <stdio.h> +#include <string.h> + +#include <gif_lib.h> + +// GIFLIB before version 5 didn't know this macro +#ifndef GIFLIB_MAJOR +# define GIFLIB_MAJOR 4 +#endif + +int main() +{ + // because of the API changes we have to test different functions depending + // on the version of GIFLIB +#if GIFLIB_MAJOR >= 5 + // test the linker + GifErrorString(D_GIF_SUCCEEDED); + + // check the version + char gif_version_string[16]; + snprintf(gif_version_string, 16, "%i.%i.%i", GIFLIB_MAJOR, GIFLIB_MINOR, + GIFLIB_RELEASE); + + assert(strcmp(gif_version_string, CMAKE_EXPECTED_GIF_VERSION) == 0); +#else + // test the linker + GifLastError(); + + // unfortunately there is no way to check the version in older version of + // GIFLIB +#endif + + return 0; +} diff --git a/Tests/FindX11/CMakeLists.txt b/Tests/FindX11/CMakeLists.txt new file mode 100644 index 0000000..cc931a1 --- /dev/null +++ b/Tests/FindX11/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindX11.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindX11/Test" + "${CMake_BINARY_DIR}/Tests/FindX11/Test" + ${build_generator_args} + --build-project TestFindX11 + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindX11/Test/CMakeLists.txt b/Tests/FindX11/Test/CMakeLists.txt new file mode 100644 index 0000000..769271f --- /dev/null +++ b/Tests/FindX11/Test/CMakeLists.txt @@ -0,0 +1,89 @@ +cmake_minimum_required(VERSION 3.10) +project(TestFindX11 C) +include(CTest) + +find_package(X11 REQUIRED) + +function (test_x11_component have_var component) + if (NOT X11_${component}_FOUND) + message("Skipping ${component} because it was not found.") + return () + endif () + + add_executable(test_tgt_${component} main.c) + target_link_libraries(test_tgt_${component} PRIVATE X11::${component}) + target_compile_definitions(test_tgt_${component} PRIVATE HAVE_X11_${component}) + add_test(NAME test_tgt_${component} COMMAND test_tgt_${component}) + + # Add to the list of components to test for the parent. + set(${have_var} + ${${have_var}} + HAVE_X11_${component} + PARENT_SCOPE) +endfunction () + +set(x11_components) +test_x11_component(x11_components ICE) +test_x11_component(x11_components SM) +# Not a component; hack it up. +set(X11_X11_FOUND ${X11_FOUND}) +test_x11_component(x11_components X11) +test_x11_component(x11_components Xau) +test_x11_component(x11_components Xcomposite) +test_x11_component(x11_components Xdamage) +test_x11_component(x11_components Xdmcp) +test_x11_component(x11_components Xext) +test_x11_component(x11_components Xxf86misc) +test_x11_component(x11_components Xxf86vm) +test_x11_component(x11_components Xfixes) +# We ignore the Xft component because the variables do not provide the required +# dependency information (Freetype and Fontconfig). +test_x11_component(x11_components_ignore Xft) +test_x11_component(x11_components Xi) +test_x11_component(x11_components Xinerama) +test_x11_component(x11_components Xkb) +test_x11_component(x11_components xkbfile) +test_x11_component(x11_components Xmu) +test_x11_component(x11_components Xpm) +test_x11_component(x11_components Xtst) +test_x11_component(x11_components Xrandr) +test_x11_component(x11_components Xrender) +test_x11_component(x11_components XRes) +test_x11_component(x11_components Xss) +test_x11_component(x11_components Xt) +test_x11_component(x11_components Xutil) +test_x11_component(x11_components Xv) + +# The variables do not include dependency information. Just test "everything". +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${X11_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${X11_LIBRARIES}) +# Not included in X11_LIBRARIES. +foreach(lib + Xau + Xcomposite + Xdamage + Xdmcp + Xxf86misc + Xxf86vm + Xfixes + Xi + Xinerama + Xkb + xkbfile + Xmu + Xpm + Xtst + Xrandr + Xrender + XRes + Xss + Xt + Xv + ) + if (X11_${lib}_FOUND) + target_link_libraries(test_var PRIVATE ${X11_${lib}_LIB}) + endif () +endforeach() +target_compile_definitions(test_var PRIVATE ${x11_components}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindX11/Test/main.c b/Tests/FindX11/Test/main.c new file mode 100644 index 0000000..044bfa2 --- /dev/null +++ b/Tests/FindX11/Test/main.c @@ -0,0 +1,405 @@ +#ifdef HAVE_X11_ICE +# include <X11/ICE/ICElib.h> + +static Status test_ICE(void) +{ + return IceInitThreads(); +} +#endif + +#ifdef HAVE_X11_SM +# include <X11/SM/SMlib.h> +# include <stdlib.h> + +static void test_SM(void) +{ + SmcProtocolVersion(NULL); +} +#endif + +#ifdef HAVE_X11_X11 +# include <X11/Xlib.h> + +static Status test_X11(void) +{ + return XInitThreads(); +} +#endif + +#ifdef HAVE_X11_Xau +# include <X11/Xauth.h> + +static char* test_Xau(void) +{ + return XauFileName(); +} +#endif + +#ifdef HAVE_X11_Xcomposite +# include <X11/extensions/Xcomposite.h> + +static int test_Xcomposite(void) +{ + return XCompositeVersion(); +} +#endif + +#ifdef HAVE_X11_Xdamage +# include <X11/extensions/Xdamage.h> + +static Bool test_Xdamage(void) +{ + Display* dpy = XOpenDisplay(NULL); + int ev_base; + int err_base; + Bool ret = XDamageQueryExtension(dpy, &ev_base, &err_base); + XCloseDisplay(dpy); + return ret; +} +#endif + +#ifdef HAVE_X11_Xdmcp +# include <X11/Xdmcp.h> + +static int test_Xdmcp(void) +{ + BYTE data[1024]; + XdmcpBuffer buf = { data, sizeof(data), 0, 0 }; + return XdmcpReadRemaining(&buf); +} +#endif + +#ifdef HAVE_X11_Xext +# include <X11/Xlib.h> +# include <X11/extensions/Xext.h> + +static int test_Xext(void) +{ + Display* dpy = XOpenDisplay(NULL); + int ret = XMissingExtension(dpy, "cmake"); + XCloseDisplay(dpy); + return ret; +} +#endif + +#ifdef HAVE_X11_Xxf86misc +# include <X11/Xlib.h> +# include <X11/extensions/xf86misc.h> + +static Bool test_Xxf86misc(void) +{ + Display* dpy = XOpenDisplay(NULL); + Bool ret = XF86MiscSetClientVersion(dpy); + XCloseDisplay(dpy); + return ret; +} +#endif + +#ifdef HAVE_X11_Xxf86vm +# include <X11/Xlib.h> +# include <X11/extensions/xf86vmode.h> + +static Bool test_Xxf86vm(void) +{ + Display* dpy = XOpenDisplay(NULL); + Bool ret = XF86VidModeSetClientVersion(dpy); + XCloseDisplay(dpy); + return ret; +} +#endif + +#ifdef HAVE_X11_Xfixes +# include <X11/extensions/Xfixes.h> + +static Bool test_Xfixes(void) +{ + Display* dpy = XOpenDisplay(NULL); + int ev_base; + int err_base; + Bool ret = XFixesQueryExtension(dpy, &ev_base, &err_base); + XCloseDisplay(dpy); + return ret; +} +#endif + +#ifdef HAVE_X11_Xft +# include <X11/Xft/Xft.h> + +static FcBool test_Xft(void) +{ + return XftInitFtLibrary(); +} +#endif + +#ifdef HAVE_X11_Xi +# include <X11/extensions/XInput.h> + +static XExtensionVersion* test_Xi(void) +{ + Display* dpy = XOpenDisplay(NULL); + XExtensionVersion* ret = XGetExtensionVersion(dpy, "cmake"); + XCloseDisplay(dpy); + return ret; +} +#endif + +#ifdef HAVE_X11_Xinerama +# include <X11/extensions/Xinerama.h> + +static Bool test_Xinerama(void) +{ + Display* dpy = XOpenDisplay(NULL); + int ev_base; + int err_base; + Bool ret = XineramaQueryExtension(dpy, &ev_base, &err_base); + XCloseDisplay(dpy); + return ret; +} +#endif + +#ifdef HAVE_X11_Xkb +# include <X11/XKBlib.h> + +static Bool test_Xkb(void) +{ + return XkbIgnoreExtension(0); +} +#endif + +#ifdef HAVE_X11_xkbfile +# include <stdio.h> + +# include <X11/XKBlib.h> +# include <X11/extensions/XKBfile.h> + +# include <stdlib.h> + +static void test_xkbfile(void) +{ + Display* dpy = XOpenDisplay(NULL); + XkbInitAtoms(dpy); + XCloseDisplay(dpy); +} +#endif + +#ifdef HAVE_X11_Xmu +# include <X11/Xmu/Xmu.h> + +# include <stdlib.h> + +static Bool test_Xmu(void) +{ + return XmuValidArea(NULL); +} +#endif + +#ifdef HAVE_X11_Xpm +# include <X11/xpm.h> + +static int test_Xpm(void) +{ + return XpmAttributesSize(); +} +#endif + +#ifdef HAVE_X11_Xtst +# include <X11/extensions/XTest.h> + +static Status test_Xtst(void) +{ + Display* dpy = XOpenDisplay(NULL); + Status ret = XTestDiscard(dpy); + XCloseDisplay(dpy); + return ret; +} +#endif + +#ifdef HAVE_X11_Xrandr +# include <X11/extensions/Xrandr.h> + +static Bool test_Xrandr(void) +{ + Display* dpy = XOpenDisplay(NULL); + int ev_base; + int err_base; + Bool ret = XRRQueryExtension(dpy, &ev_base, &err_base); + XCloseDisplay(dpy); + return ret; +} +#endif + +#ifdef HAVE_X11_Xrender +# include <X11/extensions/Xrender.h> + +static Bool test_Xrender(void) +{ + Display* dpy = XOpenDisplay(NULL); + int ev_base; + int err_base; + Bool ret = XRenderQueryExtension(dpy, &ev_base, &err_base); + XCloseDisplay(dpy); + return ret; +} +#endif + +#ifdef HAVE_X11_XRes +# include <X11/Xlib.h> +# include <X11/extensions/XRes.h> + +static Bool test_XRes(void) +{ + Display* dpy = XOpenDisplay(NULL); + int ev_base; + int err_base; + Bool ret = XResQueryExtension(dpy, &ev_base, &err_base); + XCloseDisplay(dpy); + return ret; +} +#endif + +#ifdef HAVE_X11_Xss +# include <X11/extensions/scrnsaver.h> + +static Bool test_Xss(void) +{ + Display* dpy = XOpenDisplay(NULL); + int ev_base; + int err_base; + Bool ret = XScreenSaverQueryExtension(dpy, &ev_base, &err_base); + XCloseDisplay(dpy); + return ret; +} +#endif + +#ifdef HAVE_X11_Xt +# include <X11/Intrinsic.h> + +static void test_Xt(void) +{ + return XtToolkitInitialize(); +} +#endif + +#ifdef HAVE_X11_Xutil +# include <X11/Xutil.h> + +static int test_Xutil(void) +{ + Region r = XCreateRegion(); + return XDestroyRegion(r); +} +#endif + +#ifdef HAVE_X11_Xv +# include <X11/Xlib.h> +# include <X11/extensions/Xvlib.h> + +static int test_Xv(void) +{ + Display* dpy = XOpenDisplay(NULL); + unsigned int version; + unsigned int revision; + unsigned int req_base; + unsigned int ev_base; + unsigned int err_base; + int ret = + XvQueryExtension(dpy, &version, &revision, &req_base, &ev_base, &err_base); + XCloseDisplay(dpy); + return ret; +} +#endif + +#include <stddef.h> + +int main(int argc, char* argv[]) +{ + (void)argv; + void* fptrs[] = { +#ifdef HAVE_X11_ICE + test_ICE, +#endif +#ifdef HAVE_X11_SM + test_SM, +#endif +#ifdef HAVE_X11_X11 + test_X11, +#endif +#ifdef HAVE_X11_Xau + test_Xau, +#endif +#ifdef HAVE_X11_Xcomposite + test_Xcomposite, +#endif +#ifdef HAVE_X11_Xdamage + test_Xdamage, +#endif +#ifdef HAVE_X11_Xdmcp + test_Xdmcp, +#endif +#ifdef HAVE_X11_Xext + test_Xext, +#endif +#ifdef HAVE_X11_Xxf86misc + test_Xxf86misc, +#endif +#ifdef HAVE_X11_Xxf86vm + test_Xxf86vm, +#endif +#ifdef HAVE_X11_Xfixes + test_Xfixes, +#endif +#ifdef HAVE_X11_Xft + test_Xft, +#endif +#ifdef HAVE_X11_Xi + test_Xi, +#endif +#ifdef HAVE_X11_Xinerama + test_Xinerama, +#endif +#ifdef HAVE_X11_Xkb + test_Xkb, +#endif +#ifdef HAVE_X11_xkbfile + test_xkbfile, +#endif +#ifdef HAVE_X11_Xmu + test_Xmu, +#endif +#ifdef HAVE_X11_Xpm + test_Xpm, +#endif +#ifdef HAVE_X11_Xtst + test_Xtst, +#endif +#ifdef HAVE_X11_Xrandr + test_Xrandr, +#endif +#ifdef HAVE_X11_Xrender + test_Xrender, +#endif +#ifdef HAVE_X11_XRes + test_XRes, +#endif +#ifdef HAVE_X11_Xss + test_Xss, +#endif +#ifdef HAVE_X11_Xt + test_Xt, +#endif +#ifdef HAVE_X11_Xutil + test_Xutil, +#endif +#ifdef HAVE_X11_Xv + test_Xv, +#endif + NULL, + }; + + // The code here is to convince the compiler to keep the static functions but + // without calling them. This ends up always being "0" because `argc` is + // always 1 in the test harness which always returns the sentinel at the end + // of the array. The array logic is there to ensure that the contents of + // `fptrs` is not optimized out. + return (int)fptrs[(sizeof(fptrs) / sizeof(*fptrs)) - argc]; +} diff --git a/Tests/FortranModules/Submodules/child.f90 b/Tests/FortranModules/Submodules/child.f90 index 838ab61..c314835 100644 --- a/Tests/FortranModules/Submodules/child.f90 +++ b/Tests/FortranModules/Submodules/child.f90 @@ -1,10 +1,10 @@ ! Test the notation for a 1st-generation direct ! descendant of a parent module -submodule ( parent ) child +SUBMODULE ( parent ) child implicit none -contains +CONTAINS module function child_function() result(child_stuff) logical :: child_stuff child_stuff=.true. end function -end submodule child +END SUBMODULE child diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 748314d..a4d829b 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -382,7 +382,8 @@ add_RunCMake_test(FetchContent) if(NOT CMake_TEST_EXTERNAL_CMAKE) set(CTestCommandLine_ARGS -DTEST_AFFINITY=$<TARGET_FILE:testAffinity>) endif() -add_RunCMake_test(CTestCommandLine) +add_executable(print_stdin print_stdin.c) +add_RunCMake_test(CTestCommandLine -DTEST_PRINT_STDIN=$<TARGET_FILE:print_stdin>) add_RunCMake_test(CacheNewline) # Only run this test on unix platforms that support # symbolic links diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 9e8d050..750ae50 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -161,3 +161,15 @@ endfunction() if(TEST_AFFINITY) run_TestAffinity() endif() + +function(run_TestStdin) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestStdin) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " + add_test(TestStdin \"${TEST_PRINT_STDIN}\") + ") + run_cmake_command(TestStdin ${CMAKE_CTEST_COMMAND} -V) +endfunction() +run_TestStdin() diff --git a/Tests/RunCMake/CTestCommandLine/TestStdin-stdin.txt b/Tests/RunCMake/CTestCommandLine/TestStdin-stdin.txt new file mode 100644 index 0000000..d83b50a --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestStdin-stdin.txt @@ -0,0 +1 @@ +Content for TestStdin diff --git a/Tests/RunCMake/CTestCommandLine/TestStdin-stdout.txt b/Tests/RunCMake/CTestCommandLine/TestStdin-stdout.txt new file mode 100644 index 0000000..d83b50a --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestStdin-stdout.txt @@ -0,0 +1 @@ +Content for TestStdin diff --git a/Tests/RunCMake/FindBoost/NoCXX-stderr.txt b/Tests/RunCMake/FindBoost/NoCXX-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/FindBoost/NoCXX-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/FindBoost/NoCXX.cmake b/Tests/RunCMake/FindBoost/NoCXX.cmake new file mode 100644 index 0000000..04b9cac --- /dev/null +++ b/Tests/RunCMake/FindBoost/NoCXX.cmake @@ -0,0 +1 @@ +find_package(Boost) diff --git a/Tests/RunCMake/FindBoost/RunCMakeTest.cmake b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake index a153ae1..5d0577b 100644 --- a/Tests/RunCMake/FindBoost/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake @@ -1,3 +1,4 @@ include(RunCMake) run_cmake(CMakePackage) +run_cmake(NoCXX) diff --git a/Tests/RunCMake/GeneratorExpression/CMP0085-NEW-check.cmake b/Tests/RunCMake/GeneratorExpression/CMP0085-NEW-check.cmake new file mode 100644 index 0000000..520bf3d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0085-NEW-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/CMP0085-NEW-generated.txt" content) + +set(expected "101011") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/CMP0085-NEW.cmake b/Tests/RunCMake/GeneratorExpression/CMP0085-NEW.cmake new file mode 100644 index 0000000..ee85c0d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0085-NEW.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT CMP0085-NEW-generated.txt CONTENT + "$<IN_LIST:,>$<IN_LIST:,a>$<IN_LIST:,;a>$<IN_LIST:a,>$<IN_LIST:a,a>$<IN_LIST:a,;a>" + ) diff --git a/Tests/RunCMake/GeneratorExpression/CMP0085-OLD-check.cmake b/Tests/RunCMake/GeneratorExpression/CMP0085-OLD-check.cmake new file mode 100644 index 0000000..c387db7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0085-OLD-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/CMP0085-OLD-generated.txt" content) + +set(expected "000011") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/CMP0085-OLD.cmake b/Tests/RunCMake/GeneratorExpression/CMP0085-OLD.cmake new file mode 100644 index 0000000..31b6a51 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0085-OLD.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT CMP0085-OLD-generated.txt CONTENT + "$<IN_LIST:,>$<IN_LIST:,a>$<IN_LIST:,;a>$<IN_LIST:a,>$<IN_LIST:a,a>$<IN_LIST:a,;a>" + ) diff --git a/Tests/RunCMake/GeneratorExpression/CMP0085-WARN-check.cmake b/Tests/RunCMake/GeneratorExpression/CMP0085-WARN-check.cmake new file mode 100644 index 0000000..f7bcf0f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0085-WARN-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/CMP0085-WARN-generated.txt" content) + +set(expected "000011") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/CMP0085-WARN-stderr.txt b/Tests/RunCMake/GeneratorExpression/CMP0085-WARN-stderr.txt new file mode 100644 index 0000000..81bd450 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0085-WARN-stderr.txt @@ -0,0 +1,33 @@ +CMake Warning \(dev\) at CMP0085-WARN\.cmake:[0-9]+ \(file\): + Policy CMP0085 is not set: \$<IN_LIST:\.\.\.> handles empty list items\. Run + "cmake --help-policy CMP0085" for policy details\. Use the cmake_policy + command to set the policy and suppress this warning\. + + Search Item: + + "" + + List: + + "" + +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. + +CMake Warning \(dev\) at CMP0085-WARN\.cmake:[0-9]+ \(file\): + Policy CMP0085 is not set: \$<IN_LIST:\.\.\.> handles empty list items\. Run + "cmake --help-policy CMP0085" for policy details\. Use the cmake_policy + command to set the policy and suppress this warning\. + + Search Item: + + "" + + List: + + ";a" + +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) +This warning is for project developers\. Use -Wno-dev to suppress it\. diff --git a/Tests/RunCMake/GeneratorExpression/CMP0085-WARN.cmake b/Tests/RunCMake/GeneratorExpression/CMP0085-WARN.cmake new file mode 100644 index 0000000..59c7826 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/CMP0085-WARN.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT CMP0085-WARN-generated.txt CONTENT + "$<IN_LIST:,>$<IN_LIST:,a>$<IN_LIST:,;a>$<IN_LIST:a,>$<IN_LIST:a,a>$<IN_LIST:a,;a>" + ) diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 3905c5f..013117e 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -61,3 +61,13 @@ if(LINKER_SUPPORTS_PDB) else() run_cmake(NonValidCompiler-TARGET_PDB_FILE) endif() + +set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0085:STRING=OLD) +run_cmake(CMP0085-OLD) +unset(RunCMake_TEST_OPTIONS) + +run_cmake(CMP0085-WARN) + +set(RunCMake_TEST_OPTIONS -DCMAKE_POLICY_DEFAULT_CMP0085:STRING=NEW) +run_cmake(CMP0085-NEW) +unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 69c96cc..c076ad9 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -65,6 +65,13 @@ function(run_cmake test) else() set(maybe_timeout "") endif() + if(RunCMake-stdin-file AND EXISTS ${top_src}/${RunCMake-stdin-file}) + set(maybe_input_file INPUT_FILE ${top_src}/${RunCMake-stdin-file}) + elseif(EXISTS ${top_src}/${test}-stdin.txt) + set(maybe_input_file INPUT_FILE ${top_src}/${test}-stdin.txt) + else() + set(maybe_input_file "") + endif() if(RunCMake_TEST_COMMAND) execute_process( COMMAND ${RunCMake_TEST_COMMAND} @@ -74,6 +81,7 @@ function(run_cmake test) RESULT_VARIABLE actual_result ENCODING UTF8 ${maybe_timeout} + ${maybe_input_file} ) else() if(RunCMake_GENERATOR_INSTANCE) @@ -96,6 +104,7 @@ function(run_cmake test) RESULT_VARIABLE actual_result ENCODING UTF8 ${maybe_timeout} + ${maybe_input_file} ) endif() set(msg "") diff --git a/Tests/RunCMake/print_stdin.c b/Tests/RunCMake/print_stdin.c new file mode 100644 index 0000000..e083e62 --- /dev/null +++ b/Tests/RunCMake/print_stdin.c @@ -0,0 +1,18 @@ +#include <stdio.h> + +int main() +{ + char buf[1024]; + size_t nIn = sizeof(buf); + while (nIn == sizeof(buf)) { + nIn = fread(buf, 1, sizeof(buf), stdin); + if (nIn > 0) { + size_t nOut; + nOut = fwrite(buf, 1, nIn, stdout); + if (nOut != nIn) { + return 1; + } + } + } + return 0; +} |