find_dependency: Extend the tests for use of EXACT macro parameter.

This commit is contained in:
Stephen Kelly 2014-03-06 15:06:22 +01:00
parent ad9f0d831e
commit 45abfb0c4d
8 changed files with 62 additions and 1 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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)

View File

@ -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()

View File

@ -0,0 +1,3 @@
add_library(Pack5::Lib INTERFACE IMPORTED)
set_property(TARGET Pack5::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK5)

View File

@ -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()

View File

@ -0,0 +1,3 @@
add_library(Pack6::Lib INTERFACE IMPORTED)
set_property(TARGET Pack6::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK6)

View File

@ -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()