When find_dependency is called like this:

        find_dependency(Foo "")

CMake fails with:

CMake Error at 
/home/aurelien/opt/kf5/share/cmake-3.0/Modules/CMakeFindDependencyMacro.cmake:34
 
(if):
  if given arguments:

    "STREQUAL" "EXACT"

  Unknown arguments specified

Attached patch fixes this.

Aurélien
>From 5e03c4e6babd9730c46986f4b6643502a5626583 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20G=C3=A2teau?= <agat...@kde.org>
Date: Thu, 13 Mar 2014 10:36:24 +0100
Subject: [PATCH] Wrap ARGV1 and ARGV2 in quotes to avoid errors when they are
 empty

---
 Modules/CMakeFindDependencyMacro.cmake | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Modules/CMakeFindDependencyMacro.cmake b/Modules/CMakeFindDependencyMacro.cmake
index 99ffca8..7780538 100644
--- a/Modules/CMakeFindDependencyMacro.cmake
+++ b/Modules/CMakeFindDependencyMacro.cmake
@@ -31,14 +31,14 @@ macro(find_dependency dep)
   if (NOT ${dep}_FOUND)
     set(cmake_fd_version)
     if (${ARGC} GREATER 1)
-      if (${ARGV1} STREQUAL EXACT)
+      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)
-- 
1.8.3.2


-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to