summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: 4f49a04788b7eae72d5b50778d9262819de5c4b8 (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
38
39
40
41
42
43
44
45
46
47
cmake_minimum_required(VERSION 3.2)
project(
	mossrose
	VERSION 0.1.0
)


include_directories(${CMAKE_SOURCE_DIR}/include)
option(MOSSROSE_BUILD_EXAMPLES "Build the example programs" OFF)
option(MOSSROSE_BUILD_TESTS "Build the tests" OFF)


######## third-party libraries ########
add_subdirectory(${CMAKE_SOURCE_DIR}/3rdparty/portaudio EXCLUDE_FROM_ALL)
add_subdirectory(${CMAKE_SOURCE_DIR}/3rdparty/plibsys EXCLUDE_FROM_ALL)
add_subdirectory(${CMAKE_SOURCE_DIR}/3rdparty/libwav EXCLUDE_FROM_ALL)

add_library(mossrose)
set_target_properties(mossrose PROPERTIES
	C_STANDARD 99
	CMAKE_C_FLAGS "-Wall -Wextra -Werror -Wfatal-errors -Wpedantic"
	VERSION ${PROJECT_VERSION}
	PUBLIC_HEADER src/mossrose.h
)
target_link_libraries(mossrose portaudio_static plibsysstatic wav::wav)
target_include_directories(mossrose PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/libwav/include)
if (UNIX)
	target_link_libraries(mossrose m)
endif()


if (MOSSROSE_BUILD_EXAMPLES)
	add_custom_target(examples)
	add_subdirectory(${CMAKE_SOURCE_DIR}/examples)
endif()


if (MOSSROSE_BUILD_TESTS)
	add_executable(test)
	target_link_libraries(test plibsysstatic)
	if (UNIX)
		target_link_libraries(test m)
	endif()
endif()


add_subdirectory(${CMAKE_SOURCE_DIR}/src)