Test error cases in find_dependency.

This commit is contained in:
Stephen Kelly 2014-03-11 14:36:58 +01:00
parent b801205dad
commit f74a8405b6
14 changed files with 54 additions and 0 deletions

View File

@ -49,6 +49,7 @@ add_RunCMake_test(GeneratorToolset)
add_RunCMake_test(TargetPropertyGeneratorExpressions) add_RunCMake_test(TargetPropertyGeneratorExpressions)
add_RunCMake_test(Languages) add_RunCMake_test(Languages)
add_RunCMake_test(ObjectLibrary) add_RunCMake_test(ObjectLibrary)
add_RunCMake_test(find_dependency)
if(NOT WIN32) if(NOT WIN32)
add_RunCMake_test(PositionIndependentCode) add_RunCMake_test(PositionIndependentCode)
set(SKIP_VISIBILITY 0) set(SKIP_VISIBILITY 0)

View File

@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 2.8.4)
project(${RunCMake_TEST} NONE)
set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
include(${RunCMake_TEST}.cmake)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,6 @@
CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:35 \(message\):
Invalid arguments to find_dependency. EXACT may only be specified if a
VERSION is specified
Call Stack \(most recent call first\):
EXACT-no-version.cmake:4 \(find_dependency\)
CMakeLists.txt:4 \(include\)

View File

@ -0,0 +1,4 @@
include(CMakeFindDependencyMacro)
find_dependency(Pack1 EXACT)

View File

@ -0,0 +1,2 @@
add_library(Pack1::Lib INTERFACE IMPORTED)

View File

@ -0,0 +1,11 @@
set(PACKAGE_VERSION "1.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,5 @@
include(RunCMake)
run_cmake(EXACT-no-version)
run_cmake(invalid-arg-3)
run_cmake(extra-args)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,5 @@
CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:47 \(message\):
Invalid arguments to find_dependency
Call Stack \(most recent call first\):
extra-args.cmake:4 \(find_dependency\)
CMakeLists.txt:4 \(include\)

View File

@ -0,0 +1,4 @@
include(CMakeFindDependencyMacro)
find_dependency(Pack1 1.2 EXACT PATHS "${CMAKE_BINARY_DIR}")

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,5 @@
CMake Error at .*Modules/CMakeFindDependencyMacro.cmake:42 \(message\):
Invalid arguments to find_dependency
Call Stack \(most recent call first\):
invalid-arg-3.cmake:4 \(find_dependency\)
CMakeLists.txt:4 \(include\)

View File

@ -0,0 +1,4 @@
include(CMakeFindDependencyMacro)
find_dependency(Pack1 1.2 EXACTYPO)