Skip to content

Commit

Permalink
Fixes #570: Do not remove CMAKE_MODULE_PATH if already set on find_pa…
Browse files Browse the repository at this point in the history
…ckage()
  • Loading branch information
curlybeast authored and jcar87 committed Nov 13, 2023
1 parent 0a466e8 commit 782fe79
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions conan_provider.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -524,12 +524,13 @@ macro(conan_provide_dependency method package_name)
# this will simply reuse the result. If not, fall back to CMake default search
# behaviour, also allowing modules to be searched.
if(NOT ${package_name}_FOUND)
#FIXME: https://github.com/conan-io/cmake-conan/issues/570
set(_cmake_module_path_orig "${CMAKE_MODULE_PATH}")
list(PREPEND CMAKE_MODULE_PATH "${_conan_generators_folder}")
list(FIND CMAKE_MODULE_PATH "${CONAN_GENERATORS_FOLDER}" _index)
if(_index EQUAL -1)
list(PREPEND CMAKE_MODULE_PATH "${CONAN_GENERATORS_FOLDER}")
endif()
unset(_index)
find_package(${package_name} ${ARGN} BYPASS_PROVIDER)
set(CMAKE_MODULE_PATH "${_cmake_module_path_orig}")
unset(_cmake_module_path_orig)
list(REMOVE_ITEM CMAKE_MODULE_PATH "${CONAN_GENERATORS_FOLDER}")
endif()
endmacro()

Expand Down

0 comments on commit 782fe79

Please sign in to comment.