Merge topic 'fix-find_dependency-empty-version'

a25b809f Tests: Check find_dependency empty extra arguments
9914e7cd Merge branch 'fix-find_dependency-empty-version'
34cd5fc4 find_dependency: Give more helpful message if VERSION is empty
d363cbf3 Tests: Make RunCMake.find_dependency tolerate line number changes
This commit is contained in:
Brad King 2014-03-14 09:30:23 -04:00 committed by CMake Topic Stage
commit 32b7d2ed8a
11 changed files with 30 additions and 5 deletions

View File

@ -31,14 +31,17 @@ macro(find_dependency dep)
if (NOT ${dep}_FOUND) if (NOT ${dep}_FOUND)
set(cmake_fd_version) set(cmake_fd_version)
if (${ARGC} GREATER 1) if (${ARGC} GREATER 1)
if (${ARGV1} STREQUAL EXACT) if ("${ARGV1}" STREQUAL "")
message(FATAL_ERROR "Invalid arguments to find_dependency. VERSION is empty")
endif()
if ("${ARGV1}" STREQUAL EXACT)
message(FATAL_ERROR "Invalid arguments to find_dependency. EXACT may only be specified if a VERSION is specified") message(FATAL_ERROR "Invalid arguments to find_dependency. EXACT may only be specified if a VERSION is specified")
endif() endif()
set(cmake_fd_version ${ARGV1}) set(cmake_fd_version ${ARGV1})
endif() endif()
set(cmake_fd_exact_arg) set(cmake_fd_exact_arg)
if(${ARGC} GREATER 2) if(${ARGC} GREATER 2)
if (NOT ${ARGV2} STREQUAL EXACT) if (NOT "${ARGV2}" STREQUAL EXACT)
message(FATAL_ERROR "Invalid arguments to find_dependency") message(FATAL_ERROR "Invalid arguments to find_dependency")
endif() endif()
set(cmake_fd_exact_arg EXACT) set(cmake_fd_exact_arg EXACT)

View File

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

View File

@ -1,5 +1,7 @@
include(RunCMake) include(RunCMake)
run_cmake(EXACT-no-version) run_cmake(EXACT-no-version)
run_cmake(empty-version)
run_cmake(empty-arg-3)
run_cmake(invalid-arg-3) run_cmake(invalid-arg-3)
run_cmake(extra-args) run_cmake(extra-args)

View File

@ -0,0 +1 @@
1

View File

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

View File

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

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,5 @@
CMake Error at .*/Modules/CMakeFindDependencyMacro.cmake:[0-9]+ \(message\):
Invalid arguments to find_dependency. VERSION is empty
Call Stack \(most recent call first\):
empty-version.cmake:4 \(find_dependency\)
CMakeLists.txt:4 \(include\)

View File

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

View File

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

View File

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