From 01f90ea1e814ca0a11244d08c251ddda6be0d1e7 Mon Sep 17 00:00:00 2001 From: ycdtosa Date: Thu, 27 Jun 2019 00:15:22 +0200 Subject: [PATCH] use find_package instead of find_modern_package Should easy maintenance of the CMakeLists.txt since it is the same syntax as the official command and silently applies the changes --- ModernCMakeUtils.cmake | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ModernCMakeUtils.cmake b/ModernCMakeUtils.cmake index 725cd7d..98ea27c 100644 --- a/ModernCMakeUtils.cmake +++ b/ModernCMakeUtils.cmake @@ -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() @@ -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()