forked from CLIUtils/modern_cmake
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModernCMakeUtils.cmake
More file actions
41 lines (27 loc) · 885 Bytes
/
ModernCMakeUtils.cmake
File metadata and controls
41 lines (27 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Most packages will work in CMake 3.1+
cmake_minimum_required(VERSION 3.1)
# Header style guard for multiple inclusion protection
if(DEFINED MODERN_CMAKE_UTILS)
return()
endif()
set(MODERN_CMAKE_UTILS ON)
# Capture the current directory
set(MODERN_CMAKE_UTILS_DIR "${CMAKE_CURRENT_LIST_DIR}")
macro(FIND_MODERN_PACKAGE PNAME)
# Default, empty functions
macro(MODERN_PACKAGE_PRELOAD)
endmacro()
macro(MODERN_PACKAGE_POSTLOAD)
endmacro()
macro(MODERN_PACKAGE_FOUND_POSTLOAD)
endmacro()
# Load a helper file (error if one does not exist)
include("${MODERN_CMAKE_UTILS_DIR}/Patch${PNAME}.cmake")
# These commands "override" any previously loaded command
modern_package_preload()
find_package(${PNAME} ${ARGN})
modern_package_postload()
if(${PNAME}_FOUND)
modern_package_found_postload()
endif()
endmacro()