Commit 4a207116 authored by Chuck Atkins's avatar Chuck Atkins

find_package: Split PACKAGE_ROOT tests to work with smaller regex

parent 9722ff5a
......@@ -5,55 +5,24 @@ set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
macro(CleanUpPackageRootTest)
unset(Foo_ROOT)
unset(ENV{Foo_ROOT})
unset(Bar_DIR)
unset(BAR_CMAKE_FILE)
unset(Bar_ROOT)
unset(ENV{Bar_ROOT})
unset(FOO_TEST_FILE_FOO)
unset(FOO_TEST_FILE_ZOT)
unset(FOO_TEST_PATH_FOO)
unset(FOO_TEST_PATH_ZOT)
unset(FOO_TEST_PROG_FOO)
unset(BAR_TEST_FILE_FOO)
unset(BAR_TEST_FILE_BAR)
unset(BAR_TEST_FILE_ZOT)
unset(BAR_TEST_PATH_FOO)
unset(BAR_TEST_PATH_BAR)
unset(BAR_TEST_PATH_ZOT)
unset(BAR_TEST_PROG_FOO)
unset(BAR_TEST_PROG_BAR)
unset(Bar_DIR CACHE)
unset(BAR_CMAKE_FILE CACHE)
unset(FOO_TEST_FILE_FOO CACHE)
unset(FOO_TEST_FILE_ZOT CACHE)
unset(FOO_TEST_PATH_FOO CACHE)
unset(FOO_TEST_PATH_ZOT CACHE)
unset(FOO_TEST_PROG_FOO CACHE)
unset(BAR_TEST_FILE_FOO CACHE)
unset(BAR_TEST_FILE_BAR CACHE)
unset(BAR_TEST_FILE_ZOT CACHE)
unset(BAR_TEST_PATH_FOO CACHE)
unset(BAR_TEST_PATH_BAR CACHE)
unset(BAR_TEST_PATH_ZOT CACHE)
unset(BAR_TEST_PROG_FOO CACHE)
unset(BAR_TEST_PROG_BAR CACHE)
endmacro()
macro(RunPackageRootTest)
message("----------")
message("Foo_ROOT :${Foo_ROOT}")
message("ENV{Foo_ROOT} :$ENV{Foo_ROOT}")
message("Bar_DIR :${Bar_DIR}")
message("Bar_ROOT :${Bar_ROOT}")
message("ENV{Bar_ROOT} :$ENV{Bar_ROOT}")
message("")
set(orig_bar_dir ${Bar_DIR})
set(orig_foo_cmake_root ${Foo_ROOT})
set(orig_foo_env_root $ENV{Foo_ROOT})
set(orig_bar_cmake_root ${Bar_ROOT})
set(orig_bar_env_root $ENV{Bar_ROOT})
find_package(Foo)
message("find_package(Foo)")
message("FOO_TEST_FILE_FOO :${FOO_TEST_FILE_FOO}")
......@@ -63,135 +32,16 @@ macro(RunPackageRootTest)
message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}")
CleanUpPackageRootTest()
message("")
set(Foo_ROOT ${orig_foo_cmake_root})
set(ENV{Foo_ROOT} ${orig_foo_env_root})
set(Bar_ROOT ${orig_bar_cmake_root})
set(ENV{Bar_ROOT} ${orig_bar_env_root})
find_package(Foo COMPONENTS BarModule)
message("find_package(Foo COMPONENTS BarModule)")
message("FOO_TEST_FILE_FOO :${FOO_TEST_FILE_FOO}")
message("FOO_TEST_FILE_ZOT :${FOO_TEST_FILE_ZOT}")
message("FOO_TEST_PATH_FOO :${FOO_TEST_PATH_FOO}")
message("FOO_TEST_PATH_ZOT :${FOO_TEST_PATH_ZOT}")
message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}")
message("BAR_CMAKE_FILE :${BAR_CMAKE_FILE}")
message("BAR_TEST_FILE_FOO :${BAR_TEST_FILE_FOO}")
message("BAR_TEST_FILE_BAR :${BAR_TEST_FILE_BAR}")
message("BAR_TEST_FILE_ZOT :${BAR_TEST_FILE_ZOT}")
message("BAR_TEST_PATH_FOO :${BAR_TEST_PATH_FOO}")
message("BAR_TEST_PATH_BAR :${BAR_TEST_PATH_BAR}")
message("BAR_TEST_PATH_ZOT :${BAR_TEST_PATH_ZOT}")
message("BAR_TEST_PROG_FOO :${BAR_TEST_PROG_FOO}")
message("BAR_TEST_PROG_BAR :${BAR_TEST_PROG_BAR}")
CleanUpPackageRootTest()
message("")
set(Bar_DIR ${orig_bar_dir})
set(Foo_ROOT ${orig_foo_cmake_root})
set(ENV{Foo_ROOT} ${orig_foo_env_root})
set(Bar_ROOT ${orig_bar_cmake_root})
set(ENV{Bar_ROOT} ${orig_bar_env_root})
find_package(Foo COMPONENTS BarConfig)
message("find_package(Foo COMPONENTS BarConfig)")
message("FOO_TEST_FILE_FOO :${FOO_TEST_FILE_FOO}")
message("FOO_TEST_FILE_ZOT :${FOO_TEST_FILE_ZOT}")
message("FOO_TEST_PATH_FOO :${FOO_TEST_PATH_FOO}")
message("FOO_TEST_PATH_ZOT :${FOO_TEST_PATH_ZOT}")
message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}")
message("BAR_CMAKE_FILE :${BAR_CMAKE_FILE}")
message("BAR_TEST_FILE_FOO :${BAR_TEST_FILE_FOO}")
message("BAR_TEST_FILE_BAR :${BAR_TEST_FILE_BAR}")
message("BAR_TEST_FILE_ZOT :${BAR_TEST_FILE_ZOT}")
message("BAR_TEST_PATH_FOO :${BAR_TEST_PATH_FOO}")
message("BAR_TEST_PATH_BAR :${BAR_TEST_PATH_BAR}")
message("BAR_TEST_PATH_ZOT :${BAR_TEST_PATH_ZOT}")
message("BAR_TEST_PROG_FOO :${BAR_TEST_PROG_FOO}")
message("BAR_TEST_PROG_BAR :${BAR_TEST_PROG_BAR}")
CleanUpPackageRootTest()
message("")
unset(orig_bar_dir)
unset(orig_foo_cmake_root)
unset(orig_foo_env_root)
unset(orig_bar_cmake_root)
unset(orig_bar_env_root)
endmacro()
set(Bar_DIR ${PackageRoot_BASE})
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
RunPackageRootTest()
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
RunPackageRootTest()
##
set(Bar_DIR ${PackageRoot_BASE})
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
RunPackageRootTest()
set(Bar_DIR ${PackageRoot_BASE})
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(Bar_DIR ${PackageRoot_BASE})
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
##
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
RunPackageRootTest()
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
RunPackageRootTest()
##
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
##
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
This diff is collapsed.
cmake_policy(SET CMP0057 NEW)
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
macro(CleanUpPackageRootTest)
unset(Foo_ROOT)
unset(ENV{Foo_ROOT})
unset(Bar_DIR)
unset(BAR_CMAKE_FILE)
unset(Bar_ROOT)
unset(ENV{Bar_ROOT})
unset(FOO_TEST_FILE_FOO)
unset(FOO_TEST_FILE_ZOT)
unset(FOO_TEST_PATH_FOO)
unset(FOO_TEST_PATH_ZOT)
unset(FOO_TEST_PROG_FOO)
unset(BAR_TEST_FILE_FOO)
unset(BAR_TEST_FILE_BAR)
unset(BAR_TEST_FILE_ZOT)
unset(BAR_TEST_PATH_FOO)
unset(BAR_TEST_PATH_BAR)
unset(BAR_TEST_PATH_ZOT)
unset(BAR_TEST_PROG_FOO)
unset(BAR_TEST_PROG_BAR)
unset(Bar_DIR CACHE)
unset(BAR_CMAKE_FILE CACHE)
unset(FOO_TEST_FILE_FOO CACHE)
unset(FOO_TEST_FILE_ZOT CACHE)
unset(FOO_TEST_PATH_FOO CACHE)
unset(FOO_TEST_PATH_ZOT CACHE)
unset(FOO_TEST_PROG_FOO CACHE)
unset(BAR_TEST_FILE_FOO CACHE)
unset(BAR_TEST_FILE_BAR CACHE)
unset(BAR_TEST_FILE_ZOT CACHE)
unset(BAR_TEST_PATH_FOO CACHE)
unset(BAR_TEST_PATH_BAR CACHE)
unset(BAR_TEST_PATH_ZOT CACHE)
unset(BAR_TEST_PROG_FOO CACHE)
unset(BAR_TEST_PROG_BAR CACHE)
endmacro()
macro(RunPackageRootTest)
message("----------")
message("Foo_ROOT :${Foo_ROOT}")
message("ENV{Foo_ROOT} :$ENV{Foo_ROOT}")
message("Bar_DIR :${Bar_DIR}")
message("Bar_ROOT :${Bar_ROOT}")
message("ENV{Bar_ROOT} :$ENV{Bar_ROOT}")
message("")
find_package(Foo COMPONENTS BarConfig)
message("find_package(Foo COMPONENTS BarConfig)")
message("FOO_TEST_FILE_FOO :${FOO_TEST_FILE_FOO}")
message("FOO_TEST_FILE_ZOT :${FOO_TEST_FILE_ZOT}")
message("FOO_TEST_PATH_FOO :${FOO_TEST_PATH_FOO}")
message("FOO_TEST_PATH_ZOT :${FOO_TEST_PATH_ZOT}")
message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}")
message("BAR_CMAKE_FILE :${BAR_CMAKE_FILE}")
message("BAR_TEST_FILE_FOO :${BAR_TEST_FILE_FOO}")
message("BAR_TEST_FILE_BAR :${BAR_TEST_FILE_BAR}")
message("BAR_TEST_FILE_ZOT :${BAR_TEST_FILE_ZOT}")
message("BAR_TEST_PATH_FOO :${BAR_TEST_PATH_FOO}")
message("BAR_TEST_PATH_BAR :${BAR_TEST_PATH_BAR}")
message("BAR_TEST_PATH_ZOT :${BAR_TEST_PATH_ZOT}")
message("BAR_TEST_PROG_FOO :${BAR_TEST_PROG_FOO}")
message("BAR_TEST_PROG_BAR :${BAR_TEST_PROG_BAR}")
CleanUpPackageRootTest()
message("")
endmacro()
#
RunPackageRootTest()
#
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
#
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
#
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
This diff is collapsed.
cmake_policy(SET CMP0057 NEW)
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
macro(CleanUpPackageRootTest)
unset(Foo_ROOT)
unset(ENV{Foo_ROOT})
unset(Bar_DIR)
unset(BAR_CMAKE_FILE)
unset(Bar_ROOT)
unset(ENV{Bar_ROOT})
unset(FOO_TEST_FILE_FOO)
unset(FOO_TEST_FILE_ZOT)
unset(FOO_TEST_PATH_FOO)
unset(FOO_TEST_PATH_ZOT)
unset(FOO_TEST_PROG_FOO)
unset(BAR_TEST_FILE_FOO)
unset(BAR_TEST_FILE_BAR)
unset(BAR_TEST_FILE_ZOT)
unset(BAR_TEST_PATH_FOO)
unset(BAR_TEST_PATH_BAR)
unset(BAR_TEST_PATH_ZOT)
unset(BAR_TEST_PROG_FOO)
unset(BAR_TEST_PROG_BAR)
unset(Bar_DIR CACHE)
unset(BAR_CMAKE_FILE CACHE)
unset(FOO_TEST_FILE_FOO CACHE)
unset(FOO_TEST_FILE_ZOT CACHE)
unset(FOO_TEST_PATH_FOO CACHE)
unset(FOO_TEST_PATH_ZOT CACHE)
unset(FOO_TEST_PROG_FOO CACHE)
unset(BAR_TEST_FILE_FOO CACHE)
unset(BAR_TEST_FILE_BAR CACHE)
unset(BAR_TEST_FILE_ZOT CACHE)
unset(BAR_TEST_PATH_FOO CACHE)
unset(BAR_TEST_PATH_BAR CACHE)
unset(BAR_TEST_PATH_ZOT CACHE)
unset(BAR_TEST_PROG_FOO CACHE)
unset(BAR_TEST_PROG_BAR CACHE)
endmacro()
macro(RunPackageRootTest)
message("----------")
message("Foo_ROOT :${Foo_ROOT}")
message("ENV{Foo_ROOT} :$ENV{Foo_ROOT}")
message("Bar_DIR :${Bar_DIR}")
message("Bar_ROOT :${Bar_ROOT}")
message("ENV{Bar_ROOT} :$ENV{Bar_ROOT}")
message("")
find_package(Foo COMPONENTS BarModule)
message("find_package(Foo COMPONENTS BarModule)")
message("FOO_TEST_FILE_FOO :${FOO_TEST_FILE_FOO}")
message("FOO_TEST_FILE_ZOT :${FOO_TEST_FILE_ZOT}")
message("FOO_TEST_PATH_FOO :${FOO_TEST_PATH_FOO}")
message("FOO_TEST_PATH_ZOT :${FOO_TEST_PATH_ZOT}")
message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}")
message("BAR_CMAKE_FILE :${BAR_CMAKE_FILE}")
message("BAR_TEST_FILE_FOO :${BAR_TEST_FILE_FOO}")
message("BAR_TEST_FILE_BAR :${BAR_TEST_FILE_BAR}")
message("BAR_TEST_FILE_ZOT :${BAR_TEST_FILE_ZOT}")
message("BAR_TEST_PATH_FOO :${BAR_TEST_PATH_FOO}")
message("BAR_TEST_PATH_BAR :${BAR_TEST_PATH_BAR}")
message("BAR_TEST_PATH_ZOT :${BAR_TEST_PATH_ZOT}")
message("BAR_TEST_PROG_FOO :${BAR_TEST_PROG_FOO}")
message("BAR_TEST_PROG_BAR :${BAR_TEST_PROG_BAR}")
CleanUpPackageRootTest()
message("")
endmacro()
#
RunPackageRootTest()
#
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
#
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
#
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root)
set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/cmake_root)
set(Bar_ROOT ${PackageRoot_BASE}/bar/cmake_root)
set(ENV{Bar_ROOT} ${PackageRoot_BASE}/bar/env_root)
RunPackageRootTest()
......@@ -14,6 +14,8 @@ run_cmake(MissingConfigRequired)
run_cmake(MissingConfigVersion)
run_cmake(MixedModeOptions)
run_cmake(PackageRoot)
run_cmake(PackageRootNestedConfig)
run_cmake(PackageRootNestedModule)
run_cmake(PolicyPush)
run_cmake(PolicyPop)
run_cmake(SetFoundFALSE)
......
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