-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
68 lines (55 loc) · 1.45 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
cmake_minimum_required(VERSION 3.23)
set(CMAKE_CXX_STANDARD 20)
# download CPM.cmake
file(
DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.38.3/CPM.cmake
${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake
EXPECTED_HASH SHA256=cc155ce02e7945e7b8967ddfaff0b050e958a723ef7aad3766d368940cb15494
)
include(${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake)
project(
APMath
VERSION 0.0.1
DESCRIPTION ""
LANGUAGES CXX)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
if(PROJECT_IS_TOP_LEVEL)
set(APMath_SHARED 1)
endif()
if(APMath_SHARED)
add_library(APMath SHARED)
else()
add_library(APMath STATIC)
endif()
include(GenerateExportHeader)
generate_export_header(APMath
EXPORT_MACRO_NAME APMATH_API
EXPORT_FILE_NAME include/APMath/API.h
)
target_include_directories(APMath
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/include
include
)
add_subdirectory(include/APMath)
source_group(include/APMath REGULAR_EXPRESSION "include/APMath/*")
add_subdirectory(src)
source_group(src REGULAR_EXPRESSION "src/*")
if(NOT PROJECT_IS_TOP_LEVEL)
return()
endif()
add_executable(test)
CPMAddPackage("gh:catchorg/[email protected]")
target_include_directories(test
PRIVATE
include
test
${Catch2_SOURCE_DIR}/src
)
target_link_libraries(test APMath)
target_link_libraries(test Catch2::Catch2)
target_link_libraries(test Catch2::Catch2WithMain)
add_subdirectory(test)
source_group(test REGULAR_EXPRESSION "test/*")