diff options
115 files changed, 1671 insertions, 982 deletions
diff --git a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake index dff0db1..91d4632 100644 --- a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake +++ b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake @@ -74,9 +74,12 @@ set(CMake_TEST_FindPNG "ON" CACHE BOOL "") set(CMake_TEST_FindPostgreSQL "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf_gRPC "ON" CACHE BOOL "") -set(CMake_TEST_FindPython "ON" CACHE BOOL "") -set(CMake_TEST_FindPython_NumPy "ON" CACHE BOOL "") -set(CMake_TEST_FindPython_PyPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2 "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3 "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_NumPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3_NumPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_PyPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3_PyPy "ON" CACHE BOOL "") set(CMake_TEST_FindRuby "ON" CACHE BOOL "") set(CMake_TEST_FindSDL "ON" CACHE BOOL "") set(CMake_TEST_FindSQLite3 "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_debian10_ninja.cmake b/.gitlab/ci/configure_debian10_ninja.cmake index 211a2a7..eca92bc 100644 --- a/.gitlab/ci/configure_debian10_ninja.cmake +++ b/.gitlab/ci/configure_debian10_ninja.cmake @@ -78,10 +78,13 @@ set(CMake_TEST_FindPNG "ON" CACHE BOOL "") set(CMake_TEST_FindPostgreSQL "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf_gRPC "ON" CACHE BOOL "") -set(CMake_TEST_FindPython "ON" CACHE BOOL "") -set(CMake_TEST_FindPython_IronPython "ON" CACHE BOOL "") -set(CMake_TEST_FindPython_NumPy "ON" CACHE BOOL "") -set(CMake_TEST_FindPython_PyPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2 "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3 "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_IronPython "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_NumPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_NumPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_PyPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3_PyPy "ON" CACHE BOOL "") set(CMake_TEST_FindRuby "ON" CACHE BOOL "") set(CMake_TEST_FindRuby_RVM "ON" CACHE BOOL "") set(CMake_TEST_FindSDL "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_fedora38_makefiles.cmake b/.gitlab/ci/configure_fedora38_makefiles.cmake index c2f9982..a3881cf 100644 --- a/.gitlab/ci/configure_fedora38_makefiles.cmake +++ b/.gitlab/ci/configure_fedora38_makefiles.cmake @@ -74,9 +74,12 @@ set(CMake_TEST_FindPNG "ON" CACHE BOOL "") set(CMake_TEST_FindPostgreSQL "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf "ON" CACHE BOOL "") set(CMake_TEST_FindProtobuf_gRPC "ON" CACHE BOOL "") -set(CMake_TEST_FindPython "ON" CACHE BOOL "") -set(CMake_TEST_FindPython_NumPy "ON" CACHE BOOL "") -set(CMake_TEST_FindPython_PyPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2 "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3 "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_NumPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3_NumPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython2_PyPy "ON" CACHE BOOL "") +set(CMake_TEST_FindPython3_PyPy "ON" CACHE BOOL "") set(CMake_TEST_FindRuby "ON" CACHE BOOL "") set(CMake_TEST_FindRuby_RVM "ON" CACHE BOOL "") set(CMake_TEST_FindSDL "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_macos_arm64_ninja_multi.cmake b/.gitlab/ci/configure_macos_arm64_ninja_multi.cmake index b22285c..d81bd30 100644 --- a/.gitlab/ci/configure_macos_arm64_ninja_multi.cmake +++ b/.gitlab/ci/configure_macos_arm64_ninja_multi.cmake @@ -2,5 +2,9 @@ if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "") set(CMake_TEST_ISPC "ON" CACHE STRING "") endif() +# FIXME: sccache sometimes fails with "Compiler killed by signal 9". +# This job does not compile much anyway, so suppress it for now. +set(configure_no_sccache 1) + include("${CMAKE_CURRENT_LIST_DIR}/configure_macos_common.cmake") include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake") diff --git a/.gitlab/ci/docker/debian10/deps_packages.lst b/.gitlab/ci/docker/debian10/deps_packages.lst index 0b79675..fc5c174 100644 --- a/.gitlab/ci/docker/debian10/deps_packages.lst +++ b/.gitlab/ci/docker/debian10/deps_packages.lst @@ -96,5 +96,5 @@ ruby ruby-dev swig unixodbc-dev -# CMake_TEST_FindPython_IronPython +# CMake_TEST_FindPython2_IronPython libmono-system-windows-forms4.0-cil diff --git a/.gitlab/ci/ispc.sh b/.gitlab/ci/ispc.sh index 59ee200..c1e3793 100755 --- a/.gitlab/ci/ispc.sh +++ b/.gitlab/ci/ispc.sh @@ -12,12 +12,12 @@ case "$(uname -s)-$(uname -m)" in ;; Darwin-arm64) shatool="shasum -a 256" - sha256sum="62cee043a3a4dbff8c2f6d3885a7e573901bbc1325dd93d50f92904b7ea67fec" + sha256sum="c423a5a88d7a9a6ed667e41d025801c123fa0c5fd384d4ea138fa1fcf2bc24c9" platform="macOS.arm64" ;; Darwin-x86_64) shatool="shasum -a 256" - sha256sum="da0f11a048a316081a8ad8170d48b170b2ed7efc3b140fc88b8611238809c8e4" + sha256sum="e25222d2d6f4f8e3561556ac73f88721ceb5486439d6c2a566d37407ad9a5907" platform="macOS.x86_64" ;; *) diff --git a/CMakeLists.txt b/CMakeLists.txt index d559c08..c1d50ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. -cmake_minimum_required(VERSION 3.13...3.25 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13...3.26 FATAL_ERROR) set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideC.cmake) set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideCXX.cmake) diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst index 7b3aa1a..6dc6832 100644 --- a/Help/command/add_custom_command.rst +++ b/Help/command/add_custom_command.rst @@ -512,7 +512,7 @@ one of the keywords to make clear the behavior they expect. Because generator expressions can be used in custom commands, it is possible to define ``COMMAND`` lines or whole custom commands which evaluate to empty strings for certain configurations. - For **Visual Studio 11 2012 (and newer)** generators these command + For **Visual Studio 12 2013 (and newer)** generators these command lines or custom commands will be omitted for the specific configuration and no "empty-string-command" will be added. diff --git a/Help/envvar/CMAKE_CROSSCOMPILING_EMULATOR.rst b/Help/envvar/CMAKE_CROSSCOMPILING_EMULATOR.rst new file mode 100644 index 0000000..3e397d8 --- /dev/null +++ b/Help/envvar/CMAKE_CROSSCOMPILING_EMULATOR.rst @@ -0,0 +1,11 @@ +CMAKE_CROSSCOMPILING_EMULATOR +----------------------------- + +.. versionadded:: 3.28 + +.. include:: ENV_VAR.txt + +The default value for :variable:`CMAKE_CROSSCOMPILING_EMULATOR` when there +is no explicit configuration given on the first run while creating a new +build tree. On later runs in an existing build tree the value persists in +the cache as :variable:`CMAKE_CROSSCOMPILING_EMULATOR`. diff --git a/Help/generator/Visual Studio 11 2012.rst b/Help/generator/Visual Studio 11 2012.rst index 4e7195c..fd8c314 100644 --- a/Help/generator/Visual Studio 11 2012.rst +++ b/Help/generator/Visual Studio 11 2012.rst @@ -1,57 +1,8 @@ Visual Studio 11 2012 --------------------- -Deprecated. Generates Visual Studio 11 (VS 2012) project files. - -.. note:: - This generator is deprecated and will be removed in a future version - of CMake. It will still be possible to build with VS 11 2012 tools - using the :generator:`Visual Studio 12 2013` (or above) generator - with :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v110``, or by - using the :generator:`NMake Makefiles` generator. - -For compatibility with CMake versions prior to 3.0, one may specify this -generator using the name "Visual Studio 11" without the year component. - -Project Types -^^^^^^^^^^^^^ - -Only Visual C++ and C# projects may be generated (and Fortran with -Intel compiler integration). Other types of projects (JavaScript, -Database, Website, etc.) are not supported. - -Platform Selection -^^^^^^^^^^^^^^^^^^ - -The default target platform name (architecture) is ``Win32``. - -.. versionadded:: 3.1 - The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set, perhaps - via the :option:`cmake -A` option, to specify a target platform - name (architecture). For example: - - * ``cmake -G "Visual Studio 11 2012" -A Win32`` - * ``cmake -G "Visual Studio 11 2012" -A x64`` - * ``cmake -G "Visual Studio 11 2012" -A ARM`` - * ``cmake -G "Visual Studio 11 2012" -A <WinCE-SDK>`` - (Specify a target platform matching a Windows CE SDK name.) - -For compatibility with CMake versions prior to 3.1, one may specify -a target platform name optionally at the end of the generator name. -This is supported only for: - -``Visual Studio 11 2012 Win64`` - Specify target platform ``x64``. - -``Visual Studio 11 2012 ARM`` - Specify target platform ``ARM``. - -``Visual Studio 11 2012 <WinCE-SDK>`` - Specify target platform matching a Windows CE SDK name. - -Toolset Selection -^^^^^^^^^^^^^^^^^ - -The ``v110`` toolset that comes with Visual Studio 11 2012 is selected by -default. The :variable:`CMAKE_GENERATOR_TOOLSET` option may be set, perhaps -via the :option:`cmake -T` option, to specify another toolset. +Removed. This once generated Visual Studio 11 2012 project files, but +the generator has been removed since CMake 3.28. It is still possible +to build with VS 11 2012 tools using the :generator:`Visual Studio 12 2013` +(or above) generator with :variable:`CMAKE_GENERATOR_TOOLSET` set to ``v110``, +or by using the :generator:`NMake Makefiles` generator. diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst index 197e56e..356e73d 100644 --- a/Help/manual/cmake-env-variables.7.rst +++ b/Help/manual/cmake-env-variables.7.rst @@ -43,6 +43,7 @@ Environment Variables that Control the Build /envvar/CMAKE_COLOR_DIAGNOSTICS /envvar/CMAKE_CONFIGURATION_TYPES /envvar/CMAKE_CONFIG_TYPE + /envvar/CMAKE_CROSSCOMPILING_EMULATOR /envvar/CMAKE_EXPORT_COMPILE_COMMANDS /envvar/CMAKE_GENERATOR /envvar/CMAKE_GENERATOR_INSTANCE diff --git a/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst b/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst index 5bf47a3..8c136f2 100644 --- a/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst +++ b/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst @@ -11,5 +11,5 @@ project file. This property is initialized by the value of the variable :variable:`CMAKE_VS_DEBUGGER_COMMAND` if it is set when a target is created. -This property only works for Visual Studio 11 2012 and above; +This property only works for Visual Studio 12 2013 and above; it is ignored on other generators. diff --git a/Help/prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS.rst b/Help/prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS.rst index 4b9dff7..2656826 100644 --- a/Help/prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS.rst +++ b/Help/prop_tgt/VS_DEBUGGER_COMMAND_ARGUMENTS.rst @@ -11,5 +11,5 @@ project file. This property is initialized by the value of the variable :variable:`CMAKE_VS_DEBUGGER_COMMAND_ARGUMENTS` if it is set when a target is created. -This property only works for Visual Studio 11 2012 and above; +This property only works for Visual Studio 12 2013 and above; it is ignored on other generators. diff --git a/Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst b/Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst index 8373dbb..d78d594 100644 --- a/Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst +++ b/Help/prop_tgt/VS_DEBUGGER_ENVIRONMENT.rst @@ -11,5 +11,5 @@ project file. This property is initialized by the value of the variable :variable:`CMAKE_VS_DEBUGGER_ENVIRONMENT` if it is set when a target is created. -This property only works for Visual Studio 11 2012 and above; +This property only works for Visual Studio 12 2013 and above; it is ignored on other generators. diff --git a/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst b/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst index 3942047..1026dfa 100644 --- a/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst +++ b/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst @@ -11,5 +11,5 @@ project file. This property is initialized by the value of the variable :variable:`CMAKE_VS_DEBUGGER_WORKING_DIRECTORY` if it is set when a target is created. -This property only works for Visual Studio 11 2012 and above; +This property only works for Visual Studio 12 2013 and above; it is ignored on other generators. diff --git a/Help/prop_tgt/VS_DOTNET_STARTUP_OBJECT.rst b/Help/prop_tgt/VS_DOTNET_STARTUP_OBJECT.rst index 8a85ba4..eeb7dda 100644 --- a/Help/prop_tgt/VS_DOTNET_STARTUP_OBJECT.rst +++ b/Help/prop_tgt/VS_DOTNET_STARTUP_OBJECT.rst @@ -12,7 +12,7 @@ If the property is unset, Visual Studio uses the first matching than one ``Main()`` method is available in the current project, the property becomes mandatory for building the project. -This property only works for Visual Studio 11 2012 and above; +This property only works for Visual Studio 12 2013 and above; it is ignored on other generators. .. code-block:: cmake diff --git a/Help/prop_tgt/VS_KEYWORD.rst b/Help/prop_tgt/VS_KEYWORD.rst index 221b986..f04d109 100644 --- a/Help/prop_tgt/VS_KEYWORD.rst +++ b/Help/prop_tgt/VS_KEYWORD.rst @@ -7,4 +7,4 @@ Can be set to change the visual studio keyword, for example Qt integration works better if this is set to Qt4VSv1.0. Use the :prop_tgt:`VS_GLOBAL_KEYWORD` target property to set the -keyword for Visual Studio 11 (2012) and newer. +keyword for Visual Studio 12 (2013) and newer. diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst new file mode 100644 index 0000000..e4cc01e --- /dev/null +++ b/Help/release/dev/0-sample-topic.rst @@ -0,0 +1,7 @@ +0-sample-topic +-------------- + +* This is a sample release note for the change in a topic. + Developers should add similar notes for each topic branch + making a noteworthy change. Each document should be named + and titled to match the topic name to avoid merge conflicts. diff --git a/Help/release/dev/CMAKE_CROSSCOMPILING_EMULATOR-env-variable.rst b/Help/release/dev/CMAKE_CROSSCOMPILING_EMULATOR-env-variable.rst new file mode 100644 index 0000000..269e739 --- /dev/null +++ b/Help/release/dev/CMAKE_CROSSCOMPILING_EMULATOR-env-variable.rst @@ -0,0 +1,6 @@ +CMAKE_CROSSCOMPILING_EMULATOR-env-variable +------------------------------------------ + +* The :envvar:`CMAKE_CROSSCOMPILING_EMULATOR` environment variable + was added to initialize the :variable:`CMAKE_CROSSCOMPILING_EMULATOR` + cache variable. diff --git a/Help/release/dev/remove-vs11-generator.rst b/Help/release/dev/remove-vs11-generator.rst new file mode 100644 index 0000000..971d679 --- /dev/null +++ b/Help/release/dev/remove-vs11-generator.rst @@ -0,0 +1,4 @@ +remove-vs11-generator +--------------------- + +* The :generator:`Visual Studio 11 2012` generator has been removed. diff --git a/Help/release/index.rst b/Help/release/index.rst index fc1f744..3851b7e 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -7,6 +7,8 @@ CMake Release Notes This file should include the adjacent "dev.txt" file in development versions but not in release versions. +.. include:: dev.txt + Releases ======== diff --git a/Help/variable/CMAKE_CFG_INTDIR.rst b/Help/variable/CMAKE_CFG_INTDIR.rst index 3a57659..3045d91 100644 --- a/Help/variable/CMAKE_CFG_INTDIR.rst +++ b/Help/variable/CMAKE_CFG_INTDIR.rst @@ -19,7 +19,7 @@ Example values: :: $(ConfigurationName) = Visual Studio 9 - $(Configuration) = Visual Studio 11 and above + $(Configuration) = Visual Studio 12 and above $(CONFIGURATION) = Xcode . = Make-based tools . = Ninja diff --git a/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst b/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst index e21b35d..1c3a26c 100644 --- a/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst +++ b/Help/variable/CMAKE_CROSSCOMPILING_EMULATOR.rst @@ -12,6 +12,10 @@ for the target system. Lists>`, then the first value is the command and remaining values are its arguments. +.. versionadded:: 3.28 + This variable can be initialized via an + :envvar:`CMAKE_CROSSCOMPILING_EMULATOR` environment variable. + The command will be used to run :command:`try_run` generated executables, which avoids manual population of the ``TryRunResults.cmake`` file. diff --git a/Help/variable/CMAKE_VS_DEVENV_COMMAND.rst b/Help/variable/CMAKE_VS_DEVENV_COMMAND.rst index 2bb97c4..155931f 100644 --- a/Help/variable/CMAKE_VS_DEVENV_COMMAND.rst +++ b/Help/variable/CMAKE_VS_DEVENV_COMMAND.rst @@ -10,5 +10,5 @@ This variable is not defined by other generators even if ``devenv.com`` is installed on the computer. The :variable:`CMAKE_VS_MSBUILD_COMMAND` is also provided for -:generator:`Visual Studio 11 2012` and above. +:generator:`Visual Studio 12 2013` and above. See also the :variable:`CMAKE_MAKE_PROGRAM` variable. diff --git a/Help/variable/CMAKE_VS_MSBUILD_COMMAND.rst b/Help/variable/CMAKE_VS_MSBUILD_COMMAND.rst index 8a521a3..96924d5 100644 --- a/Help/variable/CMAKE_VS_MSBUILD_COMMAND.rst +++ b/Help/variable/CMAKE_VS_MSBUILD_COMMAND.rst @@ -1,7 +1,7 @@ CMAKE_VS_MSBUILD_COMMAND ------------------------ -The generators for :generator:`Visual Studio 11 2012` and above set this +The generators for :generator:`Visual Studio 12 2013` and above set this variable to the ``MSBuild.exe`` command installed with the corresponding Visual Studio version. diff --git a/Modules/CMakeDetermineCSharpCompiler.cmake b/Modules/CMakeDetermineCSharpCompiler.cmake index fe98469..652eb63 100644 --- a/Modules/CMakeDetermineCSharpCompiler.cmake +++ b/Modules/CMakeDetermineCSharpCompiler.cmake @@ -3,7 +3,7 @@ if(NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])") message(FATAL_ERROR - "C# is currently only supported for Microsoft Visual Studio 11 2012 and later.") + "C# is currently only supported for Microsoft Visual Studio 12 2013 and later.") endif() include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index ca16bc2..cece973 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -189,7 +189,7 @@ ensure generated files will receive the required settings. :ref:`Makefile <Makefile Generators>`, :ref:`Ninja <Ninja Generators>`, :generator:`Xcode`, and :ref:`Visual Studio <Visual Studio Generators>` - (:generator:`Visual Studio 11 2012` and above) generators. Default value is + (:generator:`Visual Studio 12 2013` and above) generators. Default value is ``FALSE``. .. versionadded:: 3.21 @@ -353,7 +353,7 @@ as well as ``SWIG``: :ref:`Makefile <Makefile Generators>`, :ref:`Ninja <Ninja Generators>`, :generator:`Xcode`, and :ref:`Visual Studio <Visual Studio Generators>` - (:generator:`Visual Studio 11 2012` and above) generators. Default value is + (:generator:`Visual Studio 12 2013` and above) generators. Default value is ``FALSE``. Source file property ``USE_SWIG_DEPENDENCIES``, if not defined, will be diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index b01e1e7..a79366e 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -438,6 +438,7 @@ add_library( cmUVHandlePtr.h cmUVProcessChain.cxx cmUVProcessChain.h + cmUVStream.h cmUVStreambuf.h cmUVSignalHackRAII.h cmVariableWatch.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index add9fd1..a891d93 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,8 +1,8 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 27) -set(CMake_VERSION_PATCH 0) -set(CMake_VERSION_RC 3) +set(CMake_VERSION_PATCH 20230620) +#set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) # Start with the full version number used in tags. It has no dev info. diff --git a/Source/Checks/Curses/CMakeLists.txt b/Source/Checks/Curses/CMakeLists.txt index 0fee7ac..bc6b906 100644 --- a/Source/Checks/Curses/CMakeLists.txt +++ b/Source/Checks/Curses/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13...3.24 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13...3.26 FATAL_ERROR) project(CheckCurses C) set(CURSES_NEED_NCURSES TRUE) diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index a1b2149..77a0048 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -458,6 +458,14 @@ void cmCursesMainForm::UpdateProgress(const std::string& msg, float prog) } } +void cmCursesMainForm::Write() +{ + this->FillCacheManagerFromUI(); + this->CMakeInstance->SaveCache( + this->CMakeInstance->GetHomeOutputDirectory()); + this->LoadCache(nullptr); +} + int cmCursesMainForm::Configure(int noconfigure) { this->ResetOutputs(); @@ -471,10 +479,7 @@ int cmCursesMainForm::Configure(int noconfigure) } // always save the current gui values to disk - this->FillCacheManagerFromUI(); - this->CMakeInstance->SaveCache( - this->CMakeInstance->GetHomeOutputDirectory()); - this->LoadCache(nullptr); + this->Write(); // run the generate process this->OkToGenerate = true; @@ -794,6 +799,21 @@ void cmCursesMainForm::HandleInput() else if (key == KEY_PPAGE || key == ctrl('u')) { form_driver(this->Form, REQ_PREV_PAGE); } + // first entry + else if (key == KEY_HOME) { + form_driver(this->Form, REQ_FIRST_PAGE); + form_driver(this->Form, REQ_FIRST_FIELD); + } + // last entry + else if (key == KEY_END) { + form_driver(this->Form, REQ_LAST_PAGE); + form_driver(this->Form, REQ_LAST_FIELD); + } + // write and quit + else if (key == 'w') { + this->Write(); + break; + } // configure else if (key == 'c') { this->Configure(); @@ -854,6 +874,10 @@ void cmCursesMainForm::HandleInput() if (!this->OldSearchString.empty()) { this->JumpToCacheEntry(this->OldSearchString.c_str()); } + } else if (key == 'N') { + if (!this->OldSearchString.empty()) { + this->JumpToCacheEntry(this->OldSearchString.c_str(), true); + } } // switch advanced on/off else if (key == 't') { @@ -945,6 +969,11 @@ int cmCursesMainForm::LoadCache(const char* /*unused*/) void cmCursesMainForm::JumpToCacheEntry(const char* astr) { + this->JumpToCacheEntry(astr, false); +} + +void cmCursesMainForm::JumpToCacheEntry(const char* astr, bool reverse) +{ std::string str; if (astr) { str = cmSystemTools::LowerCase(astr); @@ -973,12 +1002,21 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr) } } } - if (static_cast<size_t>(findex) >= 3 * this->NumberOfVisibleEntries - 1) { - set_current_field(this->Form, this->Fields[2]); - } else if (new_page(this->Fields[findex + 1])) { - form_driver(this->Form, REQ_NEXT_PAGE); + if (!reverse && + static_cast<size_t>(findex) >= 3 * this->NumberOfVisibleEntries - 1) { + form_driver(this->Form, REQ_FIRST_PAGE); + form_driver(this->Form, REQ_FIRST_FIELD); + } else if (reverse && static_cast<size_t>(findex) < 3) { + form_driver(this->Form, REQ_LAST_PAGE); + form_driver(this->Form, REQ_LAST_FIELD); + } else if (this->Fields[findex + (reverse ? -3 : 1)]->page != + this->Fields[findex]->page) { + form_driver(this->Form, reverse ? REQ_PREV_PAGE : REQ_NEXT_PAGE); + if (reverse) { + form_driver(this->Form, REQ_LAST_FIELD); + } } else { - form_driver(this->Form, REQ_NEXT_FIELD); + form_driver(this->Form, reverse ? REQ_PREV_FIELD : REQ_NEXT_FIELD); } cur = current_field(this->Form); findex = field_index(cur); @@ -1040,15 +1078,21 @@ const char* cmCursesMainForm::s_ConstHelpMessage = "hit 'g' to have CMake generate all the build files (i.e. makefiles or " "project files) and exit. " "At any point during the process, you can exit ccmake with 'q'. However, " - "this will not generate/change any build files.\n\n" + "this will not generate/change any build files. Additionally, you can exit " + "ccmake with 'w' to write changes to the cache file without generating or " + "changing the build files.\n\n" "ccmake KEYS:\n\n" "Navigation: " "You can use the arrow keys and page up, down to navigate the options. " - "Alternatively, you can use the following keys: \n" + "Additionally, you can use the following keys: \n" " C-n or j : next option\n" " C-p or k : previous options\n" " C-d : down one page\n" - " C-u : up one page\n\n" + " C-u : up one page\n" + " Home : jump to first option\n" + " End : jump to last option\n" + " n : next search result\n" + " N : previous search result\n\n" "Editing options: " "To change an option press enter or return. If the current options is a " "boolean, this will toggle its value. " diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 112b7e8..1ce75e7 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -87,6 +87,11 @@ public: void AddError(const std::string& message, const char* title) override; /** + * Write files to cache file without reconfiguring. + */ + void Write(); + + /** * Used to do a configure. If argument is specified, it does only the check * and not configure. */ @@ -123,6 +128,7 @@ protected: // Jump to the cache entry whose name matches the string. void JumpToCacheEntry(const char* str); + void JumpToCacheEntry(const char* str, bool reverse); // Clear and reset the output log and state void ResetOutputs(); diff --git a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx index 566e4a4..8043f82 100644 --- a/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.cxx @@ -10,6 +10,7 @@ #include "cmRuntimeDependencyArchive.h" #include "cmSystemTools.h" #include "cmUVProcessChain.h" +#include "cmUVStream.h" cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool:: cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool( @@ -35,7 +36,7 @@ bool cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool::GetFileInfo( builder.AddCommand(command); auto process = builder.Start(); - if (!process.Valid()) { + if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) { std::ostringstream e; e << "Failed to start objdump process for:\n " << file; this->SetError(e.str()); @@ -46,7 +47,8 @@ bool cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool::GetFileInfo( static const cmsys::RegularExpression neededRegex("^ *NEEDED *([^\n]*)$"); static const cmsys::RegularExpression rpathRegex("^ *RPATH *([^\n]*)$"); static const cmsys::RegularExpression runpathRegex("^ *RUNPATH *([^\n]*)$"); - while (std::getline(*process.OutputStream(), line)) { + cmUVPipeIStream output(process.GetLoop(), process.OutputStream()); + while (std::getline(output, line)) { cmsys::RegularExpressionMatch match; if (neededRegex.find(line.c_str(), match)) { needed.push_back(match.match(1)); @@ -73,8 +75,7 @@ bool cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool::GetFileInfo( this->SetError(e.str()); return false; } - auto status = process.GetStatus(); - if (!status[0] || status[0]->ExitStatus != 0) { + if (process.GetStatus(0).ExitStatus != 0) { std::ostringstream e; e << "Failed to run objdump on:\n " << file; this->SetError(e.str()); diff --git a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx index 6d97720..4c35841 100644 --- a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx @@ -9,6 +9,7 @@ #include "cmRuntimeDependencyArchive.h" #include "cmUVProcessChain.h" +#include "cmUVStream.h" cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool:: cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool( @@ -34,7 +35,7 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo( .AddCommand(command); auto process = builder.Start(); - if (!process.Valid()) { + if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) { std::ostringstream e; e << "Failed to start otool process for:\n " << file; this->SetError(e.str()); @@ -49,11 +50,12 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo( "^ *path (.*) \\(offset [0-9]+\\)$"); static const cmsys::RegularExpression nameRegex( "^ *name (.*) \\(offset [0-9]+\\)$"); - while (std::getline(*process.OutputStream(), line)) { + cmUVPipeIStream output(process.GetLoop(), process.OutputStream()); + while (std::getline(output, line)) { cmsys::RegularExpressionMatch cmdMatch; if (rpathRegex.find(line.c_str(), cmdMatch)) { - if (!std::getline(*process.OutputStream(), line) || - !std::getline(*process.OutputStream(), line)) { + // NOLINTNEXTLINE(misc-redundant-expression) + if (!std::getline(output, line) || !std::getline(output, line)) { this->SetError("Invalid output from otool"); return false; } @@ -66,8 +68,8 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo( return false; } } else if (loadDylibRegex.find(line.c_str(), cmdMatch)) { - if (!std::getline(*process.OutputStream(), line) || - !std::getline(*process.OutputStream(), line)) { + // NOLINTNEXTLINE(misc-redundant-expression) + if (!std::getline(output, line) || !std::getline(output, line)) { this->SetError("Invalid output from otool"); return false; } @@ -88,8 +90,7 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo( this->SetError(e.str()); return false; } - auto status = process.GetStatus(); - if (!status[0] || status[0]->ExitStatus != 0) { + if (process.GetStatus(0).ExitStatus != 0) { std::ostringstream e; e << "Failed to run otool on:\n " << file; this->SetError(e.str()); diff --git a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx index f342884..cd21140 100644 --- a/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.cxx @@ -9,6 +9,7 @@ #include "cmRuntimeDependencyArchive.h" #include "cmUVProcessChain.h" +#include "cmUVStream.h" cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool:: cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool( @@ -33,7 +34,7 @@ bool cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::GetFileInfo( builder.AddCommand(command); auto process = builder.Start(); - if (!process.Valid()) { + if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) { std::ostringstream e; e << "Failed to start dumpbin process for:\n " << file; this->SetError(e.str()); @@ -43,7 +44,8 @@ bool cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::GetFileInfo( std::string line; static const cmsys::RegularExpression regex( "^ ([^\n]*\\.[Dd][Ll][Ll])\r$"); - while (std::getline(*process.OutputStream(), line)) { + cmUVPipeIStream output(process.GetLoop(), process.OutputStream()); + while (std::getline(output, line)) { cmsys::RegularExpressionMatch match; if (regex.find(line.c_str(), match)) { needed.push_back(match.match(1)); @@ -56,8 +58,7 @@ bool cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool::GetFileInfo( this->SetError(e.str()); return false; } - auto status = process.GetStatus(); - if (!status[0] || status[0]->ExitStatus != 0) { + if (process.GetStatus(0).ExitStatus != 0) { std::ostringstream e; e << "Failed to run dumpbin on:\n " << file; this->SetError(e.str()); diff --git a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx index f14de55..d95da95 100644 --- a/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.cxx @@ -10,6 +10,7 @@ #include "cmRuntimeDependencyArchive.h" #include "cmSystemTools.h" #include "cmUVProcessChain.h" +#include "cmUVStream.h" cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool:: cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool( @@ -34,7 +35,7 @@ bool cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::GetFileInfo( builder.AddCommand(command); auto process = builder.Start(); - if (!process.Valid()) { + if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) { std::ostringstream e; e << "Failed to start objdump process for:\n " << file; this->SetError(e.str()); @@ -44,7 +45,8 @@ bool cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::GetFileInfo( std::string line; static const cmsys::RegularExpression regex( "^\t*DLL Name: ([^\n]*\\.[Dd][Ll][Ll])$"); - while (cmSystemTools::GetLineFromStream(*process.OutputStream(), line)) { + cmUVPipeIStream output(process.GetLoop(), process.OutputStream()); + while (cmSystemTools::GetLineFromStream(output, line)) { cmsys::RegularExpressionMatch match; if (regex.find(line.c_str(), match)) { needed.push_back(match.match(1)); @@ -57,8 +59,7 @@ bool cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool::GetFileInfo( this->SetError(e.str()); return false; } - auto status = process.GetStatus(); - if (!status[0] || status[0]->ExitStatus != 0) { + if (process.GetStatus(0).ExitStatus != 0) { std::ostringstream e; e << "Failed to run objdump on:\n " << file; this->SetError(e.str()); diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 22276ae..9176d12 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -955,13 +955,13 @@ void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os) // Isolate the file policy level. // Support CMake versions as far back as 2.6 but also support using NEW - // policy settings for up to CMake 3.25 (this upper limit may be reviewed + // policy settings for up to CMake 3.26 (this upper limit may be reviewed // and increased from time to time). This reduces the opportunity for CMake // warnings when an older export file is later used with newer CMake // versions. /* clang-format off */ os << "cmake_policy(PUSH)\n" - << "cmake_policy(VERSION 2.8.3...3.25)\n"; + << "cmake_policy(VERSION 2.8.3...3.26)\n"; /* clang-format on */ } diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 321f377..f1d04e5 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -1230,7 +1230,6 @@ const char* cmGlobalVisualStudio10Generator::GetToolsVersion() const { switch (this->Version) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: - case cmGlobalVisualStudioGenerator::VSVersion::VS11: return "4.0"; // in Visual Studio 2013 they detached the MSBuild tools version diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 3ad10eb..c4e1e11 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -8,156 +8,17 @@ #include <vector> #include "cmGlobalGenerator.h" -#include "cmGlobalGeneratorFactory.h" #include "cmGlobalVisualStudioGenerator.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -static const char vs11generatorName[] = "Visual Studio 11 2012"; - -// Map generator name without year to name with year. -static const char* cmVS11GenName(const std::string& name, std::string& genName) -{ - if (strncmp(name.c_str(), vs11generatorName, - sizeof(vs11generatorName) - 6) != 0) { - return nullptr; - } - const char* p = name.c_str() + sizeof(vs11generatorName) - 6; - if (cmHasLiteralPrefix(p, " 2012")) { - p += 5; - } - genName = std::string(vs11generatorName) + p; - return p; -} - -class cmGlobalVisualStudio11Generator::Factory - : public cmGlobalGeneratorFactory -{ -public: - std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator( - const std::string& name, bool allowArch, cmake* cm) const override - { - std::string genName; - const char* p = cmVS11GenName(name, genName); - if (!p) { - return std::unique_ptr<cmGlobalGenerator>(); - } - if (!*p) { - return std::unique_ptr<cmGlobalGenerator>( - new cmGlobalVisualStudio11Generator(cm, genName, "")); - } - if (!allowArch || *p++ != ' ') { - return std::unique_ptr<cmGlobalGenerator>(); - } - if (strcmp(p, "Win64") == 0) { - return std::unique_ptr<cmGlobalGenerator>( - new cmGlobalVisualStudio11Generator(cm, genName, "x64")); - } - if (strcmp(p, "ARM") == 0) { - return std::unique_ptr<cmGlobalGenerator>( - new cmGlobalVisualStudio11Generator(cm, genName, "ARM")); - } - - std::set<std::string> installedSDKs = - cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs(); - - if (installedSDKs.find(p) == installedSDKs.end()) { - return std::unique_ptr<cmGlobalGenerator>(); - } - - auto ret = std::unique_ptr<cmGlobalVisualStudio11Generator>( - new cmGlobalVisualStudio11Generator(cm, name, p)); - ret->WindowsCEVersion = "8.00"; - return std::unique_ptr<cmGlobalGenerator>(std::move(ret)); - } - - cmDocumentationEntry GetDocumentation() const override - { - return { std::string(vs11generatorName) + " [arch]", - "Deprecated. Generates Visual Studio 2012 project files. " - "Optional [arch] can be \"Win64\" or \"ARM\"." }; - } - - std::vector<std::string> GetGeneratorNames() const override - { - std::vector<std::string> names; - names.push_back(vs11generatorName); - return names; - } - - std::vector<std::string> GetGeneratorNamesWithPlatform() const override - { - std::vector<std::string> names; - names.push_back(vs11generatorName + std::string(" ARM")); - names.push_back(vs11generatorName + std::string(" Win64")); - - std::set<std::string> installedSDKs = - cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs(); - for (std::string const& i : installedSDKs) { - names.push_back(std::string(vs11generatorName) + " " + i); - } - - return names; - } - - bool SupportsToolset() const override { return true; } - bool SupportsPlatform() const override { return true; } - - std::vector<std::string> GetKnownPlatforms() const override - { - std::vector<std::string> platforms; - platforms.emplace_back("x64"); - platforms.emplace_back("Win32"); - platforms.emplace_back("ARM"); - - std::set<std::string> installedSDKs = - cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs(); - for (std::string const& i : installedSDKs) { - platforms.emplace_back(i); - } - - return platforms; - } - - std::string GetDefaultPlatformName() const override { return "Win32"; } -}; - -std::unique_ptr<cmGlobalGeneratorFactory> -cmGlobalVisualStudio11Generator::NewFactory() -{ - return std::unique_ptr<cmGlobalGeneratorFactory>(new Factory); -} - cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( cmake* cm, const std::string& name, std::string const& platformInGeneratorName) : cmGlobalVisualStudio10Generator(cm, name, platformInGeneratorName) { - std::string vc11Express; - this->ExpressEdition = cmSystemTools::ReadRegistryValue( - "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0\\Setup\\VC;" - "ProductDir", - vc11Express, cmSystemTools::KeyWOW64_32); - this->DefaultPlatformToolset = "v110"; - this->DefaultCLFlagTableName = "v11"; - this->DefaultCSharpFlagTableName = "v11"; - this->DefaultLibFlagTableName = "v11"; - this->DefaultLinkFlagTableName = "v11"; - this->DefaultMasmFlagTableName = "v11"; - this->DefaultRCFlagTableName = "v11"; - this->Version = VSVersion::VS11; -} - -bool cmGlobalVisualStudio11Generator::MatchesGeneratorName( - const std::string& name) const -{ - std::string genName; - if (cmVS11GenName(name, genName)) { - return genName == this->GetName(); - } - return false; } void cmGlobalVisualStudio11Generator::EnableLanguage( diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index fd25984..ad12c1f 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -13,7 +13,6 @@ #include "cmGlobalVisualStudio10Generator.h" #include "cmTransformDepfile.h" -class cmGlobalGeneratorFactory; class cmMakefile; class cmake; @@ -21,10 +20,6 @@ class cmake; class cmGlobalVisualStudio11Generator : public cmGlobalVisualStudio10Generator { public: - static std::unique_ptr<cmGlobalGeneratorFactory> NewFactory(); - - bool MatchesGeneratorName(const std::string& name) const override; - void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*, bool optional) override; @@ -58,8 +53,4 @@ protected: /** Return true if target system supports debugging deployment. */ bool TargetSystemSupportsDeployment() const override; - -private: - class Factory; - friend class Factory; }; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index b254777..62c0b5b 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -329,26 +329,6 @@ void cmGlobalVisualStudio7Generator::Generate() "Add CMAKE_WARN_VS9=OFF to the cache to disable this warning."); } } - - if (this->Version == VSVersion::VS11 && - !this->CMakeInstance->GetIsInTryCompile()) { - std::string cmakeWarnVS11; - if (cmValue cached = this->CMakeInstance->GetState()->GetCacheEntryValue( - "CMAKE_WARN_VS11")) { - this->CMakeInstance->MarkCliAsUsed("CMAKE_WARN_VS11"); - cmakeWarnVS11 = *cached; - } else { - cmSystemTools::GetEnv("CMAKE_WARN_VS11", cmakeWarnVS11); - } - if (cmakeWarnVS11.empty() || !cmIsOff(cmakeWarnVS11)) { - this->CMakeInstance->IssueMessage( - MessageType::WARNING, - "The \"Visual Studio 11 2012\" generator is deprecated " - "and will be removed in a future version of CMake." - "\n" - "Add CMAKE_WARN_VS11=OFF to the cache to disable this warning."); - } - } } void cmGlobalVisualStudio7Generator::OutputSLNFile( diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 702199d..eac0672 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -97,8 +97,6 @@ const char* cmGlobalVisualStudioGenerator::GetIDEVersion() const switch (this->Version) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: return "9.0"; - case cmGlobalVisualStudioGenerator::VSVersion::VS11: - return "11.0"; case cmGlobalVisualStudioGenerator::VSVersion::VS12: return "12.0"; case cmGlobalVisualStudioGenerator::VSVersion::VS14: @@ -124,14 +122,6 @@ void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; fout << "# Visual Studio 2008\n"; break; - case cmGlobalVisualStudioGenerator::VSVersion::VS11: - fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; - if (this->ExpressEdition) { - fout << "# Visual Studio Express 2012 for Windows Desktop\n"; - } else { - fout << "# Visual Studio 2012\n"; - } - break; case cmGlobalVisualStudioGenerator::VSVersion::VS12: fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; if (this->ExpressEdition) { diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 3e20ada..3008c18 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -35,7 +35,6 @@ public: enum class VSVersion : uint16_t { VS9 = 90, - VS11 = 110, VS12 = 120, /* VS13 = 130 was skipped */ VS14 = 140, diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 602b42f..9fe66d3 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -127,8 +127,6 @@ static unsigned int VSVersionToMajor( switch (v) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: return 9; - case cmGlobalVisualStudioGenerator::VSVersion::VS11: - return 11; case cmGlobalVisualStudioGenerator::VSVersion::VS12: return 12; case cmGlobalVisualStudioGenerator::VSVersion::VS14: @@ -149,8 +147,6 @@ static const char* VSVersionToToolset( switch (v) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: return "v90"; - case cmGlobalVisualStudioGenerator::VSVersion::VS11: - return "v110"; case cmGlobalVisualStudioGenerator::VSVersion::VS12: return "v120"; case cmGlobalVisualStudioGenerator::VSVersion::VS14: @@ -171,8 +167,6 @@ static std::string VSVersionToMajorString( switch (v) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: return "9"; - case cmGlobalVisualStudioGenerator::VSVersion::VS11: - return "11"; case cmGlobalVisualStudioGenerator::VSVersion::VS12: return "12"; case cmGlobalVisualStudioGenerator::VSVersion::VS14: @@ -192,7 +186,6 @@ static const char* VSVersionToAndroidToolset( { switch (v) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: - case cmGlobalVisualStudioGenerator::VSVersion::VS11: case cmGlobalVisualStudioGenerator::VSVersion::VS12: return ""; case cmGlobalVisualStudioGenerator::VSVersion::VS14: @@ -493,7 +486,6 @@ bool cmGlobalVisualStudioVersionedGenerator::MatchesGeneratorName( std::string genName; switch (this->Version) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: - case cmGlobalVisualStudioGenerator::VSVersion::VS11: case cmGlobalVisualStudioGenerator::VSVersion::VS12: case cmGlobalVisualStudioGenerator::VSVersion::VS14: break; @@ -761,7 +753,6 @@ cmGlobalVisualStudioVersionedGenerator::GetAndroidApplicationTypeRevision() { switch (this->Version) { case cmGlobalVisualStudioGenerator::VSVersion::VS9: - case cmGlobalVisualStudioGenerator::VSVersion::VS11: case cmGlobalVisualStudioGenerator::VSVersion::VS12: return ""; case cmGlobalVisualStudioGenerator::VSVersion::VS14: diff --git a/Source/cmLDConfigLDConfigTool.cxx b/Source/cmLDConfigLDConfigTool.cxx index 0752b33..154aa27 100644 --- a/Source/cmLDConfigLDConfigTool.cxx +++ b/Source/cmLDConfigLDConfigTool.cxx @@ -14,6 +14,7 @@ #include "cmRuntimeDependencyArchive.h" #include "cmSystemTools.h" #include "cmUVProcessChain.h" +#include "cmUVStream.h" cmLDConfigLDConfigTool::cmLDConfigLDConfigTool( cmRuntimeDependencyArchive* archive) @@ -43,14 +44,15 @@ bool cmLDConfigLDConfigTool::GetLDConfigPaths(std::vector<std::string>& paths) builder.SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT) .AddCommand(ldConfigCommand); auto process = builder.Start(); - if (!process.Valid()) { + if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) { this->Archive->SetError("Failed to start ldconfig process"); return false; } std::string line; static const cmsys::RegularExpression regex("^([^\t:]*):"); - while (std::getline(*process.OutputStream(), line)) { + cmUVPipeIStream output(process.GetLoop(), process.OutputStream()); + while (std::getline(output, line)) { cmsys::RegularExpressionMatch match; if (regex.find(line.c_str(), match)) { paths.push_back(match.match(1)); @@ -61,8 +63,7 @@ bool cmLDConfigLDConfigTool::GetLDConfigPaths(std::vector<std::string>& paths) this->Archive->SetError("Failed to wait on ldconfig process"); return false; } - auto status = process.GetStatus(); - if (!status[0] || status[0]->ExitStatus != 0) { + if (process.GetStatus(0).ExitStatus != 0) { this->Archive->SetError("Failed to run ldconfig"); return false; } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index af0e118..24ef5c2 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -198,7 +198,7 @@ void cmLocalVisualStudio7Generator::GenerateTarget(cmGeneratorTarget* target) // Intel Fortran always uses VS9 format ".vfproj" files. cmGlobalVisualStudioGenerator::VSVersion realVersion = gg->GetVersion(); if (this->FortranProject && - gg->GetVersion() >= cmGlobalVisualStudioGenerator::VSVersion::VS11) { + gg->GetVersion() >= cmGlobalVisualStudioGenerator::VSVersion::VS12) { gg->SetVersion(cmGlobalVisualStudioGenerator::VSVersion::VS9); } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0af0ed0..c3c8d46 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4613,7 +4613,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, } // Deprecate old policies. - if (status == cmPolicies::OLD && id <= cmPolicies::CMP0114 && + if (status == cmPolicies::OLD && id <= cmPolicies::CMP0120 && !(this->GetCMakeInstance()->GetIsInTryCompile() && ( // Policies set by cmCoreTryCompile::TryCompileCode. diff --git a/Source/cmUVProcessChain.cxx b/Source/cmUVProcessChain.cxx index ed5f38b..3de7ae5 100644 --- a/Source/cmUVProcessChain.cxx +++ b/Source/cmUVProcessChain.cxx @@ -5,11 +5,9 @@ #include "cmUVProcessChain.h" #include <array> -#include <cassert> #include <csignal> #include <cstdio> #include <istream> // IWYU pragma: keep -#include <iterator> #include <type_traits> #include <utility> @@ -19,43 +17,24 @@ #include "cmGetPipes.h" #include "cmUVHandlePtr.h" -#include "cmUVStreambuf.h" struct cmUVProcessChain::InternalData { - struct BasicStreamData + struct StreamData { - cmUVStreambuf Streambuf; - cm::uv_pipe_ptr BuiltinStream; + int BuiltinStream = -1; uv_stdio_container_t Stdio; }; - template <typename IOStream> - struct StreamData : public BasicStreamData - { - StreamData() - : BuiltinIOStream(&this->Streambuf) - { - } - - IOStream BuiltinIOStream; - - IOStream* GetBuiltinStream() - { - if (this->BuiltinStream.get()) { - return &this->BuiltinIOStream; - } - return nullptr; - } - }; - struct ProcessData { cmUVProcessChain::InternalData* Data; cm::uv_process_ptr Process; + cm::uv_pipe_ptr InputPipe; cm::uv_pipe_ptr OutputPipe; - bool Finished = false; Status ProcessStatus; + + void Finish(); }; const cmUVProcessChainBuilder* Builder = nullptr; @@ -64,18 +43,21 @@ struct cmUVProcessChain::InternalData cm::uv_loop_ptr Loop; - StreamData<std::istream> OutputStreamData; - StreamData<std::istream> ErrorStreamData; + StreamData InputStreamData; + StreamData OutputStreamData; + StreamData ErrorStreamData; + cm::uv_pipe_ptr TempOutputPipe; + cm::uv_pipe_ptr TempErrorPipe; unsigned int ProcessesCompleted = 0; std::vector<std::unique_ptr<ProcessData>> Processes; bool Prepare(const cmUVProcessChainBuilder* builder); - bool AddCommand(const cmUVProcessChainBuilder::ProcessConfiguration& config, - bool first, bool last); - bool Finish(); - - static const Status* GetStatus(const ProcessData& data); + void SpawnProcess( + std::size_t index, + const cmUVProcessChainBuilder::ProcessConfiguration& config, bool first, + bool last); + void Finish(); }; cmUVProcessChainBuilder::cmUVProcessChainBuilder() @@ -132,9 +114,6 @@ cmUVProcessChainBuilder& cmUVProcessChainBuilder::SetExternalStream( { switch (stdio) { case Stream_INPUT: - // FIXME - break; - case Stream_OUTPUT: case Stream_ERROR: { auto& streamData = this->Stdio[stdio]; @@ -167,11 +146,9 @@ cmUVProcessChain cmUVProcessChainBuilder::Start() const return chain; } - for (auto it = this->Processes.begin(); it != this->Processes.end(); ++it) { - if (!chain.Data->AddCommand(*it, it == this->Processes.begin(), - it == std::prev(this->Processes.end()))) { - return chain; - } + for (std::size_t i = 0; i < this->Processes.size(); i++) { + chain.Data->SpawnProcess(i, this->Processes[i], i == 0, + i == this->Processes.size() - 1); } chain.Data->Finish(); @@ -179,20 +156,30 @@ cmUVProcessChain cmUVProcessChainBuilder::Start() const return chain; } -const cmUVProcessChain::Status* cmUVProcessChain::InternalData::GetStatus( - const cmUVProcessChain::InternalData::ProcessData& data) -{ - if (data.Finished) { - return &data.ProcessStatus; - } - return nullptr; -} - bool cmUVProcessChain::InternalData::Prepare( const cmUVProcessChainBuilder* builder) { this->Builder = builder; + auto const& input = + this->Builder->Stdio[cmUVProcessChainBuilder::Stream_INPUT]; + auto& inputData = this->InputStreamData; + switch (input.Type) { + case cmUVProcessChainBuilder::None: + inputData.Stdio.flags = UV_IGNORE; + break; + + case cmUVProcessChainBuilder::Builtin: { + // FIXME + break; + } + + case cmUVProcessChainBuilder::External: + inputData.Stdio.flags = UV_INHERIT_FD; + inputData.Stdio.data.fd = input.FileDescriptor; + break; + } + auto const& error = this->Builder->Stdio[cmUVProcessChainBuilder::Stream_ERROR]; auto& errorData = this->ErrorStreamData; @@ -207,12 +194,17 @@ bool cmUVProcessChain::InternalData::Prepare( return false; } - errorData.BuiltinStream.init(*this->Loop, 0); - if (uv_pipe_open(errorData.BuiltinStream, pipeFd[0]) < 0) { - return false; - } + errorData.BuiltinStream = pipeFd[0]; errorData.Stdio.flags = UV_INHERIT_FD; errorData.Stdio.data.fd = pipeFd[1]; + + if (this->TempErrorPipe.init(*this->Loop, 0) < 0) { + return false; + } + if (uv_pipe_open(this->TempErrorPipe, errorData.Stdio.data.fd) < 0) { + return false; + } + break; } @@ -232,13 +224,25 @@ bool cmUVProcessChain::InternalData::Prepare( case cmUVProcessChainBuilder::Builtin: if (this->Builder->MergedBuiltinStreams) { + outputData.BuiltinStream = errorData.BuiltinStream; outputData.Stdio.flags = UV_INHERIT_FD; outputData.Stdio.data.fd = errorData.Stdio.data.fd; } else { - outputData.BuiltinStream.init(*this->Loop, 0); - outputData.Stdio.flags = - static_cast<uv_stdio_flags>(UV_CREATE_PIPE | UV_WRITABLE_PIPE); - outputData.Stdio.data.stream = outputData.BuiltinStream; + int pipeFd[2]; + if (cmGetPipes(pipeFd) < 0) { + return false; + } + + outputData.BuiltinStream = pipeFd[0]; + outputData.Stdio.flags = UV_INHERIT_FD; + outputData.Stdio.data.fd = pipeFd[1]; + + if (this->TempOutputPipe.init(*this->Loop, 0) < 0) { + return false; + } + if (uv_pipe_open(this->TempOutputPipe, outputData.Stdio.data.fd) < 0) { + return false; + } } break; @@ -248,16 +252,47 @@ bool cmUVProcessChain::InternalData::Prepare( break; } + bool first = true; + for (std::size_t i = 0; i < this->Builder->Processes.size(); i++) { + this->Processes.emplace_back(cm::make_unique<ProcessData>()); + auto& process = *this->Processes.back(); + process.Data = this; + process.ProcessStatus.Finished = false; + + if (!first) { + auto& prevProcess = *this->Processes[i - 1]; + + int pipeFd[2]; + if (cmGetPipes(pipeFd) < 0) { + return false; + } + + if (prevProcess.OutputPipe.init(*this->Loop, 0) < 0) { + return false; + } + if (uv_pipe_open(prevProcess.OutputPipe, pipeFd[1]) < 0) { + return false; + } + if (process.InputPipe.init(*this->Loop, 0) < 0) { + return false; + } + if (uv_pipe_open(process.InputPipe, pipeFd[0]) < 0) { + return false; + } + } + + first = false; + } + return true; } -bool cmUVProcessChain::InternalData::AddCommand( +void cmUVProcessChain::InternalData::SpawnProcess( + std::size_t index, const cmUVProcessChainBuilder::ProcessConfiguration& config, bool first, bool last) { - this->Processes.emplace_back(cm::make_unique<ProcessData>()); - auto& process = *this->Processes.back(); - process.Data = this; + auto& process = *this->Processes[index]; auto options = uv_process_options_t(); @@ -277,24 +312,18 @@ bool cmUVProcessChain::InternalData::AddCommand( } std::array<uv_stdio_container_t, 3> stdio; - stdio[0] = uv_stdio_container_t(); if (first) { - stdio[0].flags = UV_IGNORE; + stdio[0] = this->InputStreamData.Stdio; } else { - assert(this->Processes.size() >= 2); - auto& prev = *this->Processes[this->Processes.size() - 2]; + stdio[0] = uv_stdio_container_t(); stdio[0].flags = UV_INHERIT_STREAM; - stdio[0].data.stream = prev.OutputPipe; + stdio[0].data.stream = process.InputPipe; } if (last) { stdio[1] = this->OutputStreamData.Stdio; } else { - if (process.OutputPipe.init(*this->Loop, 0) < 0) { - return false; - } stdio[1] = uv_stdio_container_t(); - stdio[1].flags = - static_cast<uv_stdio_flags>(UV_CREATE_PIPE | UV_WRITABLE_PIPE); + stdio[1].flags = UV_INHERIT_STREAM; stdio[1].data.stream = process.OutputPipe; } stdio[2] = this->ErrorStreamData.Stdio; @@ -304,40 +333,24 @@ bool cmUVProcessChain::InternalData::AddCommand( options.exit_cb = [](uv_process_t* handle, int64_t exitStatus, int termSignal) { auto* processData = static_cast<ProcessData*>(handle->data); - processData->Finished = true; processData->ProcessStatus.ExitStatus = exitStatus; processData->ProcessStatus.TermSignal = termSignal; - processData->Data->ProcessesCompleted++; + processData->Finish(); }; - return process.Process.spawn(*this->Loop, options, &process) >= 0; + if ((process.ProcessStatus.SpawnResult = + process.Process.spawn(*this->Loop, options, &process)) < 0) { + process.Finish(); + } + process.InputPipe.reset(); + process.OutputPipe.reset(); } -bool cmUVProcessChain::InternalData::Finish() +void cmUVProcessChain::InternalData::Finish() { - if (this->Builder->Stdio[cmUVProcessChainBuilder::Stream_OUTPUT].Type == - cmUVProcessChainBuilder::Builtin && - !this->Builder->MergedBuiltinStreams) { - this->OutputStreamData.Streambuf.open( - this->OutputStreamData.BuiltinStream); - } - - if (this->Builder->Stdio[cmUVProcessChainBuilder::Stream_ERROR].Type == - cmUVProcessChainBuilder::Builtin) { - cm::uv_pipe_ptr tmpPipe; - if (tmpPipe.init(*this->Loop, 0) < 0) { - return false; - } - if (uv_pipe_open(tmpPipe, this->ErrorStreamData.Stdio.data.fd) < 0) { - return false; - } - tmpPipe.reset(); - - this->ErrorStreamData.Streambuf.open(this->ErrorStreamData.BuiltinStream); - } - + this->TempOutputPipe.reset(); + this->TempErrorPipe.reset(); this->Valid = true; - return true; } cmUVProcessChain::cmUVProcessChain() @@ -365,17 +378,14 @@ uv_loop_t& cmUVProcessChain::GetLoop() return *this->Data->Loop; } -std::istream* cmUVProcessChain::OutputStream() +int cmUVProcessChain::OutputStream() { - if (this->Data->Builder->MergedBuiltinStreams) { - return this->Data->ErrorStreamData.GetBuiltinStream(); - } - return this->Data->OutputStreamData.GetBuiltinStream(); + return this->Data->OutputStreamData.BuiltinStream; } -std::istream* cmUVProcessChain::ErrorStream() +int cmUVProcessChain::ErrorStream() { - return this->Data->ErrorStreamData.GetBuiltinStream(); + return this->Data->ErrorStreamData.BuiltinStream; } bool cmUVProcessChain::Valid() const @@ -412,19 +422,15 @@ std::vector<const cmUVProcessChain::Status*> cmUVProcessChain::GetStatus() std::vector<const cmUVProcessChain::Status*> statuses( this->Data->Processes.size(), nullptr); for (std::size_t i = 0; i < statuses.size(); i++) { - statuses[i] = this->GetStatus(i); + statuses[i] = &this->GetStatus(i); } return statuses; } -const cmUVProcessChain::Status* cmUVProcessChain::GetStatus( +const cmUVProcessChain::Status& cmUVProcessChain::GetStatus( std::size_t index) const { - auto const& process = *this->Data->Processes[index]; - if (process.Finished) { - return &process.ProcessStatus; - } - return nullptr; + return this->Data->Processes[index]->ProcessStatus; } bool cmUVProcessChain::Finished() const @@ -435,8 +441,12 @@ bool cmUVProcessChain::Finished() const std::pair<cmUVProcessChain::ExceptionCode, std::string> cmUVProcessChain::Status::GetException() const { + if (this->SpawnResult) { + return std::make_pair(ExceptionCode::Spawn, + uv_strerror(this->SpawnResult)); + } #ifdef _WIN32 - if ((this->ExitStatus & 0xF0000000) == 0xC0000000) { + if (this->Finished && (this->ExitStatus & 0xF0000000) == 0xC0000000) { // Child terminated due to exceptional behavior. switch (this->ExitStatus) { case STATUS_CONTROL_C_EXIT: @@ -511,9 +521,8 @@ cmUVProcessChain::Status::GetException() const } } } - return std::make_pair(ExceptionCode::None, ""); #else - if (this->TermSignal) { + if (this->Finished && this->TermSignal) { switch (this->TermSignal) { # ifdef SIGSEGV case SIGSEGV: @@ -670,6 +679,12 @@ cmUVProcessChain::Status::GetException() const } } } - return std::make_pair(ExceptionCode::None, ""); #endif + return std::make_pair(ExceptionCode::None, ""); +} + +void cmUVProcessChain::InternalData::ProcessData::Finish() +{ + this->ProcessStatus.Finished = true; + this->Data->ProcessesCompleted++; } diff --git a/Source/cmUVProcessChain.h b/Source/cmUVProcessChain.h index f92742f..d7a4a0e 100644 --- a/Source/cmUVProcessChain.h +++ b/Source/cmUVProcessChain.h @@ -5,7 +5,6 @@ #include <array> #include <cstddef> // IWYU pragma: keep #include <cstdint> -#include <iosfwd> #include <memory> #include <string> #include <utility> @@ -74,11 +73,14 @@ public: Illegal, Interrupt, Numerical, + Spawn, Other, }; struct Status { + int SpawnResult; + bool Finished; int64_t ExitStatus; int TermSignal; @@ -96,13 +98,13 @@ public: uv_loop_t& GetLoop(); // FIXME: Add stdin support - std::istream* OutputStream(); - std::istream* ErrorStream(); + int OutputStream(); + int ErrorStream(); bool Valid() const; bool Wait(int64_t milliseconds = -1); std::vector<const Status*> GetStatus() const; - const Status* GetStatus(std::size_t index) const; + const Status& GetStatus(std::size_t index) const; bool Finished() const; private: diff --git a/Source/cmUVStream.h b/Source/cmUVStream.h new file mode 100644 index 0000000..5998256 --- /dev/null +++ b/Source/cmUVStream.h @@ -0,0 +1,140 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#pragma once + +#include <cassert> +#include <istream> + +#include <cm3p/uv.h> + +#include "cmUVHandlePtr.h" +#include "cmUVStreambuf.h" + +template <typename CharT, typename Traits = std::char_traits<CharT>> +class cmBasicUVIStream : public std::basic_istream<CharT> +{ +public: + cmBasicUVIStream(); + cmBasicUVIStream(uv_stream_t* stream); + + bool is_open() const; + + void open(uv_stream_t* stream); + + void close(); + +private: + cmBasicUVStreambuf<CharT, Traits> Buffer; +}; + +template <typename CharT, typename Traits> +cmBasicUVIStream<CharT, Traits>::cmBasicUVIStream() + : std::basic_istream<CharT, Traits>(&this->Buffer) +{ +} + +template <typename CharT, typename Traits> +cmBasicUVIStream<CharT, Traits>::cmBasicUVIStream(uv_stream_t* stream) + : cmBasicUVIStream() +{ + this->open(stream); +} + +template <typename CharT, typename Traits> +bool cmBasicUVIStream<CharT, Traits>::is_open() const +{ + return this->Buffer.is_open(); +} + +template <typename CharT, typename Traits> +void cmBasicUVIStream<CharT, Traits>::open(uv_stream_t* stream) +{ + this->Buffer.open(stream); +} + +template <typename CharT, typename Traits> +void cmBasicUVIStream<CharT, Traits>::close() +{ + this->Buffer.close(); +} + +using cmUVIStream = cmBasicUVIStream<char>; + +template <typename CharT, typename Traits = std::char_traits<CharT>> +class cmBasicUVPipeIStream : public cmBasicUVIStream<CharT, Traits> +{ +public: + cmBasicUVPipeIStream(); + cmBasicUVPipeIStream(uv_loop_t& loop, int fd); + + using cmBasicUVIStream<CharT, Traits>::is_open; + + void open(uv_loop_t& loop, int fd); + + void close(); + +private: + cm::uv_pipe_ptr Pipe; +}; + +template <typename CharT, typename Traits> +cmBasicUVPipeIStream<CharT, Traits>::cmBasicUVPipeIStream() = default; + +template <typename CharT, typename Traits> +cmBasicUVPipeIStream<CharT, Traits>::cmBasicUVPipeIStream(uv_loop_t& loop, + int fd) +{ + this->open(loop, fd); +} + +template <typename CharT, typename Traits> +void cmBasicUVPipeIStream<CharT, Traits>::open(uv_loop_t& loop, int fd) +{ + this->Pipe.init(loop, 0); + uv_pipe_open(this->Pipe, fd); + this->cmBasicUVIStream<CharT, Traits>::open(this->Pipe); +} + +template <typename CharT, typename Traits> +void cmBasicUVPipeIStream<CharT, Traits>::close() +{ + this->cmBasicUVIStream<CharT, Traits>::close(); + this->Pipe.reset(); +} + +using cmUVPipeIStream = cmBasicUVPipeIStream<char>; + +template <typename ReadCallback, typename FinishCallback> +void cmUVStreamRead(uv_stream_t* stream, ReadCallback onRead, + FinishCallback onFinish) +{ + struct ReadData + { + std::vector<char> Buffer; + ReadCallback OnRead; + FinishCallback OnFinish; + }; + + stream->data = new ReadData{ {}, std::move(onRead), std::move(onFinish) }; + uv_read_start( + stream, + [](uv_handle_t* s, std::size_t suggestedSize, uv_buf_t* buffer) { + auto* data = static_cast<ReadData*>(s->data); + data->Buffer.resize(suggestedSize); + buffer->base = data->Buffer.data(); + buffer->len = suggestedSize; + }, + [](uv_stream_t* s, ssize_t nread, const uv_buf_t* buffer) { + auto* data = static_cast<ReadData*>(s->data); + if (nread > 0) { + (void)buffer; + assert(buffer->base == data->Buffer.data()); + data->Buffer.resize(nread); + data->OnRead(std::move(data->Buffer)); + } else if (nread < 0 /*|| nread == UV_EOF*/) { + data->OnFinish(); + uv_read_stop(s); + delete data; + } + }); +} diff --git a/Source/cmUVStreambuf.h b/Source/cmUVStreambuf.h index efe45de..4f7b209 100644 --- a/Source/cmUVStreambuf.h +++ b/Source/cmUVStreambuf.h @@ -14,7 +14,8 @@ /* * This file is based on example code from: * - * http://www.voidcn.com/article/p-vjnlygmc-gy.html + * https://web.archive.org/web/20170515211805/ + * http://www.mr-edd.co.uk/blog/beginners_guide_streambuf * * The example code was distributed under the following license: * diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 7975018..5887ca2 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2533,18 +2533,6 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) break; case cmGeneratorTarget::SourceKindExternalObject: tool = "Object"; - if (this->LocalGenerator->GetVersion() < - cmGlobalVisualStudioGenerator::VSVersion::VS11) { - // For VS == 10 we cannot use LinkObjects to avoid linking custom - // command outputs. If an object file is generated in this target, - // then vs10 will use it in the build, and we have to list it as - // None instead of Object. - std::vector<cmSourceFile*> const* d = - this->GeneratorTarget->GetSourceDepends(si.Source); - if (d && !d->empty()) { - tool = "None"; - } - } break; case cmGeneratorTarget::SourceKindExtra: this->WriteExtraSource(e1, si.Source, toolSettings); diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 6e98874..7e4503b 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -75,7 +75,6 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault() // the flag to disable exception handling. When the user does // remove the flag we need to override the IDE default of on. switch (this->Version) { - case cmGlobalVisualStudioGenerator::VSVersion::VS11: case cmGlobalVisualStudioGenerator::VSVersion::VS12: case cmGlobalVisualStudioGenerator::VSVersion::VS14: case cmGlobalVisualStudioGenerator::VSVersion::VS15: diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f30d4d3..b8ebca5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -94,7 +94,6 @@ # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalJOMMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" -# include "cmGlobalVisualStudio11Generator.h" # include "cmGlobalVisualStudio12Generator.h" # include "cmGlobalVisualStudio14Generator.h" # include "cmGlobalVisualStudio9Generator.h" @@ -2507,6 +2506,18 @@ int cmake::ActualConfigure() "Name of generator toolset.", cmStateEnums::INTERNAL); } + if (!this->State->GetInitializedCacheValue( + "CMAKE_CROSSCOMPILING_EMULATOR")) { + cm::optional<std::string> emulator = + cmSystemTools::GetEnvVar("CMAKE_CROSSCOMPILING_EMULATOR"); + if (emulator && !emulator->empty()) { + std::string message = + "Emulator to run executables and tests when cross compiling."; + this->AddCacheEntry("CMAKE_CROSSCOMPILING_EMULATOR", *emulator, message, + cmStateEnums::STRING); + } + } + // reset any system configuration information, except for when we are // InTryCompile. With TryCompile the system info is taken from the parent's // info to save time @@ -2605,7 +2616,6 @@ std::unique_ptr<cmGlobalGenerator> cmake::EvaluateDefaultGlobalGenerator() static VSVersionedGenerator const vsGenerators[] = { { "14.0", "Visual Studio 14 2015" }, // { "12.0", "Visual Studio 12 2013" }, // - { "11.0", "Visual Studio 11 2012" }, // { "9.0", "Visual Studio 9 2008" } }; static const char* const vsEntries[] = { @@ -2990,7 +3000,6 @@ void cmake::AddDefaultGenerators() cmGlobalVisualStudioVersionedGenerator::NewFactory15()); this->Generators.push_back(cmGlobalVisualStudio14Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio12Generator::NewFactory()); - this->Generators.push_back(cmGlobalVisualStudio11Generator::NewFactory()); this->Generators.push_back(cmGlobalVisualStudio9Generator::NewFactory()); this->Generators.push_back(cmGlobalBorlandMakefileGenerator::NewFactory()); this->Generators.push_back(cmGlobalNMakeMakefileGenerator::NewFactory()); @@ -3916,7 +3925,7 @@ std::function<int()> cmake::BuildWorkflowStep( return [builder]() -> int { auto chain = builder.Start(); chain.Wait(); - return static_cast<int>(chain.GetStatus().front()->ExitStatus); + return static_cast<int>(chain.GetStatus(0).ExitStatus); }; } #endif diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 9929e85..eb1f93d 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -28,6 +28,7 @@ #include "cmSystemTools.h" #include "cmTransformDepfile.h" #include "cmUVProcessChain.h" +#include "cmUVStream.h" #include "cmUtils.hxx" #include "cmValue.h" #include "cmVersion.h" @@ -2008,7 +2009,7 @@ int cmcmd::RunPreprocessor(const std::vector<std::string>& command, .SetBuiltinStream(cmUVProcessChainBuilder::Stream_ERROR) .AddCommand(command); auto process = builder.Start(); - if (!process.Valid()) { + if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) { std::cerr << "Failed to start preprocessor."; return 1; } @@ -2016,12 +2017,9 @@ int cmcmd::RunPreprocessor(const std::vector<std::string>& command, std::cerr << "Failed to wait for preprocessor"; return 1; } - auto status = process.GetStatus(); - if (!status[0] || status[0]->ExitStatus != 0) { - auto* errorStream = process.ErrorStream(); - if (errorStream) { - std::cerr << errorStream->rdbuf(); - } + if (process.GetStatus(0).ExitStatus != 0) { + cmUVPipeIStream errorStream(process.GetLoop(), process.ErrorStream()); + std::cerr << errorStream.rdbuf(); return 1; } @@ -2130,7 +2128,7 @@ int cmcmd::RunLLVMRC(std::vector<std::string> const& args) .AddCommand(resource_compile); auto process = builder.Start(); result = 0; - if (!process.Valid()) { + if (!process.Valid() || process.GetStatus(0).SpawnResult != 0) { std::cerr << "Failed to start resource compiler."; result = 1; } else { @@ -2144,12 +2142,9 @@ int cmcmd::RunLLVMRC(std::vector<std::string> const& args) if (result != 0) { return result; } - auto status = process.GetStatus(); - if (!status[0] || status[0]->ExitStatus != 0) { - auto* errorStream = process.ErrorStream(); - if (errorStream) { - std::cerr << errorStream->rdbuf(); - } + if (process.GetStatus(0).ExitStatus != 0) { + cmUVPipeIStream errorStream(process.GetLoop(), process.ErrorStream()); + std::cerr << errorStream.rdbuf(); return 1; } diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index 5c14de2..b22d76d 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -63,6 +63,7 @@ if(WIN32) endif() configure_file(testXMLParser.h.in testXMLParser.h @ONLY) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testUVProcessChainInput.txt" "HELLO WORLD!") create_test_sourcelist(CMakeLib_TEST_SRCS CMakeLibTests.cxx ${CMakeLib_TESTS}) add_executable(CMakeLibTests ${CMakeLib_TEST_SRCS}) diff --git a/Tests/CMakeLib/testUVProcessChain.cxx b/Tests/CMakeLib/testUVProcessChain.cxx index 7027689..7630aa0 100644 --- a/Tests/CMakeLib/testUVProcessChain.cxx +++ b/Tests/CMakeLib/testUVProcessChain.cxx @@ -1,5 +1,6 @@ #include <algorithm> #include <csignal> +#include <cstdio> #include <functional> #include <iostream> #include <sstream> @@ -16,11 +17,11 @@ #include "cmStringAlgorithms.h" #include "cmUVHandlePtr.h" #include "cmUVProcessChain.h" +#include "cmUVStream.h" #include "cmUVStreambuf.h" struct ExpectedStatus { - bool Finished; bool MatchExitStatus; bool MatchTermSignal; cmUVProcessChain::Status Status; @@ -28,38 +29,6 @@ struct ExpectedStatus std::string ExceptionString; }; -static const std::vector<ExpectedStatus> status1 = { - { false, false, false, { 0, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, - { false, false, false, { 0, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, - { false, false, false, { 0, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, -}; - -static const std::vector<ExpectedStatus> status2 = { - { true, true, true, { 0, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, - { false, false, false, { 0, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, - { false, false, false, { 0, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, -}; - -static const std::vector<ExpectedStatus> status3 = { - { true, true, true, { 0, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, - { true, true, true, { 1, 0 }, cmUVProcessChain::ExceptionCode::None, "" }, -#ifdef _WIN32 - { true, - true, - true, - { STATUS_ACCESS_VIOLATION, 0 }, - cmUVProcessChain::ExceptionCode::Fault, - "Access violation" }, -#else - { true, - false, - true, - { 0, SIGABRT }, - cmUVProcessChain::ExceptionCode::Other, - "Subprocess aborted" }, -#endif -}; - static const char* ExceptionCodeToString(cmUVProcessChain::ExceptionCode code) { switch (code) { @@ -73,6 +42,8 @@ static const char* ExceptionCodeToString(cmUVProcessChain::ExceptionCode code) return "Interrupt"; case cmUVProcessChain::ExceptionCode::Numerical: return "Numerical"; + case cmUVProcessChain::ExceptionCode::Spawn: + return "Spawn"; case cmUVProcessChain::ExceptionCode::Other: return "Other"; default: @@ -83,9 +54,10 @@ static const char* ExceptionCodeToString(cmUVProcessChain::ExceptionCode code) bool operator==(const cmUVProcessChain::Status* actual, const ExpectedStatus& expected) { - if (!expected.Finished) { - return !actual; - } else if (!actual) { + if (expected.Status.SpawnResult != actual->SpawnResult) { + return false; + } + if (expected.Status.Finished != actual->Finished) { return false; } if (expected.MatchExitStatus && @@ -96,7 +68,7 @@ bool operator==(const cmUVProcessChain::Status* actual, expected.Status.TermSignal != actual->TermSignal) { return false; } - if (expected.Finished && + if (expected.Status.Finished && std::make_pair(expected.ExceptionCode, expected.ExceptionString) != actual->GetException()) { return false; @@ -150,39 +122,96 @@ static void printResults( { std::cout << "Expected: " << std::endl; for (auto const& e : expected) { - if (e.Finished) { - std::cout << " ExitStatus: " - << printExpected(e.MatchExitStatus, e.Status.ExitStatus) - << ", TermSignal: " - << printExpected(e.MatchTermSignal, e.Status.TermSignal) - << ", ExceptionCode: " - << printExpected(e.Finished, - ExceptionCodeToString(e.ExceptionCode)) - << ", ExceptionString: \"" - << printExpected(e.Finished, e.ExceptionString) << '"' - << std::endl; - } else { - std::cout << " null" << std::endl; - } + std::cout << " SpawnResult: " << e.Status.SpawnResult + << ", Finished: " << e.Status.Finished << ", ExitStatus: " + << printExpected(e.MatchExitStatus, e.Status.ExitStatus) + << ", TermSignal: " + << printExpected(e.MatchTermSignal, e.Status.TermSignal) + << ", ExceptionCode: " + << printExpected(e.Status.Finished, + ExceptionCodeToString(e.ExceptionCode)) + << ", ExceptionString: \"" + << printExpected(e.Status.Finished, e.ExceptionString) << '"' + << std::endl; } std::cout << "Actual:" << std::endl; for (auto const& a : actual) { - if (a) { - auto exception = a->GetException(); - std::cout << " ExitStatus: " << a->ExitStatus - << ", TermSignal: " << a->TermSignal << ", ExceptionCode: " - << ExceptionCodeToString(exception.first) - << ", ExceptionString: \"" << exception.second << '"' - << std::endl; - } else { - std::cout << " null" << std::endl; - } + auto exception = a->GetException(); + std::cout << " SpawnResult: " << a->SpawnResult + << ", Finished: " << a->Finished + << ", ExitStatus: " << a->ExitStatus + << ", TermSignal: " << a->TermSignal + << ", ExceptionCode: " << ExceptionCodeToString(exception.first) + << ", ExceptionString: \"" << exception.second << '"' + << std::endl; } } static bool checkExecution(cmUVProcessChainBuilder& builder, std::unique_ptr<cmUVProcessChain>& chain) { + static const std::vector<ExpectedStatus> status1 = { + { false, + false, + { 0, false, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + { false, + false, + { 0, false, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + { false, + false, + { 0, false, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + }; + + static const std::vector<ExpectedStatus> status2 = { + { true, + true, + { 0, true, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + { false, + false, + { 0, false, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + { false, + false, + { 0, false, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + }; + + static const std::vector<ExpectedStatus> status3 = { + { true, + true, + { 0, true, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + { true, + true, + { 0, true, 1, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, +#ifdef _WIN32 + { true, + true, + { 0, true, STATUS_ACCESS_VIOLATION, 0 }, + cmUVProcessChain::ExceptionCode::Fault, + "Access violation" }, +#else + { false, + true, + { 0, true, 0, SIGABRT }, + cmUVProcessChain::ExceptionCode::Other, + "Subprocess aborted" }, +#endif + }; + std::vector<const cmUVProcessChain::Status*> status; chain = cm::make_unique<cmUVProcessChain>(builder.Start()); @@ -201,7 +230,7 @@ static bool checkExecution(cmUVProcessChainBuilder& builder, return false; } - if (chain->Wait(6000)) { + if (chain->Wait(9000)) { std::cout << "Wait() returned true, should be false" << std::endl; return false; } @@ -273,16 +302,19 @@ bool testUVProcessChainBuiltin(const char* helperCommand) return false; } - if (!chain->OutputStream()) { - std::cout << "OutputStream() was null, expecting not null" << std::endl; + if (chain->OutputStream() < 0) { + std::cout << "OutputStream() was invalid, expecting valid" << std::endl; return false; } - if (!chain->ErrorStream()) { - std::cout << "ErrorStream() was null, expecting not null" << std::endl; + if (chain->ErrorStream() < 0) { + std::cout << "ErrorStream() was invalid, expecting valid" << std::endl; return false; } - if (!checkOutput(*chain->OutputStream(), *chain->ErrorStream())) { + cmUVPipeIStream output(chain->GetLoop(), chain->OutputStream()); + cmUVPipeIStream error(chain->GetLoop(), chain->ErrorStream()); + + if (!checkOutput(output, error)) { return false; } @@ -302,12 +334,12 @@ bool testUVProcessChainBuiltinMerged(const char* helperCommand) return false; } - if (!chain->OutputStream()) { - std::cout << "OutputStream() was null, expecting not null" << std::endl; + if (chain->OutputStream() < 0) { + std::cout << "OutputStream() was invalid, expecting valid" << std::endl; return false; } - if (!chain->ErrorStream()) { - std::cout << "ErrorStream() was null, expecting not null" << std::endl; + if (chain->ErrorStream() < 0) { + std::cout << "ErrorStream() was invalid, expecting valid" << std::endl; return false; } if (chain->OutputStream() != chain->ErrorStream()) { @@ -316,7 +348,9 @@ bool testUVProcessChainBuiltinMerged(const char* helperCommand) return false; } - std::string merged = getInput(*chain->OutputStream()); + cmUVPipeIStream mergedStream(chain->GetLoop(), chain->OutputStream()); + + std::string merged = getInput(mergedStream); auto qemuErrorPos = merged.find("qemu:"); if (qemuErrorPos != std::string::npos) { merged.resize(qemuErrorPos); @@ -370,12 +404,12 @@ bool testUVProcessChainExternal(const char* helperCommand) return false; } - if (chain->OutputStream()) { - std::cout << "OutputStream() was not null, expecting null" << std::endl; + if (chain->OutputStream() >= 0) { + std::cout << "OutputStream() was valid, expecting invalid" << std::endl; return false; } - if (chain->ErrorStream()) { - std::cout << "ErrorStream() was not null, expecting null" << std::endl; + if (chain->ErrorStream() >= 0) { + std::cout << "ErrorStream() was valid, expecting invalid" << std::endl; return false; } @@ -418,12 +452,12 @@ bool testUVProcessChainNone(const char* helperCommand) return false; } - if (chain->OutputStream()) { - std::cout << "OutputStream() was not null, expecting null" << std::endl; + if (chain->OutputStream() >= 0) { + std::cout << "OutputStream() was valid, expecting invalid" << std::endl; return false; } - if (chain->ErrorStream()) { - std::cout << "ErrorStream() was not null, expecting null" << std::endl; + if (chain->ErrorStream() >= 0) { + std::cout << "ErrorStream() was valid, expecting invalid" << std::endl; return false; } @@ -445,7 +479,8 @@ bool testUVProcessChainCwdUnchanged(const char* helperCommand) return false; } - auto cwd = getInput(*chain.OutputStream()); + cmUVPipeIStream output(chain.GetLoop(), chain.OutputStream()); + auto cwd = getInput(output); if (!cmHasLiteralSuffix(cwd, "/Tests/CMakeLib")) { std::cout << "Working directory was \"" << cwd << "\", expected to end in \"/Tests/CMakeLib\"" << std::endl; @@ -471,7 +506,8 @@ bool testUVProcessChainCwdChanged(const char* helperCommand) return false; } - auto cwd = getInput(*chain.OutputStream()); + cmUVPipeIStream output(chain.GetLoop(), chain.OutputStream()); + auto cwd = getInput(output); if (!cmHasLiteralSuffix(cwd, "/Tests")) { std::cout << "Working directory was \"" << cwd << "\", expected to end in \"/Tests\"" << std::endl; @@ -481,6 +517,141 @@ bool testUVProcessChainCwdChanged(const char* helperCommand) return true; } +bool testUVProcessChainSpawnFail(const char* helperCommand) +{ + static const std::vector<ExpectedStatus> status1 = { + { false, + false, + { 0, false, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, + { false, + false, + { UV_ENOENT, true, 0, 0 }, + cmUVProcessChain::ExceptionCode::Spawn, + uv_strerror(UV_ENOENT) }, +#ifdef _WIN32 + { true, + true, + { 0, true, STATUS_ACCESS_VIOLATION, 0 }, + cmUVProcessChain::ExceptionCode::Fault, + "Access violation" }, +#else + { false, + true, + { 0, true, 0, SIGABRT }, + cmUVProcessChain::ExceptionCode::Other, + "Subprocess aborted" }, +#endif + }; + + static const std::vector<ExpectedStatus> status2 = { +#ifdef _WIN32 + { true, + true, + { 0, true, 0, 0 }, + cmUVProcessChain::ExceptionCode::None, + "" }, +#else + { false, + true, + { 0, true, 0, SIGPIPE }, + cmUVProcessChain::ExceptionCode::Other, + "SIGPIPE" }, +#endif + { false, + false, + { UV_ENOENT, true, 0, 0 }, + cmUVProcessChain::ExceptionCode::Spawn, + uv_strerror(UV_ENOENT) }, +#ifdef _WIN32 + { true, + true, + { 0, true, STATUS_ACCESS_VIOLATION, 0 }, + cmUVProcessChain::ExceptionCode::Fault, + "Access violation" }, +#else + { false, + true, + { 0, true, 0, SIGABRT }, + cmUVProcessChain::ExceptionCode::Other, + "Subprocess aborted" }, +#endif + }; + + std::vector<const cmUVProcessChain::Status*> status; + + cmUVProcessChainBuilder builder; + builder.AddCommand({ helperCommand, "echo" }) + .AddCommand({ "this_command_is_for_cmake_and_should_never_exist" }) + .AddCommand({ helperCommand, "dedup" }) + .SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT) + .SetBuiltinStream(cmUVProcessChainBuilder::Stream_ERROR); + + auto chain = builder.Start(); + if (!chain.Valid()) { + std::cout << "Valid() returned false, should be true" << std::endl; + return false; + } + + // Some platforms, like Solaris 10, take a long time to report a trapped + // subprocess to the parent process (about 1.7 seconds in the case of + // Solaris 10.) Wait 3 seconds to give it enough time. + if (chain.Wait(3000)) { + std::cout << "Wait() did not time out" << std::endl; + return false; + } + + status = chain.GetStatus(); + if (!resultsMatch(status, status1)) { + std::cout << "GetStatus() did not produce expected output" << std::endl; + printResults(status, status1); + return false; + } + + if (!chain.Wait()) { + std::cout << "Wait() timed out" << std::endl; + return false; + } + + status = chain.GetStatus(); + if (!resultsMatch(status, status2)) { + std::cout << "GetStatus() did not produce expected output" << std::endl; + printResults(status, status2); + return false; + } + + return true; +} + +bool testUVProcessChainInputFile(const char* helperCommand) +{ + std::unique_ptr<FILE, int (*)(FILE*)> f( + fopen("testUVProcessChainInput.txt", "rb"), fclose); + + cmUVProcessChainBuilder builder; + builder.AddCommand({ helperCommand, "dedup" }) + .SetExternalStream(cmUVProcessChainBuilder::Stream_INPUT, fileno(f.get())) + .SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT); + + auto chain = builder.Start(); + + if (!chain.Wait()) { + std::cout << "Wait() timed out" << std::endl; + return false; + } + + cmUVPipeIStream stream(chain.GetLoop(), chain.OutputStream()); + std::string output = getInput(stream); + if (output != "HELO WRD!") { + std::cout << "Output was \"" << output << "\", expected \"HELO WRD!\"" + << std::endl; + return false; + } + + return true; +} + int testUVProcessChain(int argc, char** const argv) { if (argc < 2) { @@ -518,5 +689,15 @@ int testUVProcessChain(int argc, char** const argv) return -1; } + if (!testUVProcessChainSpawnFail(argv[1])) { + std::cout << "While executing testUVProcessChainSpawnFail().\n"; + return -1; + } + + if (!testUVProcessChainInputFile(argv[1])) { + std::cout << "While executing testUVProcessChainInputFile().\n"; + return -1; + } + return 0; } diff --git a/Tests/CMakeLib/testUVProcessChainHelper.cxx b/Tests/CMakeLib/testUVProcessChainHelper.cxx index 99743e7..fcc45b0 100644 --- a/Tests/CMakeLib/testUVProcessChainHelper.cxx +++ b/Tests/CMakeLib/testUVProcessChainHelper.cxx @@ -32,13 +32,13 @@ int main(int argc, char** argv) std::string command = argv[1]; if (command == "echo") { - std::this_thread::sleep_for(std::chrono::milliseconds(3000)); + std::this_thread::sleep_for(std::chrono::milliseconds(6000)); std::cout << "HELLO world!" << std::flush; std::cerr << "1" << std::flush; return 0; } if (command == "capitalize") { - std::this_thread::sleep_for(std::chrono::milliseconds(9000)); + std::this_thread::sleep_for(std::chrono::milliseconds(12000)); std::string input = getStdin(); for (auto& c : input) { c = static_cast<char>(std::toupper(c)); diff --git a/Tests/CMakeLib/testUVStreambuf.cxx b/Tests/CMakeLib/testUVStreambuf.cxx index f9ed6af..f3977d4 100644 --- a/Tests/CMakeLib/testUVStreambuf.cxx +++ b/Tests/CMakeLib/testUVStreambuf.cxx @@ -3,11 +3,14 @@ #include <string> #include <vector> +#include <cmext/algorithm> + #include <cm3p/uv.h> #include <stdint.h> #include "cmGetPipes.h" #include "cmUVHandlePtr.h" +#include "cmUVStream.h" #include "cmUVStreambuf.h" #define TEST_STR_LINE_1 "This string must be exactly 128 characters long so" @@ -437,6 +440,90 @@ end: return success; } +bool testUVPipeIStream() +{ + int pipe[] = { -1, -1 }; + if (cmGetPipes(pipe) < 0) { + std::cout << "cmGetPipes() returned an error" << std::endl; + return false; + } + + cm::uv_loop_ptr loop; + loop.init(); + cm::uv_pipe_ptr pipeSink; + pipeSink.init(*loop, 0); + uv_pipe_open(pipeSink, pipe[1]); + + std::string str = "Hello world!\n"; + uv_write_t writeReq; + uv_buf_t buf; + buf.base = &str.front(); + buf.len = str.length(); + uv_write(&writeReq, pipeSink, &buf, 1, nullptr); + uv_run(loop, UV_RUN_DEFAULT); + + cmUVPipeIStream pin(*loop, pipe[0]); + std::string line; + std::getline(pin, line); + if (line != "Hello world!") { + std::cout << "Line was \"" << line << "\", should be \"Hello world!\"" + << std::endl; + return false; + } + + return true; +} + +bool testUVStreamRead() +{ + int pipe[] = { -1, -1 }; + if (cmGetPipes(pipe) < 0) { + std::cout << "cmGetPipes() returned an error" << std::endl; + return false; + } + + cm::uv_loop_ptr loop; + loop.init(); + cm::uv_pipe_ptr pipeSink; + pipeSink.init(*loop, 0); + uv_pipe_open(pipeSink, pipe[1]); + + std::string str = "Hello world!"; + uv_write_t writeReq; + uv_buf_t buf; + buf.base = &str.front(); + buf.len = str.length(); + uv_write(&writeReq, pipeSink, &buf, 1, nullptr); + uv_run(loop, UV_RUN_DEFAULT); + pipeSink.reset(); + + cm::uv_pipe_ptr pipeSource; + pipeSource.init(*loop, 0); + uv_pipe_open(pipeSource, pipe[0]); + + std::string output; + bool finished = false; + cmUVStreamRead( + pipeSource, + [&output](std::vector<char> data) { cm::append(output, data); }, + [&output, &finished]() { + if (output != "Hello world!") { + std::cout << "Output was \"" << output + << "\", should be \"Hello world!\"" << std::endl; + return; + } + finished = true; + }); + uv_run(loop, UV_RUN_DEFAULT); + + if (!finished) { + std::cout << "finished was not set" << std::endl; + return false; + } + + return true; +} + int testUVStreambuf(int argc, char** const argv) { if (argc < 2) { @@ -454,5 +541,15 @@ int testUVStreambuf(int argc, char** const argv) return -1; } + if (!testUVPipeIStream()) { + std::cout << "While executing testUVPipeIStream().\n"; + return -1; + } + + if (!testUVStreamRead()) { + std::cout << "While executing testUVPipeIStream().\n"; + return -1; + } + return 0; } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 53bb1e6..8e6017e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -42,8 +42,6 @@ endif() # Suppress generator deprecation warnings in test suite. if(CMAKE_GENERATOR MATCHES "^Visual Studio 9 2008") set(TEST_WARN_VS_CODE "set(ENV{CMAKE_WARN_VS9} OFF)") -elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 11 2012") - set(TEST_WARN_VS_CODE "set(ENV{CMAKE_WARN_VS11} OFF)") else() set(TEST_WARN_VS_CODE "") endif() @@ -1540,10 +1538,38 @@ if(BUILD_TESTING) add_subdirectory(GoogleTest) endif() - if(CMake_TEST_FindPython OR CMake_TEST_FindPython_SABIModule OR CMake_TEST_FindPython_NumPy - OR CMake_TEST_FindPython_Conda OR CMake_TEST_FindPython_IronPython OR CMake_TEST_FindPython_PyPy) - if (CMake_TEST_FindPython AND CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin") - set(CMake_TEST_FindPython_SABIModule TRUE) + if(CMake_TEST_FindPython) + set(CMake_TEST_FindPython2 TRUE) + set(CMake_TEST_FindPython3 TRUE) + endif() + if(CMake_TEST_FindPython_SABIMOdule) + set(CMake_TEST_FindPython2_SABIModule TRUE) + set(CMake_TEST_FindPython3_SABIModule TRUE) + endif() + if(CMake_TEST_FindPython_NumPy) + set(CMake_TEST_FindPython2_NumPyy TRUE) + set(CMake_TEST_FindPython3_NumPy TRUE) + endif() + if(CMake_TEST_FindPython_Conda) + set(CMake_TEST_FindPython3_Conda TRUE) + endif() + if(CMake_TEST_FindPython_IronPython) + set(CMake_TEST_FindPython2_IronPython TRUE) + endif() + if(CMake_TEST_FindPython_PyPy) + set(CMake_TEST_FindPython2_PyPy TRUE) + set(CMake_TEST_FindPython3_PyPy TRUE) + endif() + if(CMake_TEST_FindPython2 OR CMake_TEST_FindPython2 + OR CMake_TEST_FindPython2_SABIModule OR CMake_TEST_FindPython3_SABIModule + OR CMake_TEST_FindPython2_NumPy OR CMake_TEST_FindPython3_NumPy + OR CMake_TEST_FindPython3_Conda OR CMake_TEST_FindPython2_IronPython + OR CMake_TEST_FindPython2_PyPy OR CMake_TEST_FindPython3_PyPy) + if (CMake_TEST_FindPython2 AND CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin") + set(CMake_TEST_FindPython2_SABIModule TRUE) + endif() + if (CMake_TEST_FindPython3 AND CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin") + set(CMake_TEST_FindPython3_SABIModule TRUE) endif() add_subdirectory(FindPython) endif() @@ -2279,11 +2305,6 @@ if(BUILD_TESTING) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSWinStorePhone/${name}") endmacro() - if(vs11 AND ws80) - add_test_VSWinStorePhone(vs11-store80-X86 "Visual Studio 11 2012" WindowsStore 8.0 Win32) - add_test_VSWinStorePhone(vs11-store80-ARM "Visual Studio 11 2012" WindowsStore 8.0 ARM) - add_test_VSWinStorePhone(vs11-store80-X64 "Visual Studio 11 2012" WindowsStore 8.0 x64) - endif() if(vs12 AND ws81) add_test_VSWinStorePhone(vs12-store81-X86 "Visual Studio 12 2013" WindowsStore 8.1 Win32) add_test_VSWinStorePhone(vs12-store81-ARM "Visual Studio 12 2013" WindowsStore 8.1 ARM) @@ -2311,10 +2332,6 @@ if(BUILD_TESTING) add_test_VSWinStorePhone(vs14-store10_0-ARM "Visual Studio 14 2015" WindowsStore 10.0 ARM) add_test_VSWinStorePhone(vs14-store10_0-X64 "Visual Studio 14 2015" WindowsStore 10.0 x64) endif() - if(vs11 AND wp80) - add_test_VSWinStorePhone(vs11-phone80-X86 "Visual Studio 11 2012" WindowsPhone 8.0 Win32) - add_test_VSWinStorePhone(vs11-phone80-ARM "Visual Studio 11 2012" WindowsPhone 8.0 ARM) - endif() if(vs12 AND wp81) add_test_VSWinStorePhone(vs12-phone81-X86 "Visual Studio 12 2013" WindowsPhone 8.1 Win32) add_test_VSWinStorePhone(vs12-phone81-ARM "Visual Studio 12 2013" WindowsPhone 8.1 ARM) @@ -2341,10 +2358,6 @@ if(BUILD_TESTING) endforeach() endmacro() - if(vs11) - add_test_VSWinCE(vs11-ce80-ARM "Visual Studio 11 2012" WindowsCE 8.0 ${wince_sdk}) - endif() - if(vs12) add_test_VSWinCE(vs12-ce80-ARM "Visual Studio 12 2013" WindowsCE 8.0 ${wince_sdk}) endif() @@ -2471,9 +2484,6 @@ if(BUILD_TESTING) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSAndroid/${name}") endmacro() if(tegra AND NOT "${CMake_SOURCE_DIR};${CMake_BINARY_DIR}" MATCHES " ") - if(vs11) - add_test_VSAndroid(vs11 "Visual Studio 11 2012" "Tegra-Android") - endif() if(vs12) add_test_VSAndroid(vs12 "Visual Studio 12 2013" "Tegra-Android") endif() diff --git a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt index 99823a6..18f8fda 100644 --- a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt +++ b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5) project(TestArtifactsInteractive LANGUAGES C) set (components Interpreter Development) -if (CMake_TEST_FindPython_NumPy) +if (CMake_TEST_FindPython3_NumPy) list (APPEND components NumPy) endif() @@ -12,13 +12,13 @@ find_package(Python3 REQUIRED COMPONENTS ${components}) if (Python3_ARTIFACTS_INTERACTIVE) if (NOT DEFINED CACHE{Python3_EXECUTABLE} OR NOT DEFINED CACHE{Python3_LIBRARY} OR NOT DEFINED CACHE{Python3_INCLUDE_DIR} - OR (CMake_TEST_FindPython_NumPy AND NOT DEFINED CACHE{Python3_NumPy_INCLUDE_DIR})) + OR (CMake_TEST_FindPython3_NumPy AND NOT DEFINED CACHE{Python3_NumPy_INCLUDE_DIR})) message (FATAL_ERROR "Python3_ARTIFACTS_INTERACTIVE=ON Failed.") endif() else() if (DEFINED CACHE{Python3_EXECUTABLE} OR DEFINED CACHE{Python3_LIBRARY} OR DEFINED CACHE{Python3_INCLUDE_DIR} - OR (CMake_TEST_FindPython_NumPy AND DEFINED CACHE{Python3_NumPy_INCLUDE_DIR})) + OR (CMake_TEST_FindPython3_NumPy AND DEFINED CACHE{Python3_NumPy_INCLUDE_DIR})) message (FATAL_ERROR "Python3_ARTIFACTS_INTERACTIVE=OFF Failed.") endif() endif() diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index b6942c9..3e1993e 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -1,4 +1,4 @@ -if(CMake_TEST_FindPython) +if(CMake_TEST_FindPython2) add_test(NAME FindPython.Python2.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -44,6 +44,129 @@ if(CMake_TEST_FindPython) set_tests_properties(FindPython.Python2Fail PROPERTIES PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: foobar\\)") + add_test(NAME FindPython.Python.V2.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.LOCATION" + ${build_generator_args} + --build-project TestPython + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.Python.V2.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VERSION" + ${build_generator_args} + --build-project TestPython + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + + add_test(NAME FindPython.Python2.ExactVersion.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.LOCATION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_MAJOR_VERSION=2 + -DPython_REQUESTED_VERSION=2.1.2 + -DPython2_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.Python2.ExactVersion.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.VERSION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_MAJOR_VERSION=2 + -DPython_REQUESTED_VERSION=2.1.2 + -DPython2_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + + add_test(NAME FindPython.Python.V2.ExactVersion.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.LOCATION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2 + -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.Python.V2.ExactVersion.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.VERSION" + ${build_generator_args} + --build-project TestExactVersion + --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2 + -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + + add_test(NAME FindPython.Python2.VersionRange.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2.VersionRange.LOCATION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2 + -DPython2_FIND_STRATEGY=LOCATION + ) + add_test(NAME FindPython.Python2.VersionRange.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2.VersionRange.VERSION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2 + -DPython2_FIND_STRATEGY=VERSION + ) + add_test(NAME FindPython.Python.V2.VersionRange.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VersionRange.LOCATION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=2 + -DPython_FIND_STRATEGY=LOCATION + ) + add_test(NAME FindPython.Python.V2.VersionRange.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VersionRange.VERSION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=2 + -DPython_FIND_STRATEGY=VERSION + ) + + add_test(NAME FindPython.Python2Embedded COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python2Embedded" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2Embedded" + ${build_generator_args} + --build-project TestPython2Embedded + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +endif() + +if(CMake_TEST_FindPython3) add_test(NAME FindPython.Python3.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -89,46 +212,6 @@ if(CMake_TEST_FindPython) set_tests_properties(FindPython.Python3Fail PROPERTIES PASS_REGULAR_EXPRESSION "Could NOT find Python3 \\(missing: foobar\\)") - add_test(NAME FindPython.Python.LOCATION COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/Python" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.LOCATION" - ${build_generator_args} - --build-project TestPython - --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> - ) - add_test(NAME FindPython.Python.VERSION COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/Python" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.VERSION" - ${build_generator_args} - --build-project TestPython - --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> - ) - add_test(NAME FindPython.Python.V2.LOCATION COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/Python" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.LOCATION" - ${build_generator_args} - --build-project TestPython - --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> - ) - add_test(NAME FindPython.Python.V2.VERSION COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/Python" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VERSION" - ${build_generator_args} - --build-project TestPython - --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> - ) add_test(NAME FindPython.Python.V3.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -150,30 +233,6 @@ if(CMake_TEST_FindPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) - add_test(NAME FindPython.Python2.ExactVersion.LOCATION COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" - "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.LOCATION" - ${build_generator_args} - --build-project TestExactVersion - --build-options ${build_options} -DPython_MAJOR_VERSION=2 - -DPython_REQUESTED_VERSION=2.1.2 - -DPython2_FIND_STRATEGY=LOCATION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> - ) - add_test(NAME FindPython.Python2.ExactVersion.VERSION COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" - "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.VERSION" - ${build_generator_args} - --build-project TestExactVersion - --build-options ${build_options} -DPython_MAJOR_VERSION=2 - -DPython_REQUESTED_VERSION=2.1.2 - -DPython2_FIND_STRATEGY=VERSION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> - ) add_test(NAME FindPython.Python3.ExactVersion.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -198,28 +257,6 @@ if(CMake_TEST_FindPython) -DPython3_FIND_STRATEGY=VERSION --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) - add_test(NAME FindPython.Python.V2.ExactVersion.LOCATION COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.LOCATION" - ${build_generator_args} - --build-project TestExactVersion - --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2 - -DPython_FIND_STRATEGY=LOCATION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> - ) - add_test(NAME FindPython.Python.V2.ExactVersion.VERSION COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.VERSION" - ${build_generator_args} - --build-project TestExactVersion - --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2 - -DPython_FIND_STRATEGY=VERSION - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> - ) add_test(NAME FindPython.Python.V3.ExactVersion.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -263,46 +300,6 @@ if(CMake_TEST_FindPython) --build-options ${build_options} -DPython=Python3 -DPython_REQUESTED_VERSION=3 -DPython3_FIND_STRATEGY=VERSION ) - add_test(NAME FindPython.Python2.VersionRange.LOCATION COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" - "${CMake_BINARY_DIR}/Tests/FindPython/Python2.VersionRange.LOCATION" - ${build_generator_args} - --build-project TestVersionRange - --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2 - -DPython2_FIND_STRATEGY=LOCATION - ) - add_test(NAME FindPython.Python2.VersionRange.VERSION COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" - "${CMake_BINARY_DIR}/Tests/FindPython/Python2.VersionRange.VERSION" - ${build_generator_args} - --build-project TestVersionRange - --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2 - -DPython2_FIND_STRATEGY=VERSION - ) - add_test(NAME FindPython.Python.V2.VersionRange.LOCATION COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VersionRange.LOCATION" - ${build_generator_args} - --build-project TestVersionRange - --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=2 - -DPython_FIND_STRATEGY=LOCATION - ) - add_test(NAME FindPython.Python.V2.VersionRange.VERSION COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" - "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VersionRange.VERSION" - ${build_generator_args} - --build-project TestVersionRange - --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=2 - -DPython_FIND_STRATEGY=VERSION - ) add_test(NAME FindPython.Python.V3.VersionRange.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -324,17 +321,6 @@ if(CMake_TEST_FindPython) -DPython_FIND_STRATEGY=VERSION ) - add_test(NAME FindPython.MultiplePackages COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/MultiplePackages" - "${CMake_BINARY_DIR}/Tests/FindPython/MultiplePackages" - ${build_generator_args} - --build-project TestMultiplePackages - --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> - ) - add_test(NAME FindPython.VirtualEnv COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -346,16 +332,6 @@ if(CMake_TEST_FindPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) - add_test(NAME FindPython.Python2Embedded COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/Python2Embedded" - "${CMake_BINARY_DIR}/Tests/FindPython/Python2Embedded" - ${build_generator_args} - --build-project TestPython2Embedded - --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> - ) add_test(NAME FindPython.Python3Embedded COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -377,7 +353,7 @@ if(CMake_TEST_FindPython) --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}" "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}" "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}" - "-DCMake_TEST_FindPython_SABIModule=${CMake_TEST_FindPython_SABIModule}" + "-DCMake_TEST_FindPython3_SABIModule=${CMake_TEST_FindPython3_SABIModule}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) @@ -391,7 +367,7 @@ if(CMake_TEST_FindPython) --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}" "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}" "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}" - "-DCMake_TEST_FindPython_NumPy=${CMake_TEST_FindPython_NumPy}" + "-DCMake_TEST_FindPython3_NumPy=${CMake_TEST_FindPython3_NumPy}" "-DPython3_ARTIFACTS_INTERACTIVE=ON" --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) @@ -405,7 +381,7 @@ if(CMake_TEST_FindPython) --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}" "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}" "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}" - "-DCMake_TEST_FindPython_NumPy=${CMake_TEST_FindPython_NumPy}" + "-DCMake_TEST_FindPython3_NumPy=${CMake_TEST_FindPython3_NumPy}" "-DPython3_ARTIFACTS_INTERACTIVE=OFF" --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) @@ -420,7 +396,7 @@ if(CMake_TEST_FindPython) --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}" "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}" "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}" - "-DCMake_TEST_FindPython_NumPy=${CMake_TEST_FindPython_NumPy}" + "-DCMake_TEST_FindPython3_NumPy=${CMake_TEST_FindPython3_NumPy}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) @@ -437,6 +413,41 @@ if(CMake_TEST_FindPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + add_test(NAME FindPython.UnversionedNames COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/UnversionedNames" + "${CMake_BINARY_DIR}/Tests/FindPython/UnversionedNames" + ${build_generator_args} + --build-project UnversionedNames + --build-options ${build_options} + ) + endif() +endif() + +if(CMake_TEST_FindPython2 OR CMake_TEST_FindPython3) + add_test(NAME FindPython.Python.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.LOCATION" + ${build_generator_args} + --build-project TestPython + --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.Python.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.VERSION" + ${build_generator_args} + --build-project TestPython + --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + if (CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin") add_test(NAME FindPython.Interpreter.SOABI COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> @@ -466,20 +477,20 @@ if(CMake_TEST_FindPython) ) endif() - if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - add_test(NAME FindPython.UnversionedNames COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/UnversionedNames" - "${CMake_BINARY_DIR}/Tests/FindPython/UnversionedNames" - ${build_generator_args} - --build-project UnversionedNames - --build-options ${build_options} + add_test(NAME FindPython.MultiplePackages COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/MultiplePackages" + "${CMake_BINARY_DIR}/Tests/FindPython/MultiplePackages" + ${build_generator_args} + --build-project TestMultiplePackages + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) - endif() endif() -if(CMake_TEST_FindPython_SABIModule) + +if(CMake_TEST_FindPython2_SABIModule) add_test(NAME FindPython.Python2.Development.SABIModule COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -492,7 +503,9 @@ if(CMake_TEST_FindPython_SABIModule) ) set_tests_properties(FindPython.Python2.Development.SABIModule PROPERTIES PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: .*Development\\.SABIModule") +endif() +if(CMake_TEST_FindPython3_SABIModule) # Use exclusively Release configuration because Debug is, on Windows with MSVC, # unusable with SABI: Python force link with debug version of full versioned library rather than # the stable ABI one. @@ -508,7 +521,7 @@ if(CMake_TEST_FindPython_SABIModule) ) endif() -if(CMake_TEST_FindPython_NumPy) +if(CMake_TEST_FindPython2_NumPy OR CMake_TEST_FindPython3_NumPy) add_test(NAME FindPython.NumPy COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -530,7 +543,7 @@ if(CMake_TEST_FindPython_NumPy) ) endif() -if(CMake_TEST_FindPython_Conda) +if(CMake_TEST_FindPython3_Conda) add_test(NAME FindPython.VirtualEnvConda COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -543,7 +556,7 @@ if(CMake_TEST_FindPython_Conda) ) endif() -if (CMake_TEST_FindPython AND CMake_TEST_FindPython_IronPython) +if (CMake_TEST_FindPython2 AND CMake_TEST_FindPython2_IronPython) add_test(NAME FindPython.Implementation.CPython COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -566,7 +579,7 @@ if (CMake_TEST_FindPython AND CMake_TEST_FindPython_IronPython) ) endif() -if(CMake_TEST_FindPython_IronPython) +if(CMake_TEST_FindPython2_IronPython) add_test(NAME FindPython.IronPython2.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -653,7 +666,7 @@ if(CMake_TEST_FindPython_IronPython) ) endif() -if(CMake_TEST_FindPython_PyPy) +if(CMake_TEST_FindPython2_PyPy) add_test(NAME FindPython.PyPy2.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -675,85 +688,91 @@ if(CMake_TEST_FindPython_PyPy) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) - add_test(NAME FindPython.PyPy3.LOCATION COMMAND + add_test(NAME FindPython.PyPy.V2.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.LOCATION" + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.LOCATION" ${build_generator_args} - --build-project TestPyPy3 - --build-options ${build_options} -DPython3_FIND_STRATEGY=LOCATION + --build-project TestPyPy + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) - add_test(NAME FindPython.PyPy3.VERSION COMMAND + add_test(NAME FindPython.PyPy.V2.VERSION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.VERSION" + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.VERSION" ${build_generator_args} - --build-project TestPyPy3 - --build-options ${build_options} -DPython3_FIND_STRATEGY=VERSION + --build-project TestPyPy + --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) +endif() - add_test(NAME FindPython.PyPy.LOCATION COMMAND +if(CMake_TEST_FindPython3_PyPy) + add_test(NAME FindPython.PyPy3.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.LOCATION" + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.LOCATION" ${build_generator_args} - --build-project TestPyPy - --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION + --build-project TestPyPy3 + --build-options ${build_options} -DPython3_FIND_STRATEGY=LOCATION --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) - add_test(NAME FindPython.PyPy.VERSION COMMAND + add_test(NAME FindPython.PyPy3.VERSION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test - "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.VERSION" + "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.VERSION" ${build_generator_args} - --build-project TestPyPy - --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION + --build-project TestPyPy3 + --build-options ${build_options} -DPython3_FIND_STRATEGY=VERSION --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) - add_test(NAME FindPython.PyPy.V2.LOCATION COMMAND + + add_test(NAME FindPython.PyPy.V3.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.LOCATION" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.LOCATION" ${build_generator_args} --build-project TestPyPy - --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION + --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=LOCATION --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) - add_test(NAME FindPython.PyPy.V2.VERSION COMMAND + add_test(NAME FindPython.PyPy.V3.VERSION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.VERSION" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.VERSION" ${build_generator_args} --build-project TestPyPy - --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION + --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=VERSION --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) - add_test(NAME FindPython.PyPy.V3.LOCATION COMMAND +endif() + +if(CMake_TEST_FindPython2_PyPy OR CMake_TEST_FindPython3_PyPy) + add_test(NAME FindPython.PyPy.LOCATION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.LOCATION" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.LOCATION" ${build_generator_args} --build-project TestPyPy - --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=LOCATION + --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) - add_test(NAME FindPython.PyPy.V3.VERSION COMMAND + add_test(NAME FindPython.PyPy.VERSION COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy" - "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.VERSION" + "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.VERSION" ${build_generator_args} --build-project TestPyPy - --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=VERSION + --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) endif() diff --git a/Tests/FindPython/CustomFailureMessage/CMakeLists.txt b/Tests/FindPython/CustomFailureMessage/CMakeLists.txt index 283aeec..e0148f3 100644 --- a/Tests/FindPython/CustomFailureMessage/CMakeLists.txt +++ b/Tests/FindPython/CustomFailureMessage/CMakeLists.txt @@ -62,7 +62,7 @@ set_tests_properties(FindPython.CustomFailureMessage.Multiple PROPERTIES PASS_REGULAR_EXPRESSION "Reason given by package:.+Interpreter: Cannot run the interpreter.+Development: Cannot find the library") -if (CMake_TEST_FindPython_NumPy) +if (CMake_TEST_FindPython3_NumPy) add_test(NAME FindPython.CustomFailureMessage.NumPy COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test diff --git a/Tests/FindPython/MultiplePackages/CMakeLists.txt b/Tests/FindPython/MultiplePackages/CMakeLists.txt index 4845035..352a2f6f 100644 --- a/Tests/FindPython/MultiplePackages/CMakeLists.txt +++ b/Tests/FindPython/MultiplePackages/CMakeLists.txt @@ -2,32 +2,44 @@ cmake_minimum_required(VERSION 3.5) project(TestMultiplePackages C) -find_package (Python2 REQUIRED COMPONENTS Interpreter Development) -find_package (Python3 REQUIRED COMPONENTS Interpreter Development) - -# Must find Python 3 find_package (Python REQUIRED) -if (NOT Python3_EXECUTABLE STREQUAL Python_EXECUTABLE) - message (FATAL_ERROR - "Python interpreters do not match:\n" - " Python_EXECUTABLE='${Python_EXECUTABLE}'\n" - " Python3_EXECUTABLE='${Python3_EXECUTABLE}'\n" +if (CMake_TEST_FindPython2) + find_package (Python2 REQUIRED COMPONENTS Interpreter Development) + + if (NOT CMake_TEST_FindPython3 AND NOT Python2_EXECUTABLE STREQUAL Python_EXECUTABLE) + message (FATAL_ERROR + "Python interpreters do not match:\n" + " Python_EXECUTABLE='${Python_EXECUTABLE}'\n" + " Python2_EXECUTABLE='${Python3_EXECUTABLE}'\n" ) -endif() + endif() + + Python2_add_library (spam2 MODULE ../spam.c) + target_compile_definitions (spam2 PRIVATE PYTHON2) + add_test (NAME python2_spam2 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>" + "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")") -Python2_add_library (spam2 MODULE ../spam.c) -target_compile_definitions (spam2 PRIVATE PYTHON2) +endif() + +if (CMake_TEST_FindPython3) + find_package (Python3 REQUIRED COMPONENTS Interpreter Development) -Python3_add_library (spam3 MODULE ../spam.c) -target_compile_definitions (spam3 PRIVATE PYTHON3) + if (NOT Python3_EXECUTABLE STREQUAL Python_EXECUTABLE) + message (FATAL_ERROR + "Python interpreters do not match:\n" + " Python_EXECUTABLE='${Python_EXECUTABLE}'\n" + " Python3_EXECUTABLE='${Python3_EXECUTABLE}'\n" + ) + endif() + Python3_add_library (spam3 MODULE ../spam.c) + target_compile_definitions (spam3 PRIVATE PYTHON3) -add_test (NAME python2_spam2 - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>" - "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")") + add_test (NAME python3_spam3 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>" + "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") -add_test (NAME python3_spam3 - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>" - "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") +endif() diff --git a/Tests/FindPython/NumPy/CMakeLists.txt b/Tests/FindPython/NumPy/CMakeLists.txt index 9920336..336bb83 100644 --- a/Tests/FindPython/NumPy/CMakeLists.txt +++ b/Tests/FindPython/NumPy/CMakeLists.txt @@ -2,21 +2,30 @@ cmake_minimum_required(VERSION 3.5) project(TestNumPy LANGUAGES C) -find_package (Python2 REQUIRED COMPONENTS Interpreter Development NumPy) -find_package (Python3 REQUIRED COMPONENTS Interpreter Development NumPy) +if(CMake_TEST_FindPython2_NumPy) -Python2_add_library (arraytest2 MODULE arraytest.c) -target_compile_definitions (arraytest2 PRIVATE PYTHON2) -target_link_libraries (arraytest2 PRIVATE Python2::NumPy) + find_package (Python2 REQUIRED COMPONENTS Interpreter Development NumPy) -Python3_add_library (arraytest3 MODULE arraytest.c) -target_compile_definitions (arraytest3 PRIVATE PYTHON3) -target_link_libraries (arraytest3 PRIVATE Python3::NumPy) + Python2_add_library (arraytest2 MODULE arraytest.c) + target_compile_definitions (arraytest2 PRIVATE PYTHON2) + target_link_libraries (arraytest2 PRIVATE Python2::NumPy) -add_test (NAME python2_arraytest - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:arraytest2>" - "${Python2_EXECUTABLE}" -c "import numpy; import arraytest2; arraytest2.vecsq(numpy.array([1, 2, 3]));") + add_test (NAME python2_arraytest + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:arraytest2>" + "${Python2_EXECUTABLE}" -c "import numpy; import arraytest2; arraytest2.vecsq(numpy.array([1, 2, 3]));") -add_test (NAME python3_arraytest - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:arraytest3>" - "${Python3_EXECUTABLE}" -c "import numpy; import arraytest3; arraytest3.vecsq(numpy.array([1, 2, 3]));") +endif() + +if(CMake_TEST_FindPython3_NumPy) + + find_package (Python3 REQUIRED COMPONENTS Interpreter Development NumPy) + + Python3_add_library (arraytest3 MODULE arraytest.c) + target_compile_definitions (arraytest3 PRIVATE PYTHON3) + target_link_libraries (arraytest3 PRIVATE Python3::NumPy) + + add_test (NAME python3_arraytest + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:arraytest3>" + "${Python3_EXECUTABLE}" -c "import numpy; import arraytest3; arraytest3.vecsq(numpy.array([1, 2, 3]));") + +endif() diff --git a/Tests/FindPython/NumPyOnly/CMakeLists.txt b/Tests/FindPython/NumPyOnly/CMakeLists.txt index 9aa1bcf..115cf2b 100644 --- a/Tests/FindPython/NumPyOnly/CMakeLists.txt +++ b/Tests/FindPython/NumPyOnly/CMakeLists.txt @@ -2,13 +2,23 @@ cmake_minimum_required(VERSION 3.5) project(TestNumPyOnly LANGUAGES C) -find_package(Python2 REQUIRED COMPONENTS NumPy) -find_package(Python3 REQUIRED COMPONENTS NumPy) +if(CMake_TEST_FindPython2_NumPy) + + find_package(Python2 REQUIRED COMPONENTS NumPy) + + Python2_add_library (arraytest2 MODULE ../NumPy/arraytest.c) + target_compile_definitions (arraytest2 PRIVATE PYTHON2) + target_link_libraries (arraytest2 PRIVATE Python2::NumPy) + +endif() -Python2_add_library (arraytest2 MODULE ../NumPy/arraytest.c) -target_compile_definitions (arraytest2 PRIVATE PYTHON2) -target_link_libraries (arraytest2 PRIVATE Python2::NumPy) + +if(CMake_TEST_FindPython3_NumPy) + +find_package(Python3 REQUIRED COMPONENTS NumPy) Python3_add_library (arraytest3 MODULE ../NumPy/arraytest.c) target_compile_definitions (arraytest3 PRIVATE PYTHON3) target_link_libraries (arraytest3 PRIVATE Python3::NumPy) + +endif() diff --git a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt index cb9d4d3..eec28a5 100644 --- a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt +++ b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt @@ -4,13 +4,20 @@ project(TestRequiredArtifacts LANGUAGES C) include(CTest) -find_package(Python2 REQUIRED COMPONENTS Interpreter Development) -if (NOT Python2_FOUND) - message (FATAL_ERROR "Failed to find Python 2") +if(CMake_TEST_FindPython2) + find_package(Python2 REQUIRED COMPONENTS Interpreter Development) + if (NOT Python2_FOUND) + message (FATAL_ERROR "Failed to find Python 2") + endif() + set(USER_LIBRARY "${Python2_LIBRARY_RELEASE}") + set(USER_INCLUDE_DIR "${Python2_INCLUDE_DIRS}") +else() + set(USER_LIBRARY "/path/to/invalid${CMAKE_C_LINK_LIBRARY_SUFFIX}") + set(USER_INCLUDE_DIR "/path/to/invalid/dir") endif() set(components Interpreter Development) -if (CMake_TEST_FindPython_SABIModule AND WIN32) +if (CMake_TEST_FindPython3_SABIModule AND WIN32) list (APPEND components Development.SABIModule) endif() find_package(Python3 REQUIRED COMPONENTS ${components}) @@ -61,7 +68,7 @@ add_test(NAME FindPython.RequiredArtifacts.Library.INVALID COMMAND ${build_generator_args} --build-project TestRequiredArtifacts.Check --build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_LIBRARY=ON - "-DPython3_LIBRARY=${Python2_LIBRARY_RELEASE}" + "-DPython3_LIBRARY=${USER_LIBRARY}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) @@ -84,7 +91,7 @@ add_test(NAME FindPython.RequiredArtifacts.Include.INVALID COMMAND ${build_generator_args} --build-project TestRequiredArtifacts.Check --build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_INCLUDE=ON - "-DPython3_INCLUDE_DIR=${Python2_INCLUDE_DIRS}" + "-DPython3_INCLUDE_DIR=${USER_INCLUDE_DIR}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) @@ -97,7 +104,7 @@ add_test(NAME FindPython.RequiredArtifacts.Interpreter-Library.INVALID COMMAND --build-project TestRequiredArtifacts.Check --build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_INTERPRETER=ON -DCHECK_LIBRARY=ON "-DPython3_EXECUTABLE=${Python3_EXECUTABLE}" - "-DPython3_LIBRARY=${Python2_LIBRARY_RELEASE}" + "-DPython3_LIBRARY=${USER_LIBRARY}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) @@ -110,11 +117,11 @@ add_test(NAME FindPython.RequiredArtifacts.Library-Include.INVALID COMMAND --build-project TestRequiredArtifacts.Check --build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_LIBRARY=ON -DCHECK_INCLUDE=ON "-DPython3_LIBRARY=${Python3_LIBRARY_RELEASE}" - "-DPython3_INCLUDE_DIR=${Python2_INCLUDE_DIRS}" + "-DPython3_INCLUDE_DIR=${USER_INCLUDE_DIR}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) -if (CMake_TEST_FindPython_SABIModule AND WIN32) +if (CMake_TEST_FindPython3_SABIModule AND WIN32) add_test(NAME FindPython.RequiredArtifacts.SABILibrary.VALID COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -134,7 +141,7 @@ if (CMake_TEST_FindPython_SABIModule AND WIN32) ${build_generator_args} --build-project TestRequiredArtifacts.Check --build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_SABI_LIBRARY=ON - "-DPython3_SABI_LIBRARY=${Python2_LIBRARY_RELEASE}" + "-DPython3_SABI_LIBRARY=${USER_LIBRARY}" --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) endif() diff --git a/Tests/FindPython/SOABI/CMakeLists.txt b/Tests/FindPython/SOABI/CMakeLists.txt index 60399d3..6c0e9a9 100644 --- a/Tests/FindPython/SOABI/CMakeLists.txt +++ b/Tests/FindPython/SOABI/CMakeLists.txt @@ -2,37 +2,40 @@ cmake_minimum_required(VERSION 3.5) project(TestSOABI LANGUAGES C) -find_package(Python3 COMPONENTS ${CMake_TEST_FindPython_COMPONENT}) -if (NOT Python3_FOUND) - message (FATAL_ERROR "Failed to find Python 3") -endif() +if(CMake_TEST_FindPython3) + find_package(Python3 COMPONENTS ${CMake_TEST_FindPython_COMPONENT}) + if (NOT Python3_FOUND) + message (FATAL_ERROR "Failed to find Python 3") + endif() -if(NOT DEFINED Python3_SOABI) - message(FATAL_ERROR "Python3_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found") -endif() + if(NOT DEFINED Python3_SOABI) + message(FATAL_ERROR "Python3_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found") + endif() -if (Python3_Development_FOUND AND Python3_SOABI) - Python3_add_library (spam3 MODULE WITH_SOABI ../spam.c) - target_compile_definitions (spam3 PRIVATE PYTHON3) + if (Python3_Development_FOUND AND Python3_SOABI) + Python3_add_library (spam3 MODULE WITH_SOABI ../spam.c) + target_compile_definitions (spam3 PRIVATE PYTHON3) - get_property (suffix TARGET spam3 PROPERTY SUFFIX) - if (NOT suffix MATCHES "^.${Python3_SOABI}") - message(FATAL_ERROR "Module suffix do not include Python3_SOABI") + get_property (suffix TARGET spam3 PROPERTY SUFFIX) + if (NOT suffix MATCHES "^.${Python3_SOABI}") + message(FATAL_ERROR "Module suffix do not include Python3_SOABI") + endif() endif() endif() +if(CMake_TEST_FindPython2) + find_package(Python2 COMPONENTS ${CMake_TEST_FindPython_COMPONENT}) + if(NOT DEFINED Python2_SOABI) + message(FATAL_ERROR "Python2_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found") + endif() -find_package(Python2 COMPONENTS ${CMake_TEST_FindPython_COMPONENT}) -if(NOT DEFINED Python2_SOABI) - message(FATAL_ERROR "Python2_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found") -endif() - -if (Python2_Development_FOUND AND Python2_SOABI) - Python2_add_library (spam2 MODULE WITH_SOABI ../spam.c) - target_compile_definitions (spam2 PRIVATE PYTHON2) + if (Python2_Development_FOUND AND Python2_SOABI) + Python2_add_library (spam2 MODULE WITH_SOABI ../spam.c) + target_compile_definitions (spam2 PRIVATE PYTHON2) - get_property (suffix TARGET spam2 PROPERTY SUFFIX) - if (NOT suffix MATCHES "^.${Python2_SOABI}") - message(FATAL_ERROR "Module suffix do not include Python2_SOABI") + get_property (suffix TARGET spam2 PROPERTY SUFFIX) + if (NOT suffix MATCHES "^.${Python2_SOABI}") + message(FATAL_ERROR "Module suffix do not include Python2_SOABI") + endif() endif() endif() diff --git a/Tests/FindPython/VirtualEnv/CMakeLists.txt b/Tests/FindPython/VirtualEnv/CMakeLists.txt index e2e5bd2..ea742ea 100644 --- a/Tests/FindPython/VirtualEnv/CMakeLists.txt +++ b/Tests/FindPython/VirtualEnv/CMakeLists.txt @@ -27,21 +27,23 @@ add_test(NAME FindPython3.VirtualEnvDefault "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvDefault.cmake") -add_test(NAME FindPython3.VirtualEnvOnly - COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME - --unset=CONDA_PREFIX - "VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" - "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" - -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") -add_test(NAME FindPython3.UnsetVirtualEnvOnly - COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME - --unset=VIRTUAL_ENV - --unset=CONDA_PREFIX - "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") - add_test(NAME FindPython3.VirtualEnvStandard COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME --unset=CONDA_PREFIX "VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvStandard.cmake") + +if(CMake_TEST_FindPython2) + add_test(NAME FindPython3.VirtualEnvOnly + COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME + --unset=CONDA_PREFIX + "VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" + "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" + -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") + add_test(NAME FindPython3.UnsetVirtualEnvOnly + COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME + --unset=VIRTUAL_ENV + --unset=CONDA_PREFIX + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") +endif() diff --git a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt index 2f7c0db..3a64c31 100644 --- a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt +++ b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt @@ -26,21 +26,23 @@ add_test(NAME FindPython3.VirtualEnvDefaultConda "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvDefault.cmake") -add_test(NAME FindPython3.VirtualEnvOnlyConda - COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME - --unset=VIRTUAL_ENV - "CONDA_PREFIX=${Python3_VIRTUAL_ENV}" - "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" - -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") -add_test(NAME FindPython3.UnsetVirtualEnvOnlyConda - COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME - --unset=CONDA_PREFIX - --unset=VIRTUAL_ENV - "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") - add_test(NAME FindPython3.VirtualEnvStandardConda COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME --unset=VIRTUAL_ENV "CONDA_PREFIX=${Python3_VIRTUAL_ENV}" "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvStandard.cmake") + +if(Cmake_TEST_FindPython2) + add_test(NAME FindPython3.VirtualEnvOnlyConda + COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME + --unset=VIRTUAL_ENV + "CONDA_PREFIX=${Python3_VIRTUAL_ENV}" + "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}" + -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") + add_test(NAME FindPython3.UnsetVirtualEnvOnlyConda + COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME + --unset=CONDA_PREFIX + --unset=VIRTUAL_ENV + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake") +endif() diff --git a/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt b/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt index 67d00f7..3472f33 100644 --- a/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt @@ -1,4 +1,13 @@ -^CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): +^CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\): + The OLD behavior for policy CMP0115 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. ++ +CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\): Cannot find source file: noexist diff --git a/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt index 10e83a9..930dd3c 100644 --- a/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt +++ b/Tests/RunCMake/CMP0116/CMP0116-Mixed-stderr.txt @@ -1,4 +1,15 @@ -^CMake Warning \(dev\) at CMP0116-Mixed\.cmake:1 \(add_custom_command\): +^CMake Deprecation Warning at CMP0116-Mixed\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0116 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Warning \(dev\) at CMP0116-Mixed\.cmake:1 \(add_custom_command\): Policy CMP0116 is not set: Ninja generators transform DEPFILEs from add_custom_command\(\)\. Run "cmake --help-policy CMP0116" for policy details\. Use the cmake_policy command to set the policy and suppress this diff --git a/Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN-stderr.txt new file mode 100644 index 0000000..887601c --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-OLD-NOWARN-stderr.txt @@ -0,0 +1,8 @@ +^CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\): + The OLD behavior for policy CMP0116 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\.$ diff --git a/Tests/RunCMake/CMP0116/CMP0116-OLD-WARN-stderr.txt b/Tests/RunCMake/CMP0116/CMP0116-OLD-WARN-stderr.txt new file mode 100644 index 0000000..887601c --- /dev/null +++ b/Tests/RunCMake/CMP0116/CMP0116-OLD-WARN-stderr.txt @@ -0,0 +1,8 @@ +^CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\): + The OLD behavior for policy CMP0116 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\.$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt index 2af72a4..9285f9d 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1-stderr.txt @@ -1,4 +1,15 @@ -^prop: `0` +^CMake Deprecation Warning at CMP0118-OLD-Test1\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +prop: `0` CMake Error at CMP0118-Common-Test1\.cmake:[0-9]+ \(target_sources\): Cannot find source file: diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt index 6109f65..9bd3d33 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test10-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source0\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test10\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source0\.txt: # 1a # GENERATED = `1` Generated_source0\.txt: # 1b # GENERATED = `1` Generated_source0\.txt: # 2a # GENERATED = `1` Generated_source0\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt index e5e97de..4730caf 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test11-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source0\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test11\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source0\.txt: # 1a # GENERATED = `1` Generated_source0\.txt: # 1b # GENERATED = `1` Generated_source0\.txt: # 2a # GENERATED = `1` Generated_source0\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt index e6c429c..69a07e1 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test12-stderr.txt @@ -1,4 +1,15 @@ -^CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): +^CMake Deprecation Warning at CMP0118-OLD-Test12\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): TARGET 'custom[4-6]' was not created in this directory\. + CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\): diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt index 75dbf23..45c1dcb 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test13-stderr.txt @@ -1,4 +1,15 @@ -^CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): +^CMake Deprecation Warning at CMP0118-OLD-Test13\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): TARGET 'custom[4-6]' was not created in this directory\. + CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\): diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt index f5b3d1a..7ade0cf 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test14-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source0\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test14\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source0\.txt: # 1a # GENERATED = `1` Generated_source0\.txt: # 1b # GENERATED = `1` Generated_source0\.txt: # 2a # GENERATED = `1` Generated_source0\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt index a30bc84..5735539 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test15-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source0\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test15\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source0\.txt: # 1a # GENERATED = `1` Generated_source0\.txt: # 1b # GENERATED = `1` Generated_source0\.txt: # 2a # GENERATED = `1` Generated_source0\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt index 403ce5a..74eb3e1 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2-stderr.txt @@ -1 +1,12 @@ -^prop: `1`$ +^CMake Deprecation Warning at CMP0118-OLD-Test2\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +prop: `1`$ diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt index 4f4fea3..cce5b19 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt @@ -1,4 +1,15 @@ -^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test3\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `1` Generated_with_full_path1\.txt: # 1b # GENERATED = `1` Generated_with_full_path1\.txt: # 2a # GENERATED = `1` Generated_with_full_path1\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt index 3c80531..47eee2e 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt @@ -1,4 +1,15 @@ -^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test3b\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `1` Generated_with_full_path1\.txt: # 1b # GENERATED = `1` Generated_with_full_path1\.txt: # 2a # GENERATED = `1` Generated_with_full_path1\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt index 9600fee..f17c9be 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4-stderr.txt @@ -1,4 +1,15 @@ -^Generated_with_full_path1\.txt: # 1a # GENERATED = `0` +^CMake Deprecation Warning at CMP0118-OLD-Test4\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `0` Generated_with_full_path1\.txt: # 1b # GENERATED = `0` Generated_with_full_path1\.txt: # 2a # GENERATED = `0` Generated_with_full_path1\.txt: # 2b # GENERATED = `0` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt index e638660..388e90e 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test4b-stderr.txt @@ -1,4 +1,15 @@ -^Generated_with_full_path1\.txt: # 1a # GENERATED = `0` +^CMake Deprecation Warning at CMP0118-OLD-Test4b\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `0` Generated_with_full_path1\.txt: # 1b # GENERATED = `0` Generated_with_full_path1\.txt: # 2a # GENERATED = `0` Generated_with_full_path1\.txt: # 2b # GENERATED = `0` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt index 18e6a8c..4a67fa7 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt @@ -1,4 +1,15 @@ -^Generated_with_full_path1\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test5\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_with_full_path1\.txt: # 1a # GENERATED = `1` Generated_with_full_path1\.txt: # 1b # GENERATED = `1` Generated_with_full_path1\.txt: # 2a # GENERATED = `1` Generated_with_full_path1\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt index a60545f..0cad373 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test6-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source1\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test6\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source1\.txt: # 1a # GENERATED = `1` Generated_source1\.txt: # 1b # GENERATED = `1` Generated_source1\.txt: # 2a # GENERATED = `1` Generated_source1\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt index fd496cb..7f232d5 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test7-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source1\.txt: # 1a # GENERATED = `1` +^CMake Deprecation Warning at CMP0118-OLD-Test7\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source1\.txt: # 1a # GENERATED = `1` Generated_source1\.txt: # 1b # GENERATED = `1` Generated_source1\.txt: # 2a # GENERATED = `1` Generated_source1\.txt: # 2b # GENERATED = `1` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt index 3505242..dd9d2ef 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source1\.txt: # 1a # GENERATED = `0` +^CMake Deprecation Warning at CMP0118-OLD-Test8\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source1\.txt: # 1a # GENERATED = `0` Generated_source1\.txt: # 1b # GENERATED = `0` Generated_source1\.txt: # 2a # GENERATED = `0` Generated_source1\.txt: # 2b # GENERATED = `0` diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt index 63a9341..e01f782 100644 --- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt +++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9-stderr.txt @@ -1,4 +1,15 @@ -^Generated_source1\.txt: # 1a # GENERATED = `0` +^CMake Deprecation Warning at CMP0118-OLD-Test9\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +Generated_source1\.txt: # 1a # GENERATED = `0` Generated_source1\.txt: # 1b # GENERATED = `0` Generated_source1\.txt: # 2a # GENERATED = `0` Generated_source1\.txt: # 2b # GENERATED = `0` diff --git a/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt b/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt index 5e9cf6c..2fc472b 100644 --- a/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt +++ b/Tests/RunCMake/CMP0118/GenInSubdir-OLD-stderr.txt @@ -1,4 +1,15 @@ -^CMake Error at GenInSubdir/CMakeLists\.txt:[0-9]+ \(target_sources\): +^CMake Deprecation Warning at GenInSubdir-OLD\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0118 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Error at GenInSubdir/CMakeLists\.txt:[0-9]+ \(target_sources\): Cannot find source file: [^ diff --git a/Tests/RunCMake/CMP0119/CMP0119-OLD-stderr.txt b/Tests/RunCMake/CMP0119/CMP0119-OLD-stderr.txt new file mode 100644 index 0000000..86eac41 --- /dev/null +++ b/Tests/RunCMake/CMP0119/CMP0119-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0119-OLD\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0119 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index f089a96..8baa98f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -363,7 +363,8 @@ if(CMake_TEST_FindOpenSSL) endif() if(CMake_TEST_UseSWIG) add_RunCMake_test(FindSWIG) - add_RunCMake_test(UseSWIG -DCMake_TEST_FindPython=${CMake_TEST_FindPython}) + add_RunCMake_test(UseSWIG -DCMake_TEST_FindPython2=${CMake_TEST_FindPython2} + -DCMake_TEST_FindPython3=${CMake_TEST_FindPython3}) endif() if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom") add_RunCMake_test(GenerateExportHeader) diff --git a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-OFF.cmake b/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-OFF.cmake deleted file mode 100644 index e69de29..0000000 --- a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-OFF.cmake +++ /dev/null diff --git a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON-stderr.txt b/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON-stderr.txt deleted file mode 100644 index 9080942..0000000 --- a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -^CMake Warning: - The "Visual Studio 11 2012" generator is deprecated and will be removed in - a future version of CMake. - - Add CMAKE_WARN_VS11=OFF to the cache to disable this warning.$ diff --git a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON.cmake b/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON.cmake deleted file mode 100644 index e69de29..0000000 --- a/Tests/RunCMake/CommandLine/DeprecateVS11-WARN-ON.cmake +++ /dev/null diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 45b4c0e..53f13e4 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -1118,10 +1118,3 @@ if(RunCMake_GENERATOR MATCHES "^Visual Studio 9 2008") run_cmake(DeprecateVS9-WARN-ON) run_cmake_with_options(DeprecateVS9-WARN-OFF -DCMAKE_WARN_VS9=OFF) endif() - -if(RunCMake_GENERATOR MATCHES "^Visual Studio 11 2012") - run_cmake_with_options(DeprecateVS11-WARN-ON -DCMAKE_WARN_VS11=ON) - unset(ENV{CMAKE_WARN_VS11}) - run_cmake(DeprecateVS11-WARN-ON) - run_cmake_with_options(DeprecateVS11-WARN-OFF -DCMAKE_WARN_VS11=OFF) -endif() diff --git a/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator-stdout.txt b/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator-stdout.txt new file mode 100644 index 0000000..9a7d746 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator-stdout.txt @@ -0,0 +1,2 @@ +-- env_emulator='pseudo_emulator(\.exe)?' +-- emulator='pseudo_emulator(\.exe)?' diff --git a/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator.cmake b/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator.cmake new file mode 100644 index 0000000..55fc483 --- /dev/null +++ b/Tests/RunCMake/CrosscompilingEmulator/EnvCrossCompilingEmulator.cmake @@ -0,0 +1,6 @@ +message(STATUS "ENV{CMAKE_CROSS_COMPILING_EMULATOR}='$ENV{CMAKE_CROSSCOMPILING_EMULATOR}'") +message(STATUS "CMAKE_CROSSCOMPLING_EMULATOR='${CMAKE_CROSSCOMPILING_EMULATOR}'") +get_filename_component(env_emulator "$ENV{CMAKE_CROSSCOMPILING_EMULATOR}" NAME) +message(STATUS "env_emulator='${env_emulator}'") +get_filename_component(emulator "${CMAKE_CROSSCOMPILING_EMULATOR}" NAME) +message(STATUS "emulator='${emulator}'") diff --git a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake index 97b7b5a..1ffd91c 100644 --- a/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake +++ b/Tests/RunCMake/CrosscompilingEmulator/RunCMakeTest.cmake @@ -26,3 +26,11 @@ set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSSCOMPILING_EMULATOR=${PSEUDO_EMULATOR_CUSTOM_COMMAND_ARG}\;custom_argument") CustomCommandGenerator_run_and_build(AddCustomCommandWithArg) CustomCommandGenerator_run_and_build(AddCustomTargetWithArg) +unset(RunCMake_TEST_OPTIONS) + +function(run_EnvCrossCompilingEmulator) + set(ENV{CMAKE_CROSSCOMPILING_EMULATOR} "${PSEUDO_EMULATOR}") + run_cmake(EnvCrossCompilingEmulator) + unset(ENV{CMAKE_CROSSCOMPILING_EMULATOR}) +endfunction() +run_EnvCrossCompilingEmulator() diff --git a/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-OLD-stderr.txt b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-OLD-stderr.txt new file mode 100644 index 0000000..4499d97 --- /dev/null +++ b/Tests/RunCMake/MSVCRuntimeTypeInfo/CMP0117-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0117-OLD\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0117 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Ninja/QtAutoMocDeps-stderr.txt b/Tests/RunCMake/Ninja/QtAutoMocDeps-stderr.txt new file mode 100644 index 0000000..6024984 --- /dev/null +++ b/Tests/RunCMake/Ninja/QtAutoMocDeps-stderr.txt @@ -0,0 +1,8 @@ +^CMake Deprecation Warning at QtSubDir1/CMakeLists\.txt:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0116 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\.$ diff --git a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake index c7a118f..537f67d 100644 --- a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake +++ b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake @@ -6,7 +6,7 @@ run_cmake(CMP0078-NEW) run_cmake(CMP0086-WARN) -if (CMake_TEST_FindPython) +if (CMake_TEST_FindPython2 OR CMake_TEST_FindPython3) macro(run_cmake_target test subtest target) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build) diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-Direct-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-Direct-stderr.txt new file mode 100644 index 0000000..53f603e --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-Direct-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0120-OLD-Direct\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0120 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-stderr.txt new file mode 100644 index 0000000..fea708f --- /dev/null +++ b/Tests/RunCMake/WriteCompilerDetectionHeader/CMP0120-OLD-stderr.txt @@ -0,0 +1,10 @@ +^CMake Deprecation Warning at CMP0120-OLD\.cmake:[0-9]+ \(cmake_policy\): + The OLD behavior for policy CMP0120 will be removed from a future version + of CMake\. + + The cmake-policies\(7\) manual explains that the OLD behaviors of all + policies are deprecated and that a policy should be set to OLD only under + specific short-term circumstances\. Projects should be ported to the NEW + behavior and not rely on setting a policy to OLD\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/UseSWIG/AlternateLibraryName/CMakeLists.txt b/Tests/UseSWIG/AlternateLibraryName/CMakeLists.txt index a2c239c..f20593c 100644 --- a/Tests/UseSWIG/AlternateLibraryName/CMakeLists.txt +++ b/Tests/UseSWIG/AlternateLibraryName/CMakeLists.txt @@ -7,7 +7,7 @@ include(CTest) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(Python2 REQUIRED COMPONENTS Interpreter Development) +find_package(Python REQUIRED COMPONENTS Interpreter Development) # Path separator if (WIN32) @@ -27,9 +27,9 @@ swig_add_library(example_python set_target_properties (example_python PROPERTIES INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/.." SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE) -target_link_libraries(example_python PRIVATE Python2::Python) +target_link_libraries(example_python PRIVATE Python::Python) add_test (NAME AlternateLibraryName.example1 COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}${PS}$<TARGET_FILE_DIR:example_python>" - "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") + "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt index 7c4925e..3d80270 100644 --- a/Tests/UseSWIG/CMakeLists.txt +++ b/Tests/UseSWIG/CMakeLists.txt @@ -147,16 +147,18 @@ add_test(NAME UseSWIG.MultipleModules COMMAND --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) -add_test(NAME UseSWIG.MultiplePython COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/UseSWIG/MultiplePython" - "${CMake_BINARY_DIR}/Tests/UseSWIG/MultiplePython" - ${build_generator_args} - --build-project TestMultiplePython - --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> +if(CMake_TEST_FindPython2 AND CMake_TEST_FindPython3) + add_test(NAME UseSWIG.MultiplePython COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/MultiplePython" + "${CMake_BINARY_DIR}/Tests/UseSWIG/MultiplePython" + ${build_generator_args} + --build-project TestMultiplePython + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) +endif() add_test(NAME UseSWIG.MultipleFiles COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -165,20 +167,20 @@ add_test(NAME UseSWIG.MultipleFiles COMMAND ${build_generator_args} --build-project TestMultipleFiles --build-options ${build_options} - ) - +) -add_test(NAME UseSWIG.ModuleVersion2 COMMAND - ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> - --build-and-test - "${CMake_SOURCE_DIR}/Tests/UseSWIG/ModuleVersion2" - "${CMake_BINARY_DIR}/Tests/UseSWIG/ModuleVersion2" - ${build_generator_args} - --build-project TestModuleVersion2 - --build-options ${build_options} - --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> +if(CMake_TEST_FindPython2 OR CMake_TEST_FindPython3) + add_test(NAME UseSWIG.ModuleVersion2 COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/ModuleVersion2" + "${CMake_BINARY_DIR}/Tests/UseSWIG/ModuleVersion2" + ${build_generator_args} + --build-project TestModuleVersion2 + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) - +endif() add_test(NAME UseSWIG.UseTargetINCLUDE_DIRECTORIES COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> diff --git a/Tests/UseSWIG/ModuleName/CMakeLists.txt b/Tests/UseSWIG/ModuleName/CMakeLists.txt index 435b441..c62319f 100644 --- a/Tests/UseSWIG/ModuleName/CMakeLists.txt +++ b/Tests/UseSWIG/ModuleName/CMakeLists.txt @@ -8,14 +8,7 @@ find_package(SWIG REQUIRED) cmake_policy(SET CMP0086 NEW) include(${SWIG_USE_FILE}) -find_package(Python2 REQUIRED COMPONENTS Interpreter Development) - -# Path separator -if (WIN32) - set (PS "$<SEMICOLON>") -else() - set (PS ":") -endif() +find_package(Python REQUIRED COMPONENTS Interpreter Development) unset(CMAKE_SWIG_FLAGS) @@ -34,9 +27,9 @@ set_target_properties (example1 PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1") -target_link_libraries(example1 PRIVATE Python2::Module) +target_link_libraries(example1 PRIVATE Python::Module) add_test (NAME ModuleName.example1 - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/Python2${PS}$<TARGET_FILE_DIR:example1>" - "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runme.py") + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:example1>" + "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runme.py") diff --git a/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt index 093e858..317ed47 100644 --- a/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt +++ b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt @@ -7,9 +7,6 @@ include(CTest) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(Python2 REQUIRED COMPONENTS Interpreter Development) -find_package(Python3 REQUIRED COMPONENTS Interpreter Development) - if (WIN32) set (PS $<SEMICOLON>) else() @@ -25,32 +22,69 @@ set_property(SOURCE "../example.i" PROPERTY COMPILE_OPTIONS -includeall) set_property(SOURCE "../example.i" PROPERTY GENERATED_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/..") -swig_add_library(example1 - LANGUAGE python - SOURCES ../example.i ../example.cxx) -set_target_properties (example1 PROPERTIES - OUTPUT_NAME example - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2") -target_link_libraries(example1 PRIVATE Python2::Module) - -# re-use sample interface file for another plugin -swig_add_library(example2 - LANGUAGE python - SOURCES ../example.i ../example.cxx) -set_target_properties (example2 PROPERTIES - OUTPUT_NAME example - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3") -target_link_libraries(example2 PRIVATE Python3::Module) - - -add_test (NAME ModuleVersion2.example1 - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_PROPERTY:example1,SWIG_SUPPORT_FILES_DIRECTORY>${PS}$<TARGET_FILE_DIR:example1>" - "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") - -add_test (NAME ModuleVersion2.example2 - COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_PROPERTY:example2,SWIG_SUPPORT_FILES_DIRECTORY>${PS}$<TARGET_FILE_DIR:example2>" - "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") +if(CMake_TEST_FindPython2) + find_package(Python2 REQUIRED COMPONENTS Interpreter Development) + + swig_add_library(example1 + LANGUAGE python + SOURCES ../example.i ../example.cxx) + set_target_properties (example1 PROPERTIES + OUTPUT_NAME example + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-1" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-1" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-1") + target_link_libraries(example1 PRIVATE Python2::Module) + + add_test (NAME ModuleVersion2.example1 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_PROPERTY:example1,SWIG_SUPPORT_FILES_DIRECTORY>${PS}$<TARGET_FILE_DIR:example1>" + "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") + + # re-use sample interface file for another plugin + swig_add_library(example2 + LANGUAGE python + SOURCES ../example.i ../example.cxx) + set_target_properties (example2 PROPERTIES + OUTPUT_NAME example + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-2" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-2" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-2") + target_link_libraries(example2 PRIVATE Python2::Module) + + add_test (NAME ModuleVersion2.example2 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_PROPERTY:example2,SWIG_SUPPORT_FILES_DIRECTORY>${PS}$<TARGET_FILE_DIR:example2>" + "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") +endif() + +if(CMake_TEST_FindPython3) + find_package(Python3 REQUIRED COMPONENTS Interpreter Development) + + swig_add_library(example3 + LANGUAGE python + SOURCES ../example.i ../example.cxx) + set_target_properties (example3 PROPERTIES + OUTPUT_NAME example + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-1" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-1" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-1") + target_link_libraries(example3 PRIVATE Python3::Module) + + add_test (NAME ModuleVersion2.example3 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_PROPERTY:example3,SWIG_SUPPORT_FILES_DIRECTORY>${PS}$<TARGET_FILE_DIR:example3>" + "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") + + + # re-use sample interface file for another plugin + swig_add_library(example4 + LANGUAGE python + SOURCES ../example.i ../example.cxx) + set_target_properties (example2 PROPERTIES + OUTPUT_NAME example + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-2" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-2" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-2") + target_link_libraries(example4 PRIVATE Python3::Module) + + add_test (NAME ModuleVersion2.example4 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_PROPERTY:example4,SWIG_SUPPORT_FILES_DIRECTORY>${PS}$<TARGET_FILE_DIR:example4>" + "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py") +endif() diff --git a/Tests/UseSWIG/MultipleFiles/CMakeLists.txt b/Tests/UseSWIG/MultipleFiles/CMakeLists.txt index bf3d946..36734f9 100644 --- a/Tests/UseSWIG/MultipleFiles/CMakeLists.txt +++ b/Tests/UseSWIG/MultipleFiles/CMakeLists.txt @@ -11,7 +11,7 @@ unset(SWIG_LANG_DEFINITIONS) unset(SWIG_LANG_OPTIONS) unset(SWIG_LANG_LIBRARIES) -find_package(Python3 REQUIRED COMPONENTS Development) +find_package(Python REQUIRED COMPONENTS Development) set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/add.i" PROPERTY CPLUSPLUS ON) set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/sub.i" PROPERTY CPLUSPLUS ON) @@ -27,4 +27,4 @@ swig_add_library(example "${CMAKE_CURRENT_SOURCE_DIR}/add.cxx" "${CMAKE_CURRENT_SOURCE_DIR}/sub.cxx") target_include_directories(example PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries(example PRIVATE Python3::Module) +target_link_libraries(example PRIVATE Python::Module) diff --git a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt index 80a2e16..6cdf987 100644 --- a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt +++ b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt @@ -7,7 +7,7 @@ include(CTest) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) -find_package(Python3 REQUIRED COMPONENTS Interpreter Development) +find_package(Python REQUIRED COMPONENTS Interpreter Development) unset(CMAKE_SWIG_FLAGS) @@ -25,7 +25,7 @@ set_target_properties (example1 PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1") -target_link_libraries(example1 PRIVATE Python3::Module) +target_link_libraries(example1 PRIVATE Python::Module) # Check that source property override target property @@ -42,4 +42,4 @@ set_target_properties (example2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2") -target_link_libraries(example2 PRIVATE Python3::Module) +target_link_libraries(example2 PRIVATE Python::Module) diff --git a/Utilities/Doxygen/CMakeLists.txt b/Utilities/Doxygen/CMakeLists.txt index fee21b6..12b5407 100644 --- a/Utilities/Doxygen/CMakeLists.txt +++ b/Utilities/Doxygen/CMakeLists.txt @@ -3,7 +3,7 @@ if(NOT CMake_SOURCE_DIR) set(CMakeDeveloperReference_STANDALONE 1) - cmake_minimum_required(VERSION 3.13...3.25 FATAL_ERROR) + cmake_minimum_required(VERSION 3.13...3.26 FATAL_ERROR) get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH) get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH) include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake) diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt index bde6c6b..694ba3c 100644 --- a/Utilities/Sphinx/CMakeLists.txt +++ b/Utilities/Sphinx/CMakeLists.txt @@ -3,7 +3,7 @@ if(NOT CMake_SOURCE_DIR) set(CMakeHelp_STANDALONE 1) - cmake_minimum_required(VERSION 3.13...3.25 FATAL_ERROR) + cmake_minimum_required(VERSION 3.13...3.26 FATAL_ERROR) get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH) get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH) include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake) diff --git a/Utilities/std/cmext/algorithm b/Utilities/std/cmext/algorithm index 11514fc..46377f4 100644 --- a/Utilities/std/cmext/algorithm +++ b/Utilities/std/cmext/algorithm @@ -16,6 +16,7 @@ #if defined(__SUNPRO_CC) && defined(__sparc) # include <list> +# include <string> # include <vector> #endif @@ -67,11 +68,15 @@ namespace cm { APPEND_TWO(C1, C2) \ APPEND_TWO(C2, C1) -// For now, manage only support for std::vector and std::list. -// Other sequential container support can be added if needed. +// For now, manage only support for std::vector, std::list, and +// std::basic_string. Other sequential container support can be added if +// needed. APPEND(std::vector) APPEND(std::list) +APPEND(std::basic_string) APPEND_MIX(std::vector, std::list) +APPEND_MIX(std::vector, std::basic_string) +APPEND_MIX(std::list, std::basic_string) # undef APPEND # undef APPEND_MIX |