From 5878c5d919a206b9a54f48f386ab98b5cff09e08 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Sat, 22 Feb 2014 13:35:14 +0000 Subject: [PATCH] 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. --- Modules/CMakeFindDependencyMacro.cmake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Modules/CMakeFindDependencyMacro.cmake b/Modules/CMakeFindDependencyMacro.cmake index 0f1f56da9..c0a0ef780 100644 --- a/Modules/CMakeFindDependencyMacro.cmake +++ b/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)