Commit 02f527c6 authored by Robert Maynard's avatar Robert Maynard Committed by Brad King

Find: Provide global controls for the `NO_[]_PATH` call options

parent f0a89149
......@@ -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. ``<CurrentPackage>_ROOT``, ``ENV{<CurrentPackage>_ROOT}``,
``<ParentPackage>_ROOT``, ``ENV{<ParentPackage>_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 <CMake Language 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|
......
......@@ -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:
``<prefix>/include/<arch>`` 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:
``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|.
.. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace::
``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
......
......@@ -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:
``<prefix>/lib/<arch>`` 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:
``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|.
.. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace::
``<prefix>/lib/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set,
......
......@@ -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:
``<prefix>/include/<arch>`` 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:
``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|.
.. |CMAKE_SYSTEM_PREFIX_PATH_XXX| replace::
``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE`
......
......@@ -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|
......
......@@ -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
......
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:`<PackageName>_ROOT` variables.
* :variable:`CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH` - Controls the searching the standard system environment variables.
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.
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.
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.
CMAKE_FIND_USE_PACAKGE_ROOT_PATH
--------------------------------
Controls the searching of :variable:`<PackageName>_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.
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.
......@@ -67,6 +67,9 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
}
this->AlreadyInCache = false;
// Find what search path locations have been enabled/disable
this->SelectDefaultSearchModes();
// Find the current root path mode.
this->SelectDefaultRootPathMode();
......
......@@ -3,6 +3,7 @@
#include "cmFindCommon.h"
#include <algorithm>
#include <array>
#include <string.h>
#include <utility>
......@@ -144,6 +145,26 @@ void cmFindCommon::SelectDefaultMacMode()
}
}
void cmFindCommon::SelectDefaultSearchModes()
{
const std::array<std::pair<bool&, std::string>, 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<std::string>& paths)
{
#if 0
......
......@@ -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<std::string> UserHintsArgs;
std::vector<std::string> UserGuessArgs;
......
-- 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'
-- 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'
-- 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'
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}")
-- 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'
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)
include(RunCMake)
run_cmake(FromPATHEnv)
run_cmake(FromPrefixPath)
run_cmake(PrefixInPATH)
-- 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'
-- 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'
-- 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'
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}")
-- 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'
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}")
include(RunCMake)
run_cmake(Created)
run_cmake(FromPrefixPath)
run_cmake(FromPATHEnv)
if(CMAKE_HOST_UNIX)
run_cmake(LibArchLink)
endif()
......
-- 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'
-- 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'
-- 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'
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}")
include(RunCMake)
run_cmake(FromPATHEnv)
run_cmake(PrefixInPATH)
if(APPLE)
......
-- PROG='[^']*/Tests/RunCMake/find_program/A/testAandB'
-- PROG='PROG-NOTFOUND'
-- PROG='[^']*/Tests/RunCMake/find_program/B/testAandB'
-- PROG='[^']*/Tests/RunCMake/find_program/A/testAandB'
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}")
-- 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'
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment