File: CMakeLists.txt

package info (click to toggle)
gqrx-sdr 2.6-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,700 kB
  • ctags: 2,724
  • sloc: cpp: 22,413; ansic: 564; xml: 25; makefile: 4
file content (76 lines) | stat: -rw-r--r-- 3,059 bytes parent folder | download | duplicates (2)
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
#######################################################################################################################
# Add the source subdirectories
add_subdirectory(applications)
add_subdirectory(dsp)
add_subdirectory(interfaces)
add_subdirectory(qtgui)
add_subdirectory(receivers)

if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
    add_subdirectory(osxaudio)
    add_definitions(-DGQRX_OS_MACX)
    set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
    if(${LINUX_AUDIO_BACKEND} MATCHES "Pulseaudio")
        add_subdirectory(pulseaudio)
    elseif(${LINUX_AUDIO_BACKEND} MATCHES "Portaudio")
        add_subdirectory(portaudio)
    endif()
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
endif()

#######################################################################################################################
# bring in the global properties
get_property(${PROJECT_NAME}_SOURCE GLOBAL PROPERTY SRCS_LIST)
get_property(${PROJECT_NAME}_UI_SOURCE GLOBAL PROPERTY UI_SRCS_LIST)


#######################################################################################################################
# Process the UI files
QT5_WRAP_UI(UIS_HDRS
    ${${PROJECT_NAME}_UI_SOURCE}
)

#######################################################################################################################
# Process the resources
QT5_ADD_RESOURCES(RESOURCES_LIST
    ../resources/icons.qrc
    ../resources/textfiles.qrc
)

########################################################################
# Resource file - adds an icon to GQRX executable
if (WIN32)
    set(ICON_SOURCE ${CMAKE_SOURCE_DIR}/resources/icons/gqrx.ico)
    set(RES_FILES "${CMAKE_CURRENT_BINARY_DIR}/gqrx.rc")
    file(WRITE "${RES_FILES}" "id ICON \"${ICON_SOURCE}\"")
    set(CMAKE_RC_COMPILER_INIT windres)
    enable_language(RC)
    set(CMAKE_RC_COMPILE_OBJECT
        "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
    list(APPEND RESOURCES_LIST ${RES_FILES})
endif(WIN32)

#######################################################################################################################
# Build the program
add_executable(${PROJECT_NAME} ${${PROJECT_NAME}_SOURCE} ${UIS_HDRS} ${RESOURCES_LIST})
qt5_use_modules(${PROJECT_NAME} Core Network Widgets Svg)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
# The pulse libraries are only needed on Linux. On other platforms they will not be found, so having them here is fine.
target_link_libraries(${PROJECT_NAME}
    ${Boost_LIBRARIES}
    ${GNURADIO_ALL_LIBRARIES}
    ${GNURADIO_OSMOSDR_LIBRARIES}
    ${PULSEAUDIO_LIBRARY}
    ${PULSE-SIMPLE}
    ${PORTAUDIO_LIBRARIES}
)

#build a win32 app, not a console app
if (WIN32)
    set(CMAKE_EXE_LINKER_FLAGS "/entry:mainCRTStartup ${CMAKE_EXE_LINKER_FLAGS}")
    set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE ON)
endif (WIN32)

set(INSTALL_DEFAULT_BINDIR "bin" CACHE STRING "Appended to CMAKE_INSTALL_PREFIX")
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${INSTALL_DEFAULT_BINDIR})