diff options
Diffstat (limited to 'Tests/FindPackageTest')
5 files changed, 52 insertions, 0 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 04bbbc6..1a6f204 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -633,3 +633,33 @@ endif() if(PACKAGE_VERSION_UNSUITABLE) message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !") endif() + + +############################################################################ +##Test FIND_PACKAGE using sorting +set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}) +SET(CMAKE_FIND_PACKAGE_SORT_ORDER NAME) +SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION ASC) + +set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE) +FIND_PACKAGE(SortLib CONFIG) +IF (NOT "${SortLib_VERSION}" STREQUAL "3.1.1") + message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Name Asc! ${SortLib_VERSION}") +endif() +unset(SortLib_VERSION) + + +set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE) +SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL) +SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC) +FIND_PACKAGE(SortLib CONFIG) +IF (NOT "${SortLib_VERSION}" STREQUAL "3.10.1") + message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Natural! Dec ${SortLib_VERSION}") +endif() +set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE) +unset(SortLib_VERSION) + + +unset(CMAKE_FIND_PACKAGE_SORT_ORDER) +unset(CMAKE_FIND_PACKAGE_SORT_DIRECTION) +set(CMAKE_PREFIX_PATH ) diff --git a/Tests/FindPackageTest/SortLib-3.1.1/SortLibConfig.cmake b/Tests/FindPackageTest/SortLib-3.1.1/SortLibConfig.cmake new file mode 100644 index 0000000..c1f2088 --- /dev/null +++ b/Tests/FindPackageTest/SortLib-3.1.1/SortLibConfig.cmake @@ -0,0 +1,2 @@ +set(SORT_LIB_VERSION 3.1.1) +message("SortLib 3.1.1 config reached") diff --git a/Tests/FindPackageTest/SortLib-3.1.1/SortLibConfigVersion.cmake b/Tests/FindPackageTest/SortLib-3.1.1/SortLibConfigVersion.cmake new file mode 100644 index 0000000..fa927c7 --- /dev/null +++ b/Tests/FindPackageTest/SortLib-3.1.1/SortLibConfigVersion.cmake @@ -0,0 +1,9 @@ +set(PACKAGE_VERSION 3.1.1) +if(PACKAGE_FIND_VERSION_MAJOR EQUAL 3) + if(PACKAGE_FIND_VERSION_MINOR EQUAL 1) + set(PACKAGE_VERSION_COMPATIBLE 1) + if(PACKAGE_FIND_VERSION_PATCH EQUAL 1) + set(PACKAGE_VERSION_EXACT 1) + endif() + endif() +endif() diff --git a/Tests/FindPackageTest/SortLib-3.10.1/SortLibConfig.cmake b/Tests/FindPackageTest/SortLib-3.10.1/SortLibConfig.cmake new file mode 100644 index 0000000..3f3f659 --- /dev/null +++ b/Tests/FindPackageTest/SortLib-3.10.1/SortLibConfig.cmake @@ -0,0 +1,2 @@ +set(SORT_LIB_VERSION 3.10.1) +message("SortLib 3.10.1 config reached") diff --git a/Tests/FindPackageTest/SortLib-3.10.1/SortLibConfigVersion.cmake b/Tests/FindPackageTest/SortLib-3.10.1/SortLibConfigVersion.cmake new file mode 100644 index 0000000..6f44c2d --- /dev/null +++ b/Tests/FindPackageTest/SortLib-3.10.1/SortLibConfigVersion.cmake @@ -0,0 +1,9 @@ +set(PACKAGE_VERSION 3.10.1) +if(PACKAGE_FIND_VERSION_MAJOR EQUAL 3) + if(PACKAGE_FIND_VERSION_MINOR EQUAL 10) + set(PACKAGE_VERSION_COMPATIBLE 1) + if(PACKAGE_FIND_VERSION_PATCH EQUAL 1) + set(PACKAGE_VERSION_EXACT 1) + endif() + endif() +endif() |