-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
62 lines (52 loc) · 1.37 KB
/
CMakeLists.txt
File metadata and controls
62 lines (52 loc) · 1.37 KB
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.23)
set(MAJOR_VERSION 1)
set(MINOR_VERSION 18)
set(PATCH_VERSION 0)
set(REDUCT_CPP_FULL_VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION})
project(reductcpp VERSION ${REDUCT_CPP_FULL_VERSION} LANGUAGES CXX)
message(STATUS "Version ${REDUCT_CPP_FULL_VERSION}")
# Use FetchContent
set(REDUCT_CPP_USE_FETCHCONTENT
OFF
CACHE BOOL
"Use fetchcontent to fetch dependencies"
)
# Set RCPP_INSTALL
if(REDUCT_CPP_USE_FETCHCONTENT)
set(RCPP_INSTALL OFF)
else()
set(RCPP_INSTALL ON)
endif()
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
endif()
# Detect whether vcpkg is being used by checking CMAKE_TOOLCHAIN_FILE
if(
DEFINED CMAKE_TOOLCHAIN_FILE
AND "${CMAKE_TOOLCHAIN_FILE}" MATCHES "vcpkg\\.cmake$"
)
set(VCPKG_ENABLED
TRUE
CACHE INTERNAL
"Whether vcpkg integration is enabled"
)
message(
STATUS
"vcpkg detected via CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
)
else()
set(VCPKG_ENABLED
FALSE
CACHE INTERNAL
"Whether vcpkg integration is enabled"
)
endif()
# Dependencies
include(cmake/InstallDependencies.cmake)
set(RCPP_TARGET_NAME ${PROJECT_NAME})
add_subdirectory(src)
# Tests
set(REDUCT_CPP_ENABLE_TESTS OFF CACHE BOOL "Compile tests")
if(REDUCT_CPP_ENABLE_TESTS)
add_subdirectory(tests)
endif()