aboutsummaryrefslogtreecommitdiff
path: root/libs/installer_fomod_plus/installer/CMakeLists.txt
blob: 07a670b4316c815743890c583364084260c7f2c2 (plain)
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
cmake_minimum_required(VERSION 3.16)
include(FetchContent)

file(GLOB_RECURSE INSTALLER_SOURCES CONFIGURE_DEPENDS
    ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/*.h
    ${CMAKE_CURRENT_SOURCE_DIR}/*.ui
    ${CMAKE_CURRENT_SOURCE_DIR}/*.qrc
)
file(GLOB SHARE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../share/**/*.cpp")

add_library(fomod_plus_installer SHARED ${INSTALLER_SOURCES} ${SHARE_SOURCES})

target_include_directories(
        fomod_plus_installer
        PUBLIC
        ${CMAKE_CURRENT_SOURCE_DIR}/../share
        ${MO2_UIBASE_INCLUDE_DIRS}
        ${MO2_ARCHIVE_INCLUDE_DIRS}
        ${CMAKE_CURRENT_SOURCE_DIR}
)

FetchContent_Declare(
        pugixml
        GIT_REPOSITORY https://github.com/zeux/pugixml
        GIT_TAG v1.14
        PATCH_COMMAND ${CMAKE_COMMAND}
                -DPUGIXML_CMAKELISTS=<SOURCE_DIR>/CMakeLists.txt
                -P ${CMAKE_CURRENT_LIST_DIR}/../cmake/patch_pugixml.cmake
)

FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
FetchContent_MakeAvailable(pugixml json)

set(project_type plugin)
project(fomod_plus_installer)

target_link_libraries(fomod_plus_installer PRIVATE mo2::uibase pugixml nlohmann_json::nlohmann_json)
if (WIN32)
    target_link_libraries(fomod_plus_installer PRIVATE dbghelp)
endif ()
mo2_configure_plugin(fomod_plus_installer NO_SOURCES WARNINGS OFF PRIVATE_DEPENDS)

if (MSVC)
    target_compile_options(fomod_plus_installer PRIVATE $<$<CONFIG:RelWithDebInfo>:/Zi>)
    target_link_options(fomod_plus_installer PRIVATE $<$<CONFIG:RelWithDebInfo>:/DEBUG>)
    install(FILES $<TARGET_PDB_FILE:fomod_plus_installer>
            DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}
            CONFIGURATIONS RelWithDebInfo
            OPTIONAL)
endif ()

mo2_install_target(fomod_plus_installer)