mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Fix potential invalid reset of CMAKE_FIND_LIBRARY_PREFIXES on MSVC.
- gflags_report_not_found() calls gflags_reset_find_library_prefix() and we only reset CMAKE_FIND_LIBRARY_PREFIXES when performing a manual search for gflags, but gflags_report_not_found() is also used before the manual search when searching for an exported gflags target. - As such, it was possible that we could have cleared CMAKE_FIND_LIBRARY_PREFIXES rather than reset it if gflags_report_not_found() was invoked during the exported target search. - This patch prevents this possibility by verifying that the cached version of CMAKE_FIND_LIBRARY_PREFIXES exists before updating it. Change-Id: I07528ae5f197a366c7da342196b3e977f9a1fc93
This commit is contained in:
@@ -85,9 +85,9 @@
|
||||
# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when FindGflags was
|
||||
# invoked, necessary for MSVC.
|
||||
macro(GFLAGS_RESET_FIND_LIBRARY_PREFIX)
|
||||
if (MSVC)
|
||||
if (MSVC AND CALLERS_CMAKE_FIND_LIBRARY_PREFIXES)
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
endif (MSVC)
|
||||
endif()
|
||||
endmacro(GFLAGS_RESET_FIND_LIBRARY_PREFIX)
|
||||
|
||||
# Called if we failed to find gflags or any of it's required dependencies,
|
||||
|
||||
Reference in New Issue
Block a user