CMake/Tests/RunCMake/find_package-CPS/ExactVersion.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
457 B
CMake

cmake_minimum_required(VERSION 4.0)
include(Setup.cmake)
set(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
###############################################################################
# Test finding a package with multiple suitable versions (exact match).
find_package(Sample 1.1.0 EXACT REQUIRED)
if(NOT Sample_VERSION STREQUAL "1.1.0+asimov")
message(SEND_ERROR "Sample wrong version ${Sample_VERSION} !")
endif()