summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/find_package/FromPATHEnv.cmake
blob: 9158d4b7c8f9151b37e787bec334ba9c308f13eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
set(ENV_PATH "$ENV{PATH}")
set(ENV_CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")

set(ENV{CMAKE_PREFIX_PATH} "")

set(CMAKE_FIND_DEBUG_MODE ON)
set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot")
find_package(Resolved QUIET)
set(CMAKE_FIND_DEBUG_MODE OFF)

foreach(path "/does_not_exist" "/PackageRoot" "")
  unset(Resolved_FOUND CACHE)
  set(Resolved_DIR "")
  set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}")
  find_package(Resolved QUIET)
  message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
endforeach()

set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF)
foreach(path "/does_not_exist" "/PackageRoot" "")
  unset(Resolved_FOUND CACHE)
  set(Resolved_DIR "")
  set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}")
  find_package(Resolved QUIET)
  message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
endforeach()

set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ON)
foreach(path "/does_not_exist" "/PackageRoot" "")
  unset(Resolved_FOUND CACHE)
  set(Resolved_DIR "")
  set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}")
  find_package(Resolved NO_SYSTEM_ENVIRONMENT_PATH QUIET)
  message(STATUS "Resolved_FOUND='${Resolved_FOUND}'")
endforeach()

set(ENV{CMAKE_PREFIX_PATH} "${ENV_CMAKE_PREFIX_PATH}")
set(ENV{PATH} "${ENV_PATH}")