Some CMake packages fail to find at all if no version is specified. This commit adds a cmake_version parameter to dependency() to allow you to specify the requested version.pull/8014/head
parent
9dab27f814
commit
15bbf1ea75
9 changed files with 56 additions and 5 deletions
@ -0,0 +1,5 @@ |
||||
## CMake find_package version support |
||||
|
||||
It is now possible to specify a requested package version to the CMake |
||||
dependency backend via the new `cmake_package_version` kwarg in the |
||||
`dependency` function. |
@ -0,0 +1,9 @@ |
||||
find_package(ZLIB) |
||||
|
||||
if(ZLIB_FOUND OR ZLIB_Found) |
||||
set(cmMesonVersionedTestDep_FOUND ON) |
||||
set(cmMesonVersionedTestDep_LIBRARIES ${ZLIB_LIBRARY}) |
||||
set(cmMesonVersionedTestDep_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) |
||||
else() |
||||
set(cmMesonVersionedTestDep_FOUND OFF) |
||||
endif() |
@ -0,0 +1,12 @@ |
||||
set(PACKAGE_VERSION 3.1.4) |
||||
|
||||
if (${PACKAGE_FIND_VERSION_MAJOR} EQUAL 3) |
||||
if (${PACKAGE_FIND_VERSION} VERSION_LESS 3.1.4) |
||||
set(PACKAGE_VERSION_COMPATIBLE 1) |
||||
endif() |
||||
if (${PACKAGE_FIND_VERSION} VERSION_EQUAL 3.1.4) |
||||
set(PACKAGE_VERSION_EXACT 1) |
||||
endif() |
||||
else() |
||||
set(PACKAGE_VERSION_UNSUITABLE 1) |
||||
endif() |
Loading…
Reference in new issue