diff options
author | Brad King <brad.king@kitware.com> | 2008-01-17 14:06:36 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2008-01-17 14:06:36 (GMT) |
commit | 81af53e3c0b00005d2cf81a4a5482474573dd4b1 (patch) | |
tree | b3903b457743dddcc46a174f5951231e90099efe | |
parent | b424df917dc14ea7376940c6c22a3a274aedcc2b (diff) | |
download | CMake-81af53e3c0b00005d2cf81a4a5482474573dd4b1.zip CMake-81af53e3c0b00005d2cf81a4a5482474573dd4b1.tar.gz CMake-81af53e3c0b00005d2cf81a4a5482474573dd4b1.tar.bz2 |
ENH: Updated FindPackageTest to test new find_package command features.
11 files changed, 70 insertions, 0 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 922354c..5d21fee 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -22,3 +22,62 @@ IF(NOT FOO_DIR) CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}") ENDIF(NOT FOO_DIR) +#SET(CMAKE_FIND_DEBUG_MODE 1) + +# For purposes of the test wipe out previous find results. +SET(PACKAGES foo Foo Bar TFramework Tframework TApp Tapp Special) +FOREACH(p ${PACKAGES}) + SET(${p}_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE) +ENDFOREACH(p) + +# Enable framework and bundle searching. Make sure bundles are found +# before unix-syle packages. +SET(CMAKE_FIND_FRAMEWORK LAST) +SET(CMAKE_FIND_APPBUNDLE FIRST) + +# Look for packages with new-style signatures. +FIND_PACKAGE(foo NO_MODULE) +FIND_PACKAGE(Foo CONFIGS FooConfig.cmake) +FIND_PACKAGE(Bar) +FIND_PACKAGE(TFramework CONFIGS TFrameworkConfig.cmake) +FIND_PACKAGE(Tframework) +FIND_PACKAGE(TApp) +FIND_PACKAGE(Tapp CONFIGS tapp-config.cmake) +FIND_PACKAGE(Special NAMES Suffix SuffixTest PATH_SUFFIXES test) + +# Expected locations at which packages should be found. +SET(foo_EXPECTED "lib/foo-1.2/foo-config.cmake") +SET(Foo_EXPECTED "lib/foo-1.2/CMake/FooConfig.cmake") +SET(Bar_EXPECTED "lib/Bar/BarConfig.cmake") +SET(Special_EXPECTED "lib/suffix/test/SuffixTestConfig.cmake") +SET(TFramework_EXPECTED + "TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake") +SET(Tframework_EXPECTED + "TFramework.framework/Versions/A/Resources/tframework-config.cmake") +SET(TApp_EXPECTED + "TApp.app/Contents/Resources/TAppConfig.cmake") +SET(Tapp_EXPECTED + "TApp.app/Contents/Resources/cmake/tapp-config.cmake") + +# Check the results. +FOREACH(p ${PACKAGES}) + IF(${p}_FOUND) + # Convert to relative path for comparison to expected location. + FILE(RELATIVE_PATH REL_${p}_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}" + "${${p}_CONFIG}") + + # Debugging output. + IF(CMAKE_FIND_DEBUG_MODE) + MESSAGE("Package ${p} found [${REL_${p}_CONFIG}]") + ENDIF(CMAKE_FIND_DEBUG_MODE) + + # Check and report failure. + IF(NOT "${REL_${p}_CONFIG}" STREQUAL "${${p}_EXPECTED}") + MESSAGE(SEND_ERROR + "Package ${p} should have been [${${p}_EXPECTED}] but " + "was [${REL_${p}_CONFIG}]") + ENDIF(NOT "${REL_${p}_CONFIG}" STREQUAL "${${p}_EXPECTED}") + ELSE(${p}_FOUND) + MESSAGE(SEND_ERROR "Package ${p} not found!") + ENDIF(${p}_FOUND) +ENDFOREACH(p) diff --git a/Tests/FindPackageTest/TApp.app/Contents/Resources/TAppConfig.cmake b/Tests/FindPackageTest/TApp.app/Contents/Resources/TAppConfig.cmake new file mode 100644 index 0000000..deffa57 --- /dev/null +++ b/Tests/FindPackageTest/TApp.app/Contents/Resources/TAppConfig.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/TApp.app/Contents/Resources/cmake/tapp-config.cmake b/Tests/FindPackageTest/TApp.app/Contents/Resources/cmake/tapp-config.cmake new file mode 100644 index 0000000..deffa57 --- /dev/null +++ b/Tests/FindPackageTest/TApp.app/Contents/Resources/cmake/tapp-config.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake b/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake new file mode 100644 index 0000000..deffa57 --- /dev/null +++ b/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/tframework-config.cmake b/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/tframework-config.cmake new file mode 100644 index 0000000..deffa57 --- /dev/null +++ b/Tests/FindPackageTest/TFramework.framework/Versions/A/Resources/tframework-config.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/lib/Bar/BarConfig.cmake b/Tests/FindPackageTest/lib/Bar/BarConfig.cmake new file mode 100644 index 0000000..deffa57 --- /dev/null +++ b/Tests/FindPackageTest/lib/Bar/BarConfig.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/lib/Bar/cmake/bar-config.cmake b/Tests/FindPackageTest/lib/Bar/cmake/bar-config.cmake new file mode 100644 index 0000000..deffa57 --- /dev/null +++ b/Tests/FindPackageTest/lib/Bar/cmake/bar-config.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/lib/TApp/TAppConfig.cmake b/Tests/FindPackageTest/lib/TApp/TAppConfig.cmake new file mode 100644 index 0000000..cbf0603 --- /dev/null +++ b/Tests/FindPackageTest/lib/TApp/TAppConfig.cmake @@ -0,0 +1,2 @@ +# Test config file that should not be found. +MESSAGE("Package TApp found non-bundle first!") diff --git a/Tests/FindPackageTest/lib/foo-1.2/CMake/FooConfig.cmake b/Tests/FindPackageTest/lib/foo-1.2/CMake/FooConfig.cmake new file mode 100644 index 0000000..deffa57 --- /dev/null +++ b/Tests/FindPackageTest/lib/foo-1.2/CMake/FooConfig.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/lib/foo-1.2/foo-config.cmake b/Tests/FindPackageTest/lib/foo-1.2/foo-config.cmake new file mode 100644 index 0000000..deffa57 --- /dev/null +++ b/Tests/FindPackageTest/lib/foo-1.2/foo-config.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfig.cmake b/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfig.cmake new file mode 100644 index 0000000..deffa57 --- /dev/null +++ b/Tests/FindPackageTest/lib/suffix/test/SuffixTestConfig.cmake @@ -0,0 +1 @@ +# Test config file. |