summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CMakeFindDependencyMacro.cmake7
-rw-r--r--Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt2
-rw-r--r--Tests/RunCMake/find_dependency/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/find_dependency/empty-arg-3-result.txt1
-rw-r--r--Tests/RunCMake/find_dependency/empty-arg-3-stderr.txt5
-rw-r--r--Tests/RunCMake/find_dependency/empty-arg-3.cmake4
-rw-r--r--Tests/RunCMake/find_dependency/empty-version-result.txt1
-rw-r--r--Tests/RunCMake/find_dependency/empty-version-stderr.txt5
-rw-r--r--Tests/RunCMake/find_dependency/empty-version.cmake4
-rw-r--r--Tests/RunCMake/find_dependency/extra-args-stderr.txt2
-rw-r--r--Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt2
11 files changed, 30 insertions, 5 deletions
diff --git a/Modules/CMakeFindDependencyMacro.cmake b/Modules/CMakeFindDependencyMacro.cmake
index 99ffca8..73efaae 100644
--- a/Modules/CMakeFindDependencyMacro.cmake
+++ b/Modules/CMakeFindDependencyMacro.cmake
@@ -31,14 +31,17 @@ macro(find_dependency dep)
if (NOT ${dep}_FOUND)
set(cmake_fd_version)
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")
endif()
set(cmake_fd_version ${ARGV1})
endif()
set(cmake_fd_exact_arg)
if(${ARGC} GREATER 2)
- if (NOT ${ARGV2} STREQUAL EXACT)
+ if (NOT "${ARGV2}" STREQUAL EXACT)
message(FATAL_ERROR "Invalid arguments to find_dependency")
endif()
set(cmake_fd_exact_arg EXACT)
diff --git a/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt b/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt
index 6f4fc04..348f8bb 100644
--- a/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt
+++ b/Tests/RunCMake/find_dependency/EXACT-no-version-stderr.txt
@@ -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
VERSION is specified
Call Stack \(most recent call first\):
diff --git a/Tests/RunCMake/find_dependency/RunCMakeTest.cmake b/Tests/RunCMake/find_dependency/RunCMakeTest.cmake
index b85104a..9403136 100644
--- a/Tests/RunCMake/find_dependency/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_dependency/RunCMakeTest.cmake
@@ -1,5 +1,7 @@
include(RunCMake)
run_cmake(EXACT-no-version)
+run_cmake(empty-version)
+run_cmake(empty-arg-3)
run_cmake(invalid-arg-3)
run_cmake(extra-args)
diff --git a/Tests/RunCMake/find_dependency/empty-arg-3-result.txt b/Tests/RunCMake/find_dependency/empty-arg-3-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/find_dependency/empty-arg-3-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_dependency/empty-arg-3-stderr.txt b/Tests/RunCMake/find_dependency/empty-arg-3-stderr.txt
new file mode 100644
index 0000000..bf9b02b
--- /dev/null
+++ b/Tests/RunCMake/find_dependency/empty-arg-3-stderr.txt
@@ -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\)
diff --git a/Tests/RunCMake/find_dependency/empty-arg-3.cmake b/Tests/RunCMake/find_dependency/empty-arg-3.cmake
new file mode 100644
index 0000000..b08200a
--- /dev/null
+++ b/Tests/RunCMake/find_dependency/empty-arg-3.cmake
@@ -0,0 +1,4 @@
+
+include(CMakeFindDependencyMacro)
+
+find_dependency(Pack1 1.2 "")
diff --git a/Tests/RunCMake/find_dependency/empty-version-result.txt b/Tests/RunCMake/find_dependency/empty-version-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/find_dependency/empty-version-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/find_dependency/empty-version-stderr.txt b/Tests/RunCMake/find_dependency/empty-version-stderr.txt
new file mode 100644
index 0000000..b5e9f46
--- /dev/null
+++ b/Tests/RunCMake/find_dependency/empty-version-stderr.txt
@@ -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\)
diff --git a/Tests/RunCMake/find_dependency/empty-version.cmake b/Tests/RunCMake/find_dependency/empty-version.cmake
new file mode 100644
index 0000000..e6f17cd
--- /dev/null
+++ b/Tests/RunCMake/find_dependency/empty-version.cmake
@@ -0,0 +1,4 @@
+
+include(CMakeFindDependencyMacro)
+
+find_dependency(Pack1 "")
diff --git a/Tests/RunCMake/find_dependency/extra-args-stderr.txt b/Tests/RunCMake/find_dependency/extra-args-stderr.txt
index 1b52380..83a7f02 100644
--- a/Tests/RunCMake/find_dependency/extra-args-stderr.txt
+++ b/Tests/RunCMake/find_dependency/extra-args-stderr.txt
@@ -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
Call Stack \(most recent call first\):
extra-args.cmake:4 \(find_dependency\)
diff --git a/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt b/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt
index c36148f..fee8d5d 100644
--- a/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt
+++ b/Tests/RunCMake/find_dependency/invalid-arg-3-stderr.txt
@@ -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
Call Stack \(most recent call first\):
invalid-arg-3.cmake:4 \(find_dependency\)