dhtserver/CMakeLists.txt
2021-04-23 12:41:16 +02:00

48 lines
1.2 KiB
CMake

cmake_minimum_required(VERSION 3.7)
project(dhtserver LANGUAGES C CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Network REQUIRED)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(DHT_SOURCES
src/dht/linux/common_dht_read.c
src/dht/linux/common_dht_read.h
src/dht/linux/libdht.c
src/dht/linux/libdht.h
src/dht/linux/pi_2_dht_read.c
src/dht/linux/pi_2_dht_read.h
src/dht/linux/pi_2_mmio.c
src/dht/linux/pi_2_mmio.h
)
list(APPEND DHT_INCLUDEDIR
src/dht/linux
)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
set(DHT_SOURCES
src/dht/freebsd/gpio.c
src/dht/freebsd/libdht.c
src/dht/freebsd/libdht.h
src/dht/freebsd/libgpio.h
)
list(APPEND DHT_INCLUDEDIR
src/dht/freebsd
)
endif()
add_executable(dhtserver
src/main.cpp
${DHT_SOURCES}
)
target_include_directories(dhtserver PRIVATE ${DHT_INCLUDEDIR})
target_link_libraries(dhtserver Qt${QT_VERSION_MAJOR}::Network)