-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
47 lines (39 loc) · 1.56 KB
/
CMakeLists.txt
File metadata and controls
47 lines (39 loc) · 1.56 KB
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
41
42
43
44
45
46
47
# Copyright (c) 2024 Pyarelal Knowles, MIT License
cmake_minimum_required(VERSION 3.20)
project(decodeless_header)
set(CMAKE_CXX_STANDARD 20)
option(DECODELESS_SEARCH_DEPENDENCIES
"Enable searching for dependencies in adjacent directories" ON)
option(DECODELESS_FETCH_DEPENDENCIES
"Enable fetching dependencies with cmake FetchContent" OFF)
if(NOT TARGET decodeless::offset_ptr)
if(DECODELESS_SEARCH_DEPENDENCIES)
option(DECODELESS_OFFSET_PTR_SEARCH_PATH
"${CMAKE_CURRENT_LIST_DIR}/../offset_ptr")
find_package(decodeless_offset_ptr REQUIRED CONFIG PATHS
"${DECODELESS_OFFSET_PTR_SEARCH_PATH}")
elseif(DECODELESS_FETCH_DEPENDENCIES)
include(FetchContent)
FetchContent_Declare(
decodeless_offset_ptr
GIT_REPOSITORY https://github.com/decodeless/offset_ptr.git
GIT_TAG 38ceefc6ce63fb4667cd207424b1277c3eed5f8d)
FetchContent_MakeAvailable(decodeless_offset_ptr)
else()
message(
FATAL_ERROR
"Dependency decodeless::offset_ptr not found! You can enable searching with DECODELESS_SEARCH_DEPENDENCIES or downloading with DECODELESS_FETCH_DEPENDENCIES"
)
endif()
endif()
add_library(decodeless_header INTERFACE)
target_include_directories(decodeless_header INTERFACE include)
target_link_libraries(decodeless_header INTERFACE decodeless::offset_ptr)
add_library(decodeless::header ALIAS decodeless_header)
if(BUILD_TESTING)
option(BUILD_DECODELESS_TESTING "Enable decodeless testing" ON)
if(BUILD_DECODELESS_TESTING)
enable_testing()
add_subdirectory(test)
endif()
endif()