Skip to content

Commit

Permalink
cmake: Small fix to prevent empty module path (#694)
Browse files Browse the repository at this point in the history
  • Loading branch information
AljenU authored Nov 30, 2023
1 parent 5285d7b commit ff6e4ea
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cmake/OCCAConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
# Dependencies that need to be found will depend on the build settings used
include(CMakeFindDependencyMacro)
# For some dependencies, we provide custom Find modules, that have been installed next to this file.
# Temporarily add this directory to the CMAKE_MODULE_PATH
set(_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
# Temporarily add this directory to the CMAKE_MODULE_PATH
# Use a variable with an OCCA prefix to store the old value, to prevent the variable being
# overwritten by code in the dependencies, executed before the reset
set(_OCCA_STORE_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}")
@exportPackageDependencies@
# Reset CMAKE_MODULE_PATH
set(CMAKE_MODULE_PATH ${_CMAKE_MODULE_PATH})
unset(_CMAKE_MODULE_PATH)
# Do not use list(REMOVE CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}"), because that would remove all instances, even if they were not added here
set(CMAKE_MODULE_PATH ${_OCCA_STORE_CMAKE_MODULE_PATH})
unset(_OCCA_STORE_CMAKE_MODULE_PATH)

# The exported targets are defined in an auto-generated file:
include( "${CMAKE_CURRENT_LIST_DIR}/OCCATargets.cmake" )

0 comments on commit ff6e4ea

Please sign in to comment.