Skip to content

overload find_package instead of using find_modern_package #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions ModernCMakeUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(MODERN_CMAKE_UTILS ON)
# Capture the current directory
set(MODERN_CMAKE_UTILS_DIR "${CMAKE_CURRENT_LIST_DIR}")

macro(FIND_MODERN_PACKAGE PNAME)
macro(FIND_PACKAGE PNAME)
# Default, empty functions
macro(MODERN_PACKAGE_PRELOAD)
endmacro()
Expand All @@ -24,12 +24,15 @@ macro(FIND_MODERN_PACKAGE PNAME)
endmacro()

# Load a helper file (error if one does not exist)
include("${MODERN_CMAKE_UTILS_DIR}/Patch${PNAME}.cmake")

if(EXISTS "${MODERN_CMAKE_UTILS_DIR}/Patch${PNAME}.cmake"
message( STATUS "[MODERN_CMAKE_TOOLS] Found patch for module ${PNAME}" )
include("${MODERN_CMAKE_UTILS_DIR}/Patch${PNAME}.cmake")
endif()

# These commands "override" any previously loaded command
modern_package_preload()

find_package(${PNAME} ${ARGN})
_find_package(${PNAME} ${ARGN})

modern_package_postload()

Expand Down