Browse Source

Always set version variable of find_dependency macro

If there is no ARGV1, that is fine; version will be made empty, and no
version will be passed to find_package().

This is relevant when find_dependency is invoked multiple times,
sometimes with a version specified and sometimes without.

 find_dependency(dep1 3.4)
 find_dependency(dep2) # version still set to 3.4.
Alex Merry 11 years ago
parent
commit
5878c5d919
1 changed files with 1 additions and 3 deletions
  1. 1 3
      Modules/CMakeFindDependencyMacro.cmake

+ 1 - 3
Modules/CMakeFindDependencyMacro.cmake

@@ -29,9 +29,7 @@
 
 macro(find_dependency dep)
   if (NOT ${dep}_FOUND)
-    if (${ARGV1})
-      set(version ${ARGV1})
-    endif()
+    set(version ${ARGV1})
     set(exact_arg)
     if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT)
       set(exact_arg EXACT)