Skip to content

Commit

Permalink
Forbidding find_package() to search for some packages in Windows' reg…
Browse files Browse the repository at this point in the history
…istry

On Windows, when configuring "glog" or "gflags", a path to <package>-config.cmake is stored
under the form of a registry key (HKEY_CURRENT_USER\Software\Kitware\CMake\Packages\<PackageName>).
A a consequence, when deploying/installing another version of antares-deps, supposed to be
completely independent, an already compiled package ("glog" or "gflags") is found by the
find_package(<PackageName>) in the Windows registry.
As we can't make packages "glog" or "gflags" not to store paths in the Windows' registry,
we tell find_package(<PackageName>) not to search in registry, by using NO_CMAKE_PACKAGE_REGISTRY option.
  • Loading branch information
guilpier-code committed Nov 8, 2022
1 parent 073e64e commit d141c90
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmake/dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,14 @@ endif()
## GFLAGS ##
##############
if(BUILD_gflags)
find_package(gflags)
# On Windows, when configuring "glog" or "gflags", a path to <package>-config.cmake is stored
# under the form of a registry key (HKEY_CURRENT_USER\Software\Kitware\CMake\Packages\<PackageName>).
# A a consequence, when deploying/installing another version of antares-deps, supposed to be
# completely independent, an already compiled package ("glog" or "gflags") is found by the
# find_package(<PackageName>) in the Windows registry.
# As we can't make packages "glog" or "gflags" not to store paths in the Windows' registry,
# we tell find_package(<PackageName>) not to search in registry, by using NO_CMAKE_PACKAGE_REGISTRY option.
find_package(gflags NO_CMAKE_PACKAGE_REGISTRY)

if(NOT gflags_FOUND)
build_git_dependency(
Expand All @@ -118,7 +125,7 @@ endif()
## GLOG ##
############
if(BUILD_glog)
find_package(glog)
find_package(glog NO_CMAKE_PACKAGE_REGISTRY)

if(NOT glog_FOUND)
build_git_dependency(
Expand Down

0 comments on commit d141c90

Please sign in to comment.