CMake/Tests/RunCMake/find_package-CPS/CustomVersion.cmake
Matthew Woehlke 3e6466eb16 find_package: Honor version requests when finding CPS packages
Teach find_package to check a CPS package's version (when provided)
against a version request given to the find_package invocation.
2025-02-12 11:36:41 -05:00

14 lines
453 B
CMake

cmake_minimum_required(VERSION 4.0)
include(Setup.cmake)
set(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
set(CMAKE_FIND_PACKAGE_SORT_DIRECTION ASC)
###############################################################################
# Test finding a package that uses the "custom" version schema.
find_package(CustomVersion 42 REQUIRED)
if(NOT CustomVersion_VERSION EQUAL 42)
message(SEND_ERROR "CustomVersion wrong version ${CustomVersion_VERSION} !")
endif()