This repository has been archived by the owner on Jul 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 164
/
CMakeLists.txt
55 lines (44 loc) · 2.33 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
cmake_minimum_required(VERSION 3.17)
project(modengine2)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
set(version "2.2.0")
set(VCPKG_TOOLS "${CMAKE_BINARY_DIR}/vcpkg_installed/x64-windows")
# Detours currently has no CMake manifests: https://github.com/microsoft/Detours/pull/48.
find_path(VCPKG_INCLUDE_DIR NAMES detours/detver.h)
find_library(DETOURS_LIBRARY detours REQUIRED)
find_package(Lua REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(crashpad CONFIG REQUIRED)
find_package(sol2 CONFIG REQUIRED)
set(MODENGINE_CRASH_REPORT_URL "http://localhost/" CACHE STRING "URL that minidump crash records are uploaded to")
add_compile_definitions(MODENGINE_CRASH_REPORT_URL="${MODENGINE_CRASH_REPORT_URL}")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if (CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-Wno-microsoft-cast;-Wno-c++98-compat;-Wno-c++98-compat-pedantic;/GX;/clang:--system-header-prefix=${VCPKG_INCLUDE_DIR};/clang:--system-header-prefix=${CMAKE_CURRENT_SOURCE_DIR}/third-party>")
else ()
message(FATAL_ERROR "Clang frontend must be MSVC. Current frontend '${CMAKE_CXX_SIMULATE_ID}' is unsupported")
endif ()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:/experimental:external;/external:anglebrackets;/external:W0;/W4;/bigobj>")
add_compile_definitions(_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS _CRT_SECURE_NO_WARNINGS)
endif ()
add_subdirectory(third-party)
add_subdirectory(src)
add_subdirectory(launcher)
include(ModEngineInstaller)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/ModEngineConfig.cmake"
INSTALL_DESTINATION share/cmake/modengine)
set_property(TARGET modengine2 PROPERTY VERSION ${version})
set_property(TARGET modengine2 PROPERTY SOVERSION 3)
set_property(TARGET modengine2 PROPERTY
INTERFACE_modengine2_MAJOR_VERSION 3)
set_property(TARGET modengine2 APPEND PROPERTY
COMPATIBLE_modengine2_STRING ModEngine_MAJOR_VERSION)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/ModEngineConfigVersion.cmake"
VERSION "${version}"
COMPATIBILITY AnyNewerVersion)