-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
73 lines (53 loc) · 1.83 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
68
69
70
71
72
73
cmake_minimum_required (VERSION 3.14)
project(
"WDBReader"
VERSION 1.0.0
DESCRIPTION "C++ utilities for reading wow db files."
LANGUAGES CXX
)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
if (NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 20)
endif()
set(CMAKE_CXX_EXTENSIONS OFF)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
include(CTest)
enable_testing()
if(BUILD_TESTING)
set(TESTING_WOWDBDEFS_DIR "" CACHE PATH "WoWDBDefs test directory")
add_subdirectory(test)
endif()
if(BUILD_APPS)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT schema_gen)
endif()
set(TESTING_CASC_DIR "" CACHE PATH "CASC test directory")
set(TESTING_MPQ_DIR "" CACHE PATH "MPQ test directory")
endif()
if(BUILD_SHARED_LIBS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
if(DEFINED CMAKE_TOOLCHAIN_FILE AND CMAKE_TOOLCHAIN_FILE MATCHES "vcpkg.cmake")
# stormlib encounters issues finding these when build through vcpkg, unsure why, but this solves it.
find_package(BZip2 REQUIRED)
find_package(ZLIB REQUIRED)
endif()
find_package(StormLib CONFIG)
find_package(CascLib CONFIG)
add_subdirectory(src)
set(BUILD_APPS OFF CACHE BOOL "Build apps")
if(BUILD_APPS)
add_subdirectory(apps)
endif()
set(VERSION_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/WDBReaderConfigVersion.cmake")
set(PROJECT_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/WDBReaderConfig.cmake")
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${VERSION_CONFIG}"
VERSION ${PACKAGE_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file("Config.cmake.in"
"${PROJECT_CONFIG}"
INSTALL_DESTINATION "lib/cmake/WDBReader")
install(FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}" DESTINATION "lib/cmake/WDBReader")
install(EXPORT WDBReaderTargets NAMESPACE WDBReader:: DESTINATION "lib/cmake/WDBReader")