From 02f527c66a6f9f0fa0d3fd4a816ea2bd9e3ba35f Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 12 Jun 2019 16:04:22 -0400 Subject: Find: Provide global controls for the `NO_[]_PATH` call options --- Help/command/FIND_XXX.txt | 16 +++++++++----- Help/command/find_file.rst | 9 ++++---- Help/command/find_library.rst | 9 ++++---- Help/command/find_path.rst | 9 ++++---- Help/command/find_program.rst | 3 ++- Help/manual/cmake-variables.7.rst | 5 +++++ .../dev/global-controls-over-find-locations.rst | 11 ++++++++++ .../CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH.rst | 11 ++++++++++ Help/variable/CMAKE_FIND_USE_CMAKE_PATH.rst | 11 ++++++++++ Help/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH.rst | 11 ++++++++++ Help/variable/CMAKE_FIND_USE_PACAKGE_ROOT_PATH.rst | 11 ++++++++++ .../CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.rst | 11 ++++++++++ Source/cmFindBase.cxx | 3 +++ Source/cmFindCommon.cxx | 21 ++++++++++++++++++ Source/cmFindCommon.h | 3 +++ .../find_file/FromPATHEnv-stdout-cygwin.txt | 9 ++++++++ .../find_file/FromPATHEnv-stdout-windows.txt | 9 ++++++++ Tests/RunCMake/find_file/FromPATHEnv-stdout.txt | 9 ++++++++ Tests/RunCMake/find_file/FromPATHEnv.cmake | 24 +++++++++++++++++++++ Tests/RunCMake/find_file/FromPrefixPath-stdout.txt | 6 ++++++ Tests/RunCMake/find_file/FromPrefixPath.cmake | 17 +++++++++++++++ Tests/RunCMake/find_file/RunCMakeTest.cmake | 2 ++ .../find_library/FromPATHEnv-stdout-cygwin.txt | 6 ++++++ .../find_library/FromPATHEnv-stdout-windows.txt | 6 ++++++ Tests/RunCMake/find_library/FromPATHEnv-stdout.txt | 6 ++++++ Tests/RunCMake/find_library/FromPATHEnv.cmake | 22 +++++++++++++++++++ .../find_library/FromPrefixPath-stdout.txt | 6 ++++++ Tests/RunCMake/find_library/FromPrefixPath.cmake | 24 +++++++++++++++++++++ Tests/RunCMake/find_library/RunCMakeTest.cmake | 2 ++ .../find_path/FromPATHEnv-stdout-cygwin.txt | 9 ++++++++ .../find_path/FromPATHEnv-stdout-windows.txt | 9 ++++++++ Tests/RunCMake/find_path/FromPATHEnv-stdout.txt | 9 ++++++++ Tests/RunCMake/find_path/FromPATHEnv.cmake | 25 ++++++++++++++++++++++ Tests/RunCMake/find_path/RunCMakeTest.cmake | 1 + Tests/RunCMake/find_program/EnvAndHints-stdout.txt | 3 +++ Tests/RunCMake/find_program/EnvAndHints.cmake | 23 ++++++++++++++++++++ .../RunCMake/find_program/RelAndAbsPath-stdout.txt | 2 ++ Tests/RunCMake/find_program/RelAndAbsPath.cmake | 22 +++++++++++++++++++ 38 files changed, 374 insertions(+), 21 deletions(-) create mode 100644 Help/release/dev/global-controls-over-find-locations.rst create mode 100644 Help/variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH.rst create mode 100644 Help/variable/CMAKE_FIND_USE_CMAKE_PATH.rst create mode 100644 Help/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH.rst create mode 100644 Help/variable/CMAKE_FIND_USE_PACAKGE_ROOT_PATH.rst create mode 100644 Help/variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.rst create mode 100644 Tests/RunCMake/find_file/FromPATHEnv-stdout-cygwin.txt create mode 100644 Tests/RunCMake/find_file/FromPATHEnv-stdout-windows.txt create mode 100644 Tests/RunCMake/find_file/FromPATHEnv-stdout.txt create mode 100644 Tests/RunCMake/find_file/FromPATHEnv.cmake create mode 100644 Tests/RunCMake/find_file/FromPrefixPath-stdout.txt create mode 100644 Tests/RunCMake/find_file/FromPrefixPath.cmake create mode 100644 Tests/RunCMake/find_library/FromPATHEnv-stdout-cygwin.txt create mode 100644 Tests/RunCMake/find_library/FromPATHEnv-stdout-windows.txt create mode 100644 Tests/RunCMake/find_library/FromPATHEnv-stdout.txt create mode 100644 Tests/RunCMake/find_library/FromPATHEnv.cmake create mode 100644 Tests/RunCMake/find_library/FromPrefixPath-stdout.txt create mode 100644 Tests/RunCMake/find_library/FromPrefixPath.cmake create mode 100644 Tests/RunCMake/find_path/FromPATHEnv-stdout-cygwin.txt create mode 100644 Tests/RunCMake/find_path/FromPATHEnv-stdout-windows.txt create mode 100644 Tests/RunCMake/find_path/FromPATHEnv-stdout.txt create mode 100644 Tests/RunCMake/find_path/FromPATHEnv.cmake diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt index dde4dbb..fc8c55e 100644 --- a/Help/command/FIND_XXX.txt +++ b/Help/command/FIND_XXX.txt @@ -89,7 +89,8 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: searched after paths from the current module, i.e. ``_ROOT``, ``ENV{_ROOT}``, ``_ROOT``, ``ENV{_ROOT}``, etc. - This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed. + This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed or by setting + the :variable:`CMAKE_FIND_USE_PACAKGE_ROOT_PATH` to ``FALSE``. See policy :policy:`CMP0074`. * |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX| @@ -97,7 +98,8 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: 2. Search paths specified in cmake-specific cache variables. These are intended to be used on the command line with a ``-DVAR=value``. The values are interpreted as :ref:`semicolon-separated lists `. - This can be skipped if ``NO_CMAKE_PATH`` is passed. + This can be skipped if ``NO_CMAKE_PATH`` is passed or by setting the + :variable:`CMAKE_FIND_USE_CMAKE_PATH` to ``FALSE``. * |CMAKE_PREFIX_PATH_XXX| * |CMAKE_XXX_PATH| @@ -107,7 +109,8 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: These are intended to be set in the user's shell configuration, and therefore use the host's native path separator (``;`` on Windows and ``:`` on UNIX). - This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed. + This can be skipped if ``NO_CMAKE_ENVIRONMENT_PATH`` is passed or + by setting the :variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH` to ``FALSE``. * |CMAKE_PREFIX_PATH_XXX| * |CMAKE_XXX_PATH| @@ -119,13 +122,16 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: Hard-coded guesses should be specified with the ``PATHS`` option. 5. Search the standard system environment variables. - This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is an argument. + This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is passed or by + setting the :variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH` to ``FALSE``. * |SYSTEM_ENVIRONMENT_PATH_XXX| + * |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| 6. Search cmake variables defined in the Platform files for the current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH`` - is passed. + is passed or by setting the :variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH` + to ``FALSE``. * |CMAKE_SYSTEM_PREFIX_PATH_XXX| * |CMAKE_SYSTEM_XXX_PATH| diff --git a/Help/command/find_file.rst b/Help/command/find_file.rst index 2a14ad7..3f03f37 100644 --- a/Help/command/find_file.rst +++ b/Help/command/find_file.rst @@ -17,11 +17,10 @@ find_file .. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH` .. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``INCLUDE``. - On Windows hosts: - ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` - is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, and the - directories in ``PATH`` itself. +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``PATH`` and ``INCLUDE``. +.. |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| replace:: On Windows hosts: + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst index 0861d67..8a55aca 100644 --- a/Help/command/find_library.rst +++ b/Help/command/find_library.rst @@ -17,11 +17,10 @@ find_library .. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_LIBRARY_PATH` .. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``LIB``. - On Windows hosts: - ``/lib/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, - and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, - and the directories in ``PATH`` itself. +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``PATH`` and ``INCLUDE``. +.. |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| replace:: On Windows hosts: + ``/lib/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: ``/lib/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, diff --git a/Help/command/find_path.rst b/Help/command/find_path.rst index 988a3fa..52ffe3c 100644 --- a/Help/command/find_path.rst +++ b/Help/command/find_path.rst @@ -17,11 +17,10 @@ find_path .. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH` .. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: Directories in ``INCLUDE``. - On Windows hosts: - ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` - is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|, and the - directories in ``PATH`` itself. +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``PATH`` and ``INCLUDE``. +.. |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| replace:: On Windows hosts: + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|. .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` diff --git a/Help/command/find_program.rst b/Help/command/find_program.rst index 4f00773..e2ff693 100644 --- a/Help/command/find_program.rst +++ b/Help/command/find_program.rst @@ -15,7 +15,8 @@ find_program .. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_PROGRAM_PATH` .. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_APPBUNDLE_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: ``PATH`` +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``PATH`` itself. +.. |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| replace:: On Windows hosts no extra search paths are included .. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace:: |CMAKE_SYSTEM_PREFIX_PATH_XXX_SUBDIR| diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 75ddd5d..cc6a7d2 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -180,6 +180,11 @@ Variables that Change Behavior /variable/CMAKE_FIND_ROOT_PATH_MODE_LIBRARY /variable/CMAKE_FIND_ROOT_PATH_MODE_PACKAGE /variable/CMAKE_FIND_ROOT_PATH_MODE_PROGRAM + /variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH + /variable/CMAKE_FIND_USE_CMAKE_PATH + /variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH + /variable/CMAKE_FIND_USE_PACAKGE_ROOT_PATH + /variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH /variable/CMAKE_FRAMEWORK_PATH /variable/CMAKE_IGNORE_PATH /variable/CMAKE_INCLUDE_DIRECTORIES_BEFORE diff --git a/Help/release/dev/global-controls-over-find-locations.rst b/Help/release/dev/global-controls-over-find-locations.rst new file mode 100644 index 0000000..d915fbb --- /dev/null +++ b/Help/release/dev/global-controls-over-find-locations.rst @@ -0,0 +1,11 @@ +global-controls-over-find-locations +----------------------------------- + +* The :command:`find_file`, :command:`find_library`, :command:`find_path`, + and :command:`find_program` commands have learned to check the following + variables to control searching + * :variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH` - Controls the searching the cmake-specific environment variables. + * :variable:`CMAKE_FIND_USE_CMAKE_PATH` - Controls the searching the cmake-specific cache variables. + * :variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH` - Controls the searching cmake platform specific variables. + * :variable:`CMAKE_FIND_USE_PACAKGE_ROOT_PATH` - Controls the searching of :variable:`_ROOT` variables. + * :variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH` - Controls the searching the standard system environment variables. diff --git a/Help/variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH.rst b/Help/variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH.rst new file mode 100644 index 0000000..3db510f --- /dev/null +++ b/Help/variable/CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH.rst @@ -0,0 +1,11 @@ +CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH +------------------------------------- + +Controls the searching the cmake-specific environment variables by the :command:`find_program`, +:command:`find_library`, :command:`find_file`, :command:`find_package`, and :command:`find_path`. +This is useful in cross-compiling environments. + +By default this this is set to ``TRUE``. + +See also the :variable:`CMAKE_FIND_USE_CMAKE_PATH`, :variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`, +:variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH`, and :variable:`CMAKE_FIND_USE_PACAKGE_ROOT_PATH` variables. diff --git a/Help/variable/CMAKE_FIND_USE_CMAKE_PATH.rst b/Help/variable/CMAKE_FIND_USE_CMAKE_PATH.rst new file mode 100644 index 0000000..86a6186 --- /dev/null +++ b/Help/variable/CMAKE_FIND_USE_CMAKE_PATH.rst @@ -0,0 +1,11 @@ +CMAKE_FIND_USE_CMAKE_PATH +------------------------- + +Controls the searching the cmake-specific cache variables by the :command:`find_program`, +:command:`find_library`, :command:`find_file`, :command:`find_package`, and :command:`find_path`. +This is useful in cross-compiling environments. + +By default this this is set to ``TRUE``. + +See also the :variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH`, :variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`, +:variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH`, and :variable:`CMAKE_FIND_USE_PACAKGE_ROOT_PATH` variables. diff --git a/Help/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH.rst b/Help/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH.rst new file mode 100644 index 0000000..b4171c0 --- /dev/null +++ b/Help/variable/CMAKE_FIND_USE_CMAKE_SYSTEM_PATH.rst @@ -0,0 +1,11 @@ +CMAKE_FIND_USE_CMAKE_SYSTEM_PATH +-------------------------------- + +Controls the searching cmake platform specific variables by the :command:`find_program`, +:command:`find_library`, :command:`find_file`, :command:`find_package`, and :command:`find_path`. +This is useful in cross-compiling environments. + +By default this this is set to ``TRUE``. + +See also the :variable:`CMAKE_FIND_USE_CMAKE_PATH`, :variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH`, +:variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH`, and :variable:`CMAKE_FIND_USE_PACAKGE_ROOT_PATH` variables. diff --git a/Help/variable/CMAKE_FIND_USE_PACAKGE_ROOT_PATH.rst b/Help/variable/CMAKE_FIND_USE_PACAKGE_ROOT_PATH.rst new file mode 100644 index 0000000..ac25ec9 --- /dev/null +++ b/Help/variable/CMAKE_FIND_USE_PACAKGE_ROOT_PATH.rst @@ -0,0 +1,11 @@ +CMAKE_FIND_USE_PACAKGE_ROOT_PATH +-------------------------------- + +Controls the searching of :variable:`_ROOT` variables by the :command:`find_program`, +:command:`find_library`, :command:`find_file`, :command:`find_package`, and :command:`find_path`. +This is useful in cross-compiling environments. + +By default this this is set to ``TRUE``. + +See also the :variable:`CMAKE_FIND_USE_CMAKE_PATH`, :variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH`, +:variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`, and :variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH` variables. diff --git a/Help/variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.rst b/Help/variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.rst new file mode 100644 index 0000000..fd0582f --- /dev/null +++ b/Help/variable/CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH.rst @@ -0,0 +1,11 @@ +CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH +-------------------------------------- + +Controls the searching the standard system environment variables by the :command:`find_program`, +:command:`find_library`, :command:`find_file`, :command:`find_package`, and :command:`find_path`. +This is useful in cross-compiling environments. + +By default this this is set to ``TRUE``. + +See also the :variable:`CMAKE_FIND_USE_CMAKE_PATH`, :variable:`CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH`, +:variable:`CMAKE_FIND_USE_CMAKE_SYSTEM_PATH`, and :variable:`CMAKE_FIND_USE_PACAKGE_ROOT_PATH` variables. diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index e590802..be7964a 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -67,6 +67,9 @@ bool cmFindBase::ParseArguments(std::vector const& argsIn) } this->AlreadyInCache = false; + // Find what search path locations have been enabled/disable + this->SelectDefaultSearchModes(); + // Find the current root path mode. this->SelectDefaultRootPathMode(); diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index 954558f..c6b9049 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -3,6 +3,7 @@ #include "cmFindCommon.h" #include +#include #include #include @@ -144,6 +145,26 @@ void cmFindCommon::SelectDefaultMacMode() } } +void cmFindCommon::SelectDefaultSearchModes() +{ + const std::array, 5> search_paths = { + { { this->NoPackageRootPath, "CMAKE_FIND_USE_PACAKGE_ROOT_PATH" }, + { this->NoCMakePath, "CMAKE_FIND_USE_CMAKE_PATH" }, + { this->NoCMakeEnvironmentPath, + "CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH" }, + { this->NoSystemEnvironmentPath, + "CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH" }, + { this->NoCMakeSystemPath, "CMAKE_FIND_USE_CMAKE_SYSTEM_PATH" } } + }; + + for (auto& path : search_paths) { + const char* def = this->Makefile->GetDefinition(path.second); + if (def) { + path.first = !cmSystemTools::IsOn(def); + } + } +} + void cmFindCommon::RerootPaths(std::vector& paths) { #if 0 diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index 89ff174..d95eeb1 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -90,6 +90,9 @@ protected: /** Compute the current default bundle/framework search policy. */ void SelectDefaultMacMode(); + /** Compute the current default search modes based on global variables. */ + void SelectDefaultSearchModes(); + // Path arguments prior to path manipulation routines std::vector UserHintsArgs; std::vector UserGuessArgs; diff --git a/Tests/RunCMake/find_file/FromPATHEnv-stdout-cygwin.txt b/Tests/RunCMake/find_file/FromPATHEnv-stdout-cygwin.txt new file mode 100644 index 0000000..6912bdf --- /dev/null +++ b/Tests/RunCMake/find_file/FromPATHEnv-stdout-cygwin.txt @@ -0,0 +1,9 @@ +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_File='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' diff --git a/Tests/RunCMake/find_file/FromPATHEnv-stdout-windows.txt b/Tests/RunCMake/find_file/FromPATHEnv-stdout-windows.txt new file mode 100644 index 0000000..6912bdf --- /dev/null +++ b/Tests/RunCMake/find_file/FromPATHEnv-stdout-windows.txt @@ -0,0 +1,9 @@ +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_File='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' diff --git a/Tests/RunCMake/find_file/FromPATHEnv-stdout.txt b/Tests/RunCMake/find_file/FromPATHEnv-stdout.txt new file mode 100644 index 0000000..27a83ad --- /dev/null +++ b/Tests/RunCMake/find_file/FromPATHEnv-stdout.txt @@ -0,0 +1,9 @@ +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' diff --git a/Tests/RunCMake/find_file/FromPATHEnv.cmake b/Tests/RunCMake/find_file/FromPATHEnv.cmake new file mode 100644 index 0000000..9f058dd --- /dev/null +++ b/Tests/RunCMake/find_file/FromPATHEnv.cmake @@ -0,0 +1,24 @@ +set(ENV_PATH "$ENV{PATH}") +foreach(path "/does_not_exist" "/include" "") + unset(PrefixInPATH_File CACHE) + set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}") + find_file(PrefixInPATH_File NAMES PrefixInPATH.h) + message(STATUS "PrefixInPATH_File='${PrefixInPATH_File}'") +endforeach() + +set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF) +foreach(path "/does_not_exist" "/include" "") + unset(PrefixInPATH_File CACHE) + set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}") + find_file(PrefixInPATH_File NAMES PrefixInPATH.h) + message(STATUS "PrefixInPATH_File='${PrefixInPATH_File}'") +endforeach() + +set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ON) +foreach(path "/does_not_exist" "/include" "") + unset(PrefixInPATH_File CACHE) + set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}") + find_file(PrefixInPATH_File NAMES PrefixInPATH.h NO_SYSTEM_ENVIRONMENT_PATH) + message(STATUS "PrefixInPATH_File='${PrefixInPATH_File}'") +endforeach() +set(ENV{PATH} "${ENV_PATH}") diff --git a/Tests/RunCMake/find_file/FromPrefixPath-stdout.txt b/Tests/RunCMake/find_file/FromPrefixPath-stdout.txt new file mode 100644 index 0000000..4bd24aa --- /dev/null +++ b/Tests/RunCMake/find_file/FromPrefixPath-stdout.txt @@ -0,0 +1,6 @@ +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_File='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' diff --git a/Tests/RunCMake/find_file/FromPrefixPath.cmake b/Tests/RunCMake/find_file/FromPrefixPath.cmake new file mode 100644 index 0000000..1bf8409 --- /dev/null +++ b/Tests/RunCMake/find_file/FromPrefixPath.cmake @@ -0,0 +1,17 @@ +set(ENV{PATH} "") +foreach(path "/does_not_exist" "/include" "") + unset(PrefixInPATH_File CACHE) + set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}${path}") + find_file(PrefixInPATH_File NAMES PrefixInPATH.h) + message(STATUS "PrefixInPATH_File='${PrefixInPATH_File}'") +endforeach() + +set(CMAKE_FIND_USE_CMAKE_PATH OFF) +set(CMAKE_PREFIX_PATH ) +foreach(path "/does_not_exist" "/include" "") + unset(PrefixInPATH_File CACHE) + set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}${path}") + find_file(PrefixInPATH_File NAMES PrefixInPATH.h) + message(STATUS "PrefixInPATH_File='${PrefixInPATH_File}'") +endforeach() +set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ON) diff --git a/Tests/RunCMake/find_file/RunCMakeTest.cmake b/Tests/RunCMake/find_file/RunCMakeTest.cmake index 014f397..9f56a57 100644 --- a/Tests/RunCMake/find_file/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_file/RunCMakeTest.cmake @@ -1,3 +1,5 @@ include(RunCMake) +run_cmake(FromPATHEnv) +run_cmake(FromPrefixPath) run_cmake(PrefixInPATH) diff --git a/Tests/RunCMake/find_library/FromPATHEnv-stdout-cygwin.txt b/Tests/RunCMake/find_library/FromPATHEnv-stdout-cygwin.txt new file mode 100644 index 0000000..01e2720 --- /dev/null +++ b/Tests/RunCMake/find_library/FromPATHEnv-stdout-cygwin.txt @@ -0,0 +1,6 @@ +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/FromPATHEnv-build/lib/libcreated.a' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/FromPATHEnv-build/lib/libcreated.a' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' diff --git a/Tests/RunCMake/find_library/FromPATHEnv-stdout-windows.txt b/Tests/RunCMake/find_library/FromPATHEnv-stdout-windows.txt new file mode 100644 index 0000000..01e2720 --- /dev/null +++ b/Tests/RunCMake/find_library/FromPATHEnv-stdout-windows.txt @@ -0,0 +1,6 @@ +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/FromPATHEnv-build/lib/libcreated.a' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/FromPATHEnv-build/lib/libcreated.a' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' diff --git a/Tests/RunCMake/find_library/FromPATHEnv-stdout.txt b/Tests/RunCMake/find_library/FromPATHEnv-stdout.txt new file mode 100644 index 0000000..4e570a6 --- /dev/null +++ b/Tests/RunCMake/find_library/FromPATHEnv-stdout.txt @@ -0,0 +1,6 @@ +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/FromPATHEnv-build/lib/libcreated.a' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' diff --git a/Tests/RunCMake/find_library/FromPATHEnv.cmake b/Tests/RunCMake/find_library/FromPATHEnv.cmake new file mode 100644 index 0000000..fec041d --- /dev/null +++ b/Tests/RunCMake/find_library/FromPATHEnv.cmake @@ -0,0 +1,22 @@ +list(APPEND CMAKE_FIND_LIBRARY_PREFIXES lib) +list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .a) +set(ENV_PATH "$ENV{PATH}") +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib/libcreated.a" "created") + +foreach(path "/does_not_exist" "/lib" "") + unset(CREATED_LIBRARY CACHE) + set(ENV{PATH} "${CMAKE_CURRENT_BINARY_DIR}${path}") + find_library(CREATED_LIBRARY NAMES created) + message(STATUS "CREATED_LIBRARY='${CREATED_LIBRARY}'") +endforeach() + +set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF) +foreach(path "/does_not_exist" "/lib" "") + unset(CREATED_LIBRARY CACHE) + set(ENV{PATH} "${CMAKE_CURRENT_BINARY_DIR}${path}") + find_library(CREATED_LIBRARY NAMES created) + message(STATUS "CREATED_LIBRARY='${CREATED_LIBRARY}'") +endforeach() +set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ON) +set(ENV{PATH} "${ENV_PATH}") diff --git a/Tests/RunCMake/find_library/FromPrefixPath-stdout.txt b/Tests/RunCMake/find_library/FromPrefixPath-stdout.txt new file mode 100644 index 0000000..de3df1a --- /dev/null +++ b/Tests/RunCMake/find_library/FromPrefixPath-stdout.txt @@ -0,0 +1,6 @@ +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/FromPrefixPath-build/lib/libcreated.a' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/FromPrefixPath-build/lib/libcreated.a' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' diff --git a/Tests/RunCMake/find_library/FromPrefixPath.cmake b/Tests/RunCMake/find_library/FromPrefixPath.cmake new file mode 100644 index 0000000..04763a9 --- /dev/null +++ b/Tests/RunCMake/find_library/FromPrefixPath.cmake @@ -0,0 +1,24 @@ +list(APPEND CMAKE_FIND_LIBRARY_PREFIXES lib) +list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .a) +set(ENV_PATH "$ENV{PATH}") +set(ENV{PATH} "") +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib/libcreated.a" "created") + +foreach(path "/does_not_exist" "/lib" "") + unset(CREATED_LIBRARY CACHE) + set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_BINARY_DIR}${path}") + find_library(CREATED_LIBRARY NAMES created) + message(STATUS "CREATED_LIBRARY='${CREATED_LIBRARY}'") +endforeach() + +set(CMAKE_FIND_USE_CMAKE_PATH OFF) +set(CMAKE_PREFIX_PATH ) +foreach(path "/does_not_exist" "/lib" "") + unset(CREATED_LIBRARY CACHE) + set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_BINARY_DIR}${path}") + find_library(CREATED_LIBRARY NAMES created) + message(STATUS "CREATED_LIBRARY='${CREATED_LIBRARY}'") +endforeach() +set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ON) +set(ENV{PATH} "${ENV_PATH}") diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake index ecfa0fe..643a5b9 100644 --- a/Tests/RunCMake/find_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake @@ -1,6 +1,8 @@ include(RunCMake) run_cmake(Created) +run_cmake(FromPrefixPath) +run_cmake(FromPATHEnv) if(CMAKE_HOST_UNIX) run_cmake(LibArchLink) endif() diff --git a/Tests/RunCMake/find_path/FromPATHEnv-stdout-cygwin.txt b/Tests/RunCMake/find_path/FromPATHEnv-stdout-cygwin.txt new file mode 100644 index 0000000..8f3e7ca --- /dev/null +++ b/Tests/RunCMake/find_path/FromPATHEnv-stdout-cygwin.txt @@ -0,0 +1,9 @@ +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='.*/Tests/RunCMake/find_path/include' +-- PATH_IN_ENV_PATH='.*/Tests/RunCMake/find_path/include' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' diff --git a/Tests/RunCMake/find_path/FromPATHEnv-stdout-windows.txt b/Tests/RunCMake/find_path/FromPATHEnv-stdout-windows.txt new file mode 100644 index 0000000..8f3e7ca --- /dev/null +++ b/Tests/RunCMake/find_path/FromPATHEnv-stdout-windows.txt @@ -0,0 +1,9 @@ +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='.*/Tests/RunCMake/find_path/include' +-- PATH_IN_ENV_PATH='.*/Tests/RunCMake/find_path/include' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' diff --git a/Tests/RunCMake/find_path/FromPATHEnv-stdout.txt b/Tests/RunCMake/find_path/FromPATHEnv-stdout.txt new file mode 100644 index 0000000..fd41bf4 --- /dev/null +++ b/Tests/RunCMake/find_path/FromPATHEnv-stdout.txt @@ -0,0 +1,9 @@ +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='.*/Tests/RunCMake/find_path/include' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' diff --git a/Tests/RunCMake/find_path/FromPATHEnv.cmake b/Tests/RunCMake/find_path/FromPATHEnv.cmake new file mode 100644 index 0000000..af13d09 --- /dev/null +++ b/Tests/RunCMake/find_path/FromPATHEnv.cmake @@ -0,0 +1,25 @@ +set(ENV_PATH "$ENV{PATH}") +foreach(path "/does_not_exist" "/include" "") + unset(PATH_IN_ENV_PATH CACHE) + set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}") + find_path(PATH_IN_ENV_PATH NAMES PrefixInPATH.h) + message(STATUS "PATH_IN_ENV_PATH='${PATH_IN_ENV_PATH}'") +endforeach() + +set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF) +foreach(path "/does_not_exist" "/include" "") + unset(PATH_IN_ENV_PATH CACHE) + set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}") + find_path(PATH_IN_ENV_PATH NAMES PrefixInPATH.h) + message(STATUS "PATH_IN_ENV_PATH='${PATH_IN_ENV_PATH}'") +endforeach() + +set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ON) +foreach(path "/does_not_exist" "/include" "") + unset(PATH_IN_ENV_PATH CACHE) + set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}") + find_path(PATH_IN_ENV_PATH NAMES PrefixInPATH.h NO_SYSTEM_ENVIRONMENT_PATH) + message(STATUS "PATH_IN_ENV_PATH='${PATH_IN_ENV_PATH}'") +endforeach() + +set(ENV{PATH} "${ENV_PATH}") diff --git a/Tests/RunCMake/find_path/RunCMakeTest.cmake b/Tests/RunCMake/find_path/RunCMakeTest.cmake index 6d22124..8b5b5b7 100644 --- a/Tests/RunCMake/find_path/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_path/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(FromPATHEnv) run_cmake(PrefixInPATH) if(APPLE) diff --git a/Tests/RunCMake/find_program/EnvAndHints-stdout.txt b/Tests/RunCMake/find_program/EnvAndHints-stdout.txt index 39329b2..0051636 100644 --- a/Tests/RunCMake/find_program/EnvAndHints-stdout.txt +++ b/Tests/RunCMake/find_program/EnvAndHints-stdout.txt @@ -1 +1,4 @@ -- PROG='[^']*/Tests/RunCMake/find_program/A/testAandB' +-- PROG='PROG-NOTFOUND' +-- PROG='[^']*/Tests/RunCMake/find_program/B/testAandB' +-- PROG='[^']*/Tests/RunCMake/find_program/A/testAandB' diff --git a/Tests/RunCMake/find_program/EnvAndHints.cmake b/Tests/RunCMake/find_program/EnvAndHints.cmake index 14ebd6e..0f12eff 100644 --- a/Tests/RunCMake/find_program/EnvAndHints.cmake +++ b/Tests/RunCMake/find_program/EnvAndHints.cmake @@ -1,8 +1,31 @@ + set(ENV_PATH "$ENV{PATH}") set(ENV{PATH} ${CMAKE_CURRENT_SOURCE_DIR}/A) find_program(PROG NAMES testAandB + ) +message(STATUS "PROG='${PROG}'") +unset(PROG CACHE) + +set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF) +find_program(PROG + NAMES testAandB + ) +message(STATUS "PROG='${PROG}'") +unset(PROG CACHE) + +find_program(PROG + NAMES testAandB + HINTS ${CMAKE_CURRENT_SOURCE_DIR}/B ${CMAKE_CURRENT_SOURCE_DIR}/A + ) +message(STATUS "PROG='${PROG}'") +unset(PROG CACHE) +set(ENV{PATH} "${ENV_PATH}") + +find_program(PROG + NAMES testAandB HINTS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B ) message(STATUS "PROG='${PROG}'") +unset(PROG CACHE) set(ENV{PATH} "${ENV_PATH}") diff --git a/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt b/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt index cb3c99f..d2312e7 100644 --- a/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt +++ b/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt @@ -1,6 +1,8 @@ -- PROG_ABS='PROG_ABS-NOTFOUND' -- PROG_ABS_NPD='PROG_ABS_NPD-NOTFOUND' -- PROG_CWD='PROG_CWD-NOTFOUND' +-- PROG_CWD='PROG_CWD-NOTFOUND' +-- PROG_CWD='[^']*/Tests/RunCMake/find_program/testCWD' -- PROG_CWD_NPD='PROG_CWD_NPD-NOTFOUND' -- PROG_CWD_DOT='[^']*/Tests/RunCMake/find_program/testCWD' -- PROG_CWD_DOT_NPD='[^']*/Tests/RunCMake/find_program/testCWD' diff --git a/Tests/RunCMake/find_program/RelAndAbsPath.cmake b/Tests/RunCMake/find_program/RelAndAbsPath.cmake index 9a42c5e..e6bdef7 100644 --- a/Tests/RunCMake/find_program/RelAndAbsPath.cmake +++ b/Tests/RunCMake/find_program/RelAndAbsPath.cmake @@ -38,6 +38,28 @@ find_program(PROG_CWD ) message(STATUS "PROG_CWD='${PROG_CWD}'") + +set(CMAKE_PREFIX_PATH ".") +# On some platforms / dashboards the current working +# directory can be in PATH or other search locations +# so disable all searching to make sure this fails +set(CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH OFF) +set(CMAKE_FIND_USE_CMAKE_PATH OFF) +set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH OFF) +set(CMAKE_FIND_USE_PACAKGE_ROOT_PATH OFF) +set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF) +find_program(PROG_CWD + NAMES testCWD + ) +message(STATUS "PROG_CWD='${PROG_CWD}'") + +set(CMAKE_PREFIX_PATH ".") +set(CMAKE_FIND_USE_CMAKE_PATH ON) +find_program(PROG_CWD + NAMES testCWD + ) +message(STATUS "PROG_CWD='${PROG_CWD}'") + find_program(PROG_CWD_NPD NAMES testCWD NAMES_PER_DIR -- cgit v0.12