-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
83 lines (59 loc) · 2.46 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
77
78
79
80
81
82
cmake_minimum_required (VERSION 2.6)
project (extmodem)
# Alejandro Santos LU4EXT/HB3YNQ [email protected]
## set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/cmake/Modules")
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -std=c++11 -ggdb -fstack-protector ")
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic -Wno-unused-local-typedefs")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ggdb -rdynamic -fstack-protector -lpthread -Wl,-z,relro ")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG} -g")
#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -O2")
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
if (CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
add_definitions( -DBOOST_ALL_NO_LIB )
add_definitions( -DBOOST_ALL_DYN_LINK )
# MSVC complains otherwise
add_definitions( -D_WIN32_WINNT=0x0501 )
endif()
### BOOST ###
#set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
# boost libs
find_package( Boost 1.49.0 REQUIRED COMPONENTS system program_options thread date_time )
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
list(APPEND EXTMODEM_LIBS ${Boost_LIBRARIES})
### ALSA ###
find_package(ALSA)
if(ALSA_FOUND)
add_definitions(-DALSA_FOUND)
include_directories(${ALSA_INCLUDE_DIRS})
list(APPEND EXTMODEM_LIBS ${ALSA_LIBRARIES})
endif(ALSA_FOUND)
### PORTAUDIO ###
find_package(Portaudio)
if(PORTAUDIO2_FOUND)
add_definitions(-DPORTAUDIO_FOUND)
include_directories(${PORTAUDIO_INCLUDE_DIRS})
list(APPEND EXTMODEM_LIBS ${PORTAUDIO_LIBRARIES})
endif(PORTAUDIO2_FOUND)
### HAMLIB ###
find_package(hamlib)
if(hamlib_FOUND)
add_definitions(-DHAMLIB_FOUND)
include_directories(${hamlib_INCLUDE_DIRS})
list(APPEND EXTMODEM_LIBS ${hamlib_LIBRARIES})
endif(hamlib_FOUND)
###
file(GLOB_RECURSE EXTMODEM_SOURCES "src/*.cpp")
file(GLOB_RECURSE EXTMODEM_HEADERS "src/*.h")
add_executable(${PROJECT_NAME} ${EXTMODEM_SOURCES})
target_link_libraries(${PROJECT_NAME} ${EXTMODEM_LIBS} )