forked from Dadoum/Provision
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
67 lines (52 loc) · 2.28 KB
/
CMakeLists.txt
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
cmake_minimum_required(VERSION 3.20)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake-d/cmake-d)
project(Provision D)
option(build_anisetteserver "Build Anisette server" ON)
option(link_libplist_dynamic "Load libplist at runtime" OFF)
include(cmake/dependencies.cmake)
set(PROVISION_SOURCE_DIR "lib/")
file(GLOB_RECURSE PROVISION_D_SOURCES "${PROVISION_SOURCE_DIR}*.d")
find_package(PkgConfig REQUIRED)
add_library(provision STATIC ${PROVISION_D_SOURCES})
target_include_directories(provision PUBLIC ${PROVISION_SOURCE_DIR})
if (link_libplist_dynamic)
add_library(plist INTERFACE)
target_compile_versions(provision PUBLIC LibPlist)
target_compile_versions(plist INTERFACE LibPlistDynamic)
else()
if(NOT CMAKE_CROSSCOMPILING)
pkg_check_modules(plist IMPORTED_TARGET libplist-2.0)
if (NOT plist_FOUND)
pkg_check_modules(plist IMPORTED_TARGET libplist)
endif()
endif()
if (plist_FOUND)
message("Using libplist. ")
add_library(plist ALIAS PkgConfig::plist)
target_compile_versions(provision PUBLIC LibPlist)
else()
if (build_sideloadipa)
message(FATAL_ERROR "Sideload IPA requires libplist development package. ")
endif()
message(WARNING "Using fallback Property list parser. ")
FetchContent_Declare(
plist_proj
GIT_REPOSITORY https://github.com/hatf0/plist
PATCH_COMMAND ${DUB_DIRECTORY}/CMakeTmp/DubToCMake -s plist
)
FetchContent_MakeAvailable(plist_proj)
endif()
endif()
target_link_libraries(provision PUBLIC plist)
set(RETRIEVE_HEADERS_SOURCE_DIR "retrieve_headers/")
file(GLOB_RECURSE RETRIEVE_HEADERS_D_SOURCES "${RETRIEVE_HEADERS_SOURCE_DIR}*.d")
add_executable(retrieve_headers ${RETRIEVE_HEADERS_D_SOURCES})
target_include_directories(retrieve_headers PUBLIC ${RETRIEVE_HEADERS_SOURCE_DIR})
target_link_libraries(retrieve_headers provision)
if(build_anisetteserver)
set(ANISETTE_SERVER_SOURCE_DIR "anisette_server/")
file(GLOB_RECURSE ANISETTE_SERVER_D_SOURCES "${ANISETTE_SERVER_SOURCE_DIR}*.d")
add_executable(anisette_server ${ANISETTE_SERVER_D_SOURCES})
target_include_directories(anisette_server PUBLIC ${ANISETTE_SERVER_SOURCE_DIR})
target_link_libraries(anisette_server provision handy-httpd)
endif()