summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: b22b369502e02a3b1f283bab4526b20abd1a4556 (plain)
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
cmake_minimum_required(VERSION 3.13)
project(kalmia)

option(KALMIA_BUILD_TESTS "Build the tests" ON)
option(KALMIA_BUILD_EXAMPLE "Build the example" ON)

add_library(kalmia STATIC)
target_include_directories(kalmia PUBLIC include 3rdparty 3rdparty/ezxml)
if (UNIX)
	set_target_properties(
		kalmia PROPERTIES
		C_STANDARD 90
		CMAKE_C_FLAGS "-Wall -Wextra -Werror -Wfatal-errors -Wpedantic"
	)
endif()

if (KALMIA_BUILD_TESTS)
	string(LENGTH "${CMAKE_SOURCE_DIR}/" SOURCE_PATH_SIZE)
	add_definitions("-DSOURCE_PATH_SIZE=${SOURCE_PATH_SIZE}")
	add_executable(kalmia-tests)
	target_link_libraries(kalmia-tests kalmia)
	if (UNIX)
		target_link_libraries(kalmia-tests m)
	endif()
endif()

if (KALMIA_BUILD_EXAMPLE)
	add_executable(kalmia-example)
	target_link_libraries(kalmia-example kalmia)
	if (UNIX)
		target_link_libraries(kalmia-example m)
	endif()
	add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/example)
endif()

add_subdirectory(src)
add_subdirectory(3rdparty/ezxml)