-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
79 lines (67 loc) · 2.37 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
74
75
76
77
78
79
cmake_minimum_required (VERSION 3.13...3.21)
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE
"${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "Vcpkg toolchain file")
endif()
set(LIBTCODFOV_TOOLS ON CACHE BOOL "Build fovtool.")
set(LIBTCODFOV_TESTS OFF CACHE BOOL "Build unit tests.")
set(LIBTCODFOV_INSTALL ON CACHE BOOL "Enable install targets.")
if(LIBTCODFOV_TESTS)
list(APPEND VCPKG_MANIFEST_FEATURES "tests")
endif()
if(LIBTCODFOV_TOOLS)
list(APPEND VCPKG_MANIFEST_FEATURES "fovtool")
endif()
file(STRINGS include/libtcod-fov/version.h LIBTCODFOV_VERSION_LINE REGEX "TCODFOV_STRVERSION")
string(REGEX MATCH "TCODFOV_STRVERSION \"([^\"]+)\"" LIBTCODFOV_VERSION_LINE ${LIBTCODFOV_VERSION_LINE})
set(LIBTCODFOV_VERSION_FULL ${CMAKE_MATCH_1})
string(REGEX MATCH "([0-9]+\.[0-9]+\.[0-9]+)" LIBTCODFOV_VERSION ${LIBTCODFOV_VERSION_FULL})
message(STATUS "Libtcod version: ${LIBTCODFOV_VERSION}")
project(
libtcod-fov
VERSION ${LIBTCODFOV_VERSION}
LANGUAGES C CXX
)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake OPTIONAL RESULT_VARIABLE CONAN_FILE)
if(CONAN_FILE)
conan_basic_setup(TARGETS)
endif()
if(NOT CMAKE_INSTALL_BINDIR)
set(CMAKE_INSTALL_BINDIR "bin" CACHE STRING "")
endif()
if(NOT CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING "")
endif()
if(NOT CMAKE_INSTALL_DATAROOTDIR)
set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE STRING "")
endif()
if(NOT CMAKE_INSTALL_INCLUDEDIR)
set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE STRING "")
endif()
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
endif()
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
endif()
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
endif()
add_library(${PROJECT_NAME})
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
add_subdirectory(src)
set_target_properties(${PROJECT_NAME} PROPERTIES
C_VISIBILITY_PRESET hidden
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN OFF
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
set(VCPKG_MANIFEST_NO_DEFAULT_FEATURES ON)
if(LIBTCODFOV_TESTS)
add_subdirectory(tests)
endif()
if(LIBTCODFOV_TOOLS)
add_subdirectory(src/fovtool)
endif()