find_dependency: Extend the tests for use of EXACT macro parameter.
This commit is contained in:
parent
ad9f0d831e
commit
45abfb0c4d
|
@ -5,6 +5,7 @@ project(FindDependency)
|
|||
set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/packages")
|
||||
|
||||
find_package(Pack1 REQUIRED)
|
||||
find_package(Pack4 4.3 EXACT REQUIRED)
|
||||
|
||||
add_executable(FindDependency main.cpp)
|
||||
target_link_libraries(FindDependency Pack1::Lib)
|
||||
target_link_libraries(FindDependency Pack1::Lib Pack4::Lib)
|
||||
|
|
|
@ -11,6 +11,18 @@
|
|||
#error Expected HAVE_PACK3
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PACK4
|
||||
#error Expected HAVE_PACK4
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PACK5
|
||||
#error Expected HAVE_PACK5
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_PACK6
|
||||
#error Expected HAVE_PACK6
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
find_dependency(Pack5 3.1) # Actual version is 3.3. EXACT not propagated.
|
||||
find_dependency(Pack6 5.5 EXACT)
|
||||
|
||||
add_library(Pack4::Lib INTERFACE IMPORTED)
|
||||
set_property(TARGET Pack4::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK4)
|
||||
set_property(TARGET Pack4::Lib PROPERTY INTERFACE_LINK_LIBRARIES Pack5::Lib Pack6::Lib)
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
set(PACKAGE_VERSION "4.3")
|
||||
|
||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
add_library(Pack5::Lib INTERFACE IMPORTED)
|
||||
set_property(TARGET Pack5::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK5)
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
set(PACKAGE_VERSION "3.3")
|
||||
|
||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
add_library(Pack6::Lib INTERFACE IMPORTED)
|
||||
set_property(TARGET Pack6::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK6)
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
set(PACKAGE_VERSION "5.5")
|
||||
|
||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
Loading…
Reference in New Issue