Skip to content

Commit

Permalink
fix leaking of CMakeDeps lib_suffix variable (#14253)
Browse files Browse the repository at this point in the history
Changelog: Bugfix: fix leaking of ``CMakeDeps``
``CMAKE_FIND_LIBRARY_SUFFIXES`` variable
Docs: Omit

Close #14225
  • Loading branch information
AbrilRBS authored Jul 8, 2023
2 parents cf3a43c + 99a2c45 commit 64ab9e7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions conan/tools/cmake/cmakedeps/templates/macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ def template(self):
set(_LIB_NAME CONAN_LIB::${package_name}_${_LIBRARY_NAME}${config_suffix})
if(is_host_windows AND library_type STREQUAL "SHARED")
# Store and reset the variable, so it doesn't leak
set(_OLD_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES .dll ${CMAKE_FIND_LIBRARY_SUFFIXES})
find_library(CONAN_SHARED_FOUND_LIBRARY NAMES ${_LIBRARY_NAME} PATHS ${package_bindir}
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_OLD_CMAKE_FIND_LIBRARY_SUFFIXES})
if(NOT CONAN_SHARED_FOUND_LIBRARY)
message(STATUS "Cannot locate shared library: ${_LIBRARY_NAME}")
message(DEBUG "DLL library not found, creating UNKNOWN IMPORTED target")
Expand Down

0 comments on commit 64ab9e7

Please sign in to comment.