-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
62 lines (46 loc) · 1.58 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
cmake_minimum_required(VERSION 3.10)
# Set project version
project(MPQCLI VERSION 0.4.2)
# Determine git commit hash
execute_process (
COMMAND git rev-parse HEAD
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE GIT_COMMIT_HASH
)
# Set project defaults
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${MPQCLI_BINARY_DIR}/bin")
if (MSVC)
add_compile_definitions(__STORMLIB_NO_STATIC_LINK__)
set(CMAKE_GENERATOR_PLATFORM x64)
endif()
# Handle StormLib dependency
if (NOT EXISTS "${MPQCLI_SOURCE_DIR}/extern/StormLib/CMakeLists.txt")
message(FATAL_ERROR
"Missing dependency: StormLib
mpqcli requires the StormLib library.
It is provided as a submodule of this repository.
Did you forget to execute the following commands?
git submodule init
git submodule update")
endif()
add_subdirectory(extern/StormLib)
# Handle CLI11 dependency
if (NOT EXISTS "${MPQCLI_SOURCE_DIR}/extern/CLI11/CMakeLists.txt")
message(FATAL_ERROR
"Missing dependency: CLI11
mpqcli requires the CLI11 library.
It is provided as a submodule of this repository.
Did you forget to execute the following commands?
git submodule init
git submodule update")
endif()
add_subdirectory(extern/CLI11)
configure_file(src/mpqcli.h.in mpqcli.h)
add_executable(mpqcli src/main.cpp src/mpq.cpp src/helpers.cpp)
add_dependencies(mpqcli storm)
target_include_directories(mpqcli PRIVATE /extern/StormLib/src)
target_link_libraries(mpqcli PRIVATE storm)
target_link_libraries(mpqcli PRIVATE CLI11::CLI11)
target_include_directories(mpqcli PUBLIC "${PROJECT_BINARY_DIR}")