forked from adobe/lagrange-example-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
76 lines (59 loc) · 1.93 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
#
# Copyright 2022 Adobe
# All Rights Reserved.
#
# NOTICE: Adobe permits you to use, modify, and distribute this file in
# accordance with the terms of the Adobe license agreement accompanying
# it.
#
cmake_minimum_required(VERSION 3.24.0)
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard version")
# Replace all instances of "foo" with your project name
project(Foo)
# Change "FOO" to your project name
option(FOO_BUILD_APP "Build your test application" ON)
option(FOO_BUILD_TESTS "Build your tests" ON)
option(FOO_BUILD_DOCUMENTATION "Build Doxygen documentation" OFF)
list(PREPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
# Include the Lagrange library (only importing lagrange::core for now)
include(lagrange) # Note: Lagrange's version in `cmake/lagrange.cmake` might be old, update if needed.
# Import additional Lagrange modules lagrange::ui and lagrange::io
lagrange_include_modules(ui io)
# We can also include dependencies from Lagrange's .cmake files
FetchContent_GetProperties(lagrange)
list(PREPEND CMAKE_MODULE_PATH
${lagrange_SOURCE_DIR}/cmake/recipes/internal
${lagrange_SOURCE_DIR}/cmake/recipes/external
)
# Include more core library dependencies here
# Core library
file(GLOB_RECURSE LIB_SOURCES
"include/foo/*.h"
"src/*.cpp"
)
add_library(foo_lib "${LIB_SOURCES}")
add_library(foo::lib ALIAS foo_lib)
# Include headers
target_include_directories(foo_lib PUBLIC include)
# Direct dependencies
target_link_libraries(foo_lib PUBLIC
lagrange::core
)
# Compile definitions
target_compile_definitions(foo_lib PUBLIC _USE_MATH_DEFINES)
target_compile_definitions(foo_lib PUBLIC NOMINMAX)
# C++ standard
target_compile_features(foo_lib PUBLIC cxx_std_17)
# Application
if(FOO_BUILD_APP)
add_subdirectory(app)
endif()
# Tests
if(FOO_BUILD_TESTS)
include(CTest)
add_subdirectory(tests)
endif()
# Documentation
if(FOO_BUILD_DOCUMENTATION)
add_subdirectory(docs)
endif()