Merge topic 'fix-find_dependency-macro'

2be6dbe4 find_dependency: Ensure that ARGV1 has valid local content
a35ce723 find_dependency: Add namespacing for variables in the macro.
This commit is contained in:
Brad King 2014-02-25 11:18:11 -05:00 committed by CMake Topic Stage
commit 602be01b33
1 changed files with 20 additions and 13 deletions

View File

@ -29,27 +29,34 @@
macro(find_dependency dep) macro(find_dependency dep)
if (NOT ${dep}_FOUND) if (NOT ${dep}_FOUND)
set(version ${ARGV1}) set(cmake_fd_version)
set(exact_arg) if (${ARGC} GREATER 1)
set(cmake_fd_version ${ARGV1})
endif()
set(cmake_fd_exact_arg)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT) if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT)
set(exact_arg EXACT) set(cmake_fd_exact_arg EXACT)
endif() endif()
set(quiet_arg) set(cmake_fd_quiet_arg)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
set(quiet_arg QUIET) set(cmake_fd_quiet_arg QUIET)
endif() endif()
set(required_arg) set(cmake_fd_required_arg)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
set(required_arg REQUIRED) set(cmake_fd_required_arg REQUIRED)
endif() endif()
get_property(alreadyTransitive GLOBAL PROPERTY get_property(cmake_fd_alreadyTransitive GLOBAL PROPERTY
_CMAKE_${dep}_TRANSITIVE_DEPENDENCY _CMAKE_${dep}_TRANSITIVE_DEPENDENCY
) )
find_package(${dep} ${version} ${exact_arg} ${quiet_arg} ${required_arg}) find_package(${dep} ${version}
${cmake_fd_exact_arg}
${cmake_fd_quiet_arg}
${cmake_fd_required_arg}
)
if(NOT DEFINED alreadyTransitive OR alreadyTransitive) if(NOT DEFINED cmake_fd_alreadyTransitive OR cmake_fd_alreadyTransitive)
set_property(GLOBAL PROPERTY _CMAKE_${dep}_TRANSITIVE_DEPENDENCY TRUE) set_property(GLOBAL PROPERTY _CMAKE_${dep}_TRANSITIVE_DEPENDENCY TRUE)
endif() endif()
@ -58,8 +65,8 @@ macro(find_dependency dep)
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False) set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
return() return()
endif() endif()
set(required_arg) set(cmake_fd_required_arg)
set(quiet_arg) set(cmake_fd_quiet_arg)
set(exact_arg) set(cmake_fd_exact_arg)
endif() endif()
endmacro() endmacro()