forked from futurerestore/futurerestore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
61 lines (60 loc) · 3.6 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
cmake_minimum_required(VERSION 3.22)
find_package(PkgConfig REQUIRED)
execute_process(COMMAND git submodule update --init --recursive WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_STRIP_TRAILING_WHITESPACE)
set(ignoreMe "${NO_PKGCFG} ${ASAN} ${NO_XCODE} ${ARCH}")
set(SUBPROJECT_BUILD 1)
set(ASAN_FLAG "")
set(CMAKE_C_FLAGS_RELEASE "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-Os -DNDEBUG")
set(CMAKE_C_FLAGS_DEBUG "-g -O0 -DDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -DDEBUG")
set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
if(DEFINED ASAN OR "$ENV{ASAN}" MATCHES "1")
set(ASAN 1)
set(ASAN_FLAG "-fsanitize=address -fsanitize-address-use-after-scope -fno-omit-frame-pointer")
set(CMAKE_C_LINK_LIBRARY_FLAG "${ASAN_FLAG}")
endif()
if("${CMAKE_HOST_SYSTEM_NAME}" MATCHES "Darwin")
if(NOT DEFINED NO_XCODE AND NOT DEFINED ENV{NO_XCODE})
execute_process(COMMAND xcrun --find clang WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE CC OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND xcrun --find clang++ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE CXX OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND xcrun --find ar WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE AR OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND xcrun --find ld WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE LD OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND xcrun --show-sdk-path WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE SYSROOT OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_C_COMPILER "${CC}")
set(CMAKE_CXX_COMPILER "${CXX}")
endif()
if(NOT DEFINED ARCH)
set(ARCH "$ENV{ARCH}")
if(ARCH STREQUAL "")
set(ARCH "${CMAKE_SYSTEM_PROCESSOR}")
endif()
endif()
if((NOT DEFINED MINVER OR NOT DEFINED "$ENV{MINVER}") AND (DEFINED NO_PKGCFG OR "$ENV{NO_PKGCFG}" MATCHES "1"))
if("${ARCH}" STREQUAL "x86_64" OR "$ENV{ARCH}" STREQUAL "x86_64")
set(MINVER -mmacosx-version-min=10.12)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12)
else()
set(MINVER -mmacosx-version-min=11.0)
set(CMAKE_OSX_DEPLOYMENT_TARGET 11.0)
endif()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch ${ARCH} -isysroot ${SYSROOT} ${MINVER} -fembed-bitcode=off -flto=thin -pthread -mrelax-all -std=gnu++20 -Wno-int-conversion ${ASAN_FLAG}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch ${ARCH} -isysroot ${SYSROOT} ${MINVER} -fembed-bitcode=off -flto=thin -pthread -mrelax-all -std=gnu17 -Wno-int-conversion ${ASAN_FLAG}")
elseif("${CMAKE_HOST_SYSTEM_NAME}" MATCHES "Linux")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition -pthread -mrelax-all -std=gnu++20 -Wno-int-conversion ${ASAN_FLAG}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--allow-multiple-definition -pthread -mrelax-all -std=gnu17 -Wno-int-conversion ${ASAN_FLAG}")
elseif("${CMAKE_HOST_SYSTEM_NAME}" MATCHES "MSYS" OR "${CMAKE_HOST_SYSTEM_NAME}" MATCHES "Windows")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--allow-multiple-definition -pthread -fPIC -Wno-int-conversion -DCURL_STATICLIB -Bstatic -O0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition -pthread -fPIC -Wno-int-conversion -DCURL_STATICLIB -Bstatic -O0")
endif()
project(futurerestore)
add_subdirectory(external/tsschecker)
add_subdirectory(external/idevicerestore)
add_subdirectory(src)
#get_cmake_property(_variableNames VARIABLES)
#list (SORT _variableNames)
#foreach (_variableName ${_variableNames})
# message(STATUS "${_variableName}=${${_variableName}}")
#endforeach()