Commit e574bce1 authored by Brad King's avatar Brad King
Browse files

Tests: Simplify RunCMake.find_package PackageRoot case regexes

parent 4a207116
......@@ -10,34 +10,34 @@ FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND
FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
----------
Foo_ROOT :.*/PackageRoot/foo/cmake_root
Foo_ROOT :<base>/foo/cmake_root
ENV{Foo_ROOT} :
find_package\(Foo\)
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
----------
Foo_ROOT :
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
ENV{Foo_ROOT} :<base>/foo/env_root
find_package\(Foo\)
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/env_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/env_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
FOO_TEST_FILE_FOO :<base>/foo/env_root/include/foo.h
FOO_TEST_FILE_ZOT :<base>/foo/env_root/include/zot/zot.h
FOO_TEST_PATH_FOO :<base>/foo/env_root/include
FOO_TEST_PATH_ZOT :<base>/foo/env_root/include/zot
FOO_TEST_PROG_FOO :<base>/foo/env_root/bin/foo.exe
----------
Foo_ROOT :.*/PackageRoot/foo/cmake_root
ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
Foo_ROOT :<base>/foo/cmake_root
ENV{Foo_ROOT} :<base>/foo/env_root
find_package\(Foo\)
FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
FOO_TEST_FILE_FOO :<base>/foo/cmake_root/include/foo.h
FOO_TEST_FILE_ZOT :<base>/foo/cmake_root/include/zot/zot.h
FOO_TEST_PATH_FOO :<base>/foo/cmake_root/include
FOO_TEST_PATH_ZOT :<base>/foo/cmake_root/include/zot
FOO_TEST_PROG_FOO :<base>/foo/cmake_root/bin/foo.exe
......@@ -2,6 +2,11 @@ cmake_policy(SET CMP0057 NEW)
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
function(PrintPath label path)
string(REPLACE "${PackageRoot_BASE}" "<base>" out "${path}")
message("${label}${out}")
endfunction()
macro(CleanUpPackageRootTest)
unset(Foo_ROOT)
unset(ENV{Foo_ROOT})
......@@ -19,17 +24,17 @@ endmacro()
macro(RunPackageRootTest)
message("----------")
message("Foo_ROOT :${Foo_ROOT}")
message("ENV{Foo_ROOT} :$ENV{Foo_ROOT}")
PrintPath("Foo_ROOT :" "${Foo_ROOT}")
PrintPath("ENV{Foo_ROOT} :" "$ENV{Foo_ROOT}")
message("")
find_package(Foo)
message("find_package(Foo)")
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}")
PrintPath("FOO_TEST_FILE_FOO :" "${FOO_TEST_FILE_FOO}")
PrintPath("FOO_TEST_FILE_ZOT :" "${FOO_TEST_FILE_ZOT}")
PrintPath("FOO_TEST_PATH_FOO :" "${FOO_TEST_PATH_FOO}")
PrintPath("FOO_TEST_PATH_ZOT :" "${FOO_TEST_PATH_ZOT}")
PrintPath("FOO_TEST_PROG_FOO :" "${FOO_TEST_PROG_FOO}")
CleanUpPackageRootTest()
message("")
endmacro()
......
......@@ -2,6 +2,11 @@ cmake_policy(SET CMP0057 NEW)
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
function(PrintPath label path)
string(REPLACE "${PackageRoot_BASE}" "<base>" out "${path}")
message("${label}${out}")
endfunction()
macro(CleanUpPackageRootTest)
unset(Foo_ROOT)
unset(ENV{Foo_ROOT})
......@@ -41,29 +46,29 @@ 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}")
PrintPath("Foo_ROOT :" "${Foo_ROOT}")
PrintPath("ENV{Foo_ROOT} :" "$ENV{Foo_ROOT}")
PrintPath("Bar_DIR :" "${Bar_DIR}")
PrintPath("Bar_ROOT :" "${Bar_ROOT}")
PrintPath("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}")
PrintPath("FOO_TEST_FILE_FOO :" "${FOO_TEST_FILE_FOO}")
PrintPath("FOO_TEST_FILE_ZOT :" "${FOO_TEST_FILE_ZOT}")
PrintPath("FOO_TEST_PATH_FOO :" "${FOO_TEST_PATH_FOO}")
PrintPath("FOO_TEST_PATH_ZOT :" "${FOO_TEST_PATH_ZOT}")
PrintPath("FOO_TEST_PROG_FOO :" "${FOO_TEST_PROG_FOO}")
PrintPath("BAR_CMAKE_FILE :" "${BAR_CMAKE_FILE}")
PrintPath("BAR_TEST_FILE_FOO :" "${BAR_TEST_FILE_FOO}")
PrintPath("BAR_TEST_FILE_BAR :" "${BAR_TEST_FILE_BAR}")
PrintPath("BAR_TEST_FILE_ZOT :" "${BAR_TEST_FILE_ZOT}")
PrintPath("BAR_TEST_PATH_FOO :" "${BAR_TEST_PATH_FOO}")
PrintPath("BAR_TEST_PATH_BAR :" "${BAR_TEST_PATH_BAR}")
PrintPath("BAR_TEST_PATH_ZOT :" "${BAR_TEST_PATH_ZOT}")
PrintPath("BAR_TEST_PROG_FOO :" "${BAR_TEST_PROG_FOO}")
PrintPath("BAR_TEST_PROG_BAR :" "${BAR_TEST_PROG_BAR}")
CleanUpPackageRootTest()
message("")
endmacro()
......
......@@ -2,6 +2,11 @@ cmake_policy(SET CMP0057 NEW)
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot)
function(PrintPath label path)
string(REPLACE "${PackageRoot_BASE}" "<base>" out "${path}")
message("${label}${out}")
endfunction()
macro(CleanUpPackageRootTest)
unset(Foo_ROOT)
unset(ENV{Foo_ROOT})
......@@ -41,29 +46,29 @@ 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}")
PrintPath("Foo_ROOT :" "${Foo_ROOT}")
PrintPath("ENV{Foo_ROOT} :" "$ENV{Foo_ROOT}")
PrintPath("Bar_DIR :" "${Bar_DIR}")
PrintPath("Bar_ROOT :" "${Bar_ROOT}")
PrintPath("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}")
PrintPath("FOO_TEST_FILE_FOO :" "${FOO_TEST_FILE_FOO}")
PrintPath("FOO_TEST_FILE_ZOT :" "${FOO_TEST_FILE_ZOT}")
PrintPath("FOO_TEST_PATH_FOO :" "${FOO_TEST_PATH_FOO}")
PrintPath("FOO_TEST_PATH_ZOT :" "${FOO_TEST_PATH_ZOT}")
PrintPath("FOO_TEST_PROG_FOO :" "${FOO_TEST_PROG_FOO}")
PrintPath("BAR_CMAKE_FILE :" "${BAR_CMAKE_FILE}")
PrintPath("BAR_TEST_FILE_FOO :" "${BAR_TEST_FILE_FOO}")
PrintPath("BAR_TEST_FILE_BAR :" "${BAR_TEST_FILE_BAR}")
PrintPath("BAR_TEST_FILE_ZOT :" "${BAR_TEST_FILE_ZOT}")
PrintPath("BAR_TEST_PATH_FOO :" "${BAR_TEST_PATH_FOO}")
PrintPath("BAR_TEST_PATH_BAR :" "${BAR_TEST_PATH_BAR}")
PrintPath("BAR_TEST_PATH_ZOT :" "${BAR_TEST_PATH_ZOT}")
PrintPath("BAR_TEST_PROG_FOO :" "${BAR_TEST_PROG_FOO}")
PrintPath("BAR_TEST_PROG_BAR :" "${BAR_TEST_PROG_BAR}")
CleanUpPackageRootTest()
message("")
endmacro()
......
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