-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
executable file
·69 lines (53 loc) · 1.67 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
cmake_minimum_required (VERSION 3.4)
project(audio_transport)
set(CMAKE_CXX_STANDARD 11)
if(NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_FLAGS "-Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
#Adding cmake modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/modules/)
#######################
## Internal Libraries
#######################
include_directories(include)
file(GLOB PROJECT_SOURCES src/*.cpp)
#######################
## External Libraries
#######################
# FFTW3
find_package(FFTW REQUIRED)
include_directories(${FFTW_INCLUDES})
set(LIBS ${LIBS} ${FFTW_LIBRARIES})
####################
## Library Creation
####################
add_library(${PROJECT_NAME} SHARED ${PROJECT_SOURCES})
target_link_libraries(${PROJECT_NAME} ${LIBS})
set(LIBS ${LIBS} ${PROJECT_NAME})
################
## Installation
################
install(TARGETS ${PROJECT_NAME}
DESTINATION lib)
install(DIRECTORY include/${PROJECT_NAME}
DESTINATION include)
#####################################
## Unit Tests
#####################################
option(BUILD_EXAMPLES "BUILD_EXAMPLES" OFF)
if (BUILD_EXAMPLES)
# Find audiorw
find_package(AUDIORW REQUIRED)
include_directories(${AUDIORW_INCLUDE})
set(LIBS ${LIBS} ${AUDIORW_LIBRARY})
# from list of files we'll create examples example_name.cpp -> example_name
file(GLOB EXAMPLE_SOURCES example/*.cpp)
foreach(_example_file ${EXAMPLE_SOURCES})
get_filename_component(_example_name ${_example_file} NAME_WE)
add_executable(${_example_name} ${_example_file})
target_link_libraries(${_example_name} ${LIBS})
endforeach()
endif()