-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
55 lines (43 loc) · 1.65 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
cmake_minimum_required(VERSION 3.14)
project(AmalgamUI)
###############################################################################
# Build Options
###############################################################################
option(AUI_BUILD_TESTS "Build AUI unit tests." OFF)
###############################################################################
message(STATUS "Configuring AmalgamUI")
# Tell CMake where the CMake folder is, since our source dir isn't the base dir.
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/CMake/")
# Find SDL2 and associated libs.
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_ttf REQUIRED)
# Add our library target
add_library(AmalgamUI STATIC "")
# Include the headers from our dependencies.
target_include_directories(AmalgamUI
PUBLIC
${SDL2_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIRS}
${SDL2_TTF_INCLUDE_DIRS}
)
# Specify our dependencies.
target_link_libraries(AmalgamUI
PUBLIC
${SDL2_LIBRARIES} ${SDL2_IMAGE_LIBRARIES}
${SDL2_TTF_LIBRARIES}
)
# Compile with C++20.
target_compile_features(AmalgamUI PRIVATE cxx_std_20)
set_target_properties(AmalgamUI PROPERTIES CXX_EXTENSIONS OFF)
# Enable compile warnings.
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(AmalgamUI PUBLIC -Wall -Wextra)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(AmalgamUI PUBLIC /W3 /permissive-)
endif()
# Add sources to our library target.
add_subdirectory(Source)
# Optionally build our unit tests.
if (AUI_BUILD_TESTS)
add_subdirectory(Tests)
endif()