Skip to content

Commit

Permalink
Refine include_guard scopes (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
knoepfel authored Jul 8, 2024
1 parent e83dcd7 commit 2cca9c5
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Modules/private/CetOverrideFindPackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ X
# appropriate time.


# Once only!
include_guard(GLOBAL)
# Once only per directory!
include_guard()

cmake_minimum_required(VERSION 3.18.2...3.27 FATAL_ERROR)

Expand All @@ -75,12 +75,6 @@ include(private/CetAddTransitiveDependency)

include(CMakeFindDependencyMacro)

if (COMMAND _find_package)
message(FATAL_ERROR "find_package() has already been overridden: cetmodules cannot function")
endif()

option(CET_FIND_QUIETLY "All find_package() calls will be quiet." OFF)

execute_process(COMMAND ${CMAKE_COMMAND} --help-command find_package
COMMAND sed -E -n -e "/((Basic|Full) Signature( and Module Mode)?|signature is)\$/,/\\)\$/ { s&^[[:space:]]+&&g; s&[[:space:]|]+&\\n&g; s&[^A-Z_\\n]&\\n&g; /^[A-Z_]{2,}(\\n|\$)/ ! D; P; D }"
OUTPUT_VARIABLE _cet_fp_keywords
Expand All @@ -99,6 +93,15 @@ set(_cet_fp_new_options REQUIRED_BY)
set(_cet_fp_new_keywords ${_cet_fp_new_flags} ${cet_fp_new_options})
set(_cet_fp_all_keywords ${_cet_fp_keywords} ${_cet_fp_new_keywords})

# Once only!
include_guard(GLOBAL)

if (COMMAND _find_package)
message(FATAL_ERROR "find_package() has already been overridden: cetmodules cannot function")
endif()

option(CET_FIND_QUIETLY "All find_package() calls will be quiet." OFF)

# Intercept calls to find_package() for IN_TREE packages and make them
# do the right thing.
macro(find_package PKG)
Expand Down

0 comments on commit 2cca9c5

Please sign in to comment.