forked from CSS-Electronics/clx000-qt5-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
64 lines (50 loc) · 1.63 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
cmake_minimum_required(VERSION 3.29.3)
project(clx000canbus)
set(CMAKE_VERBOSE_MAKEFILE ON)
enable_language(CXX)
set(RELEASE_NAME clx000canbus)
# Find required Qt dependencies.
set(REQUIRED_QT6_COMPONENTS
Core
SerialBus
SerialPort
)
find_package(Qt6 6.7.2 REQUIRED)
find_package(Qt6 COMPONENTS ${REQUIRED_QT6_COMPONENTS} REQUIRED)
# All core source and header files, sorted alphabetically.
set(SOURCE_FILES
CLX000CanBus.cpp
CLX000CanBusUSB.cpp
CLX000Plugin.cpp
CRC16.cpp
)
set(HEADERS_FILES
CLX000CanBus.h
CLX000CanBusUSB.h
CLX000Plugin.h
CRC16.h
)
set(OTHER_FILES
plugin.json
)
add_library(${RELEASE_NAME} MODULE ${SOURCE_FILES} ${HEADERS_FILES} ${OTHER_FILES})
# Enable and configure automatic moc generation.
set_property(TARGET ${RELEASE_NAME} PROPERTY AUTOMOC ON)
# CXX standard configuration.
set_property(TARGET ${RELEASE_NAME} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${RELEASE_NAME} PROPERTY CXX_STANDARD_REQUIRED YES)
set_property(TARGET ${RELEASE_NAME} PROPERTY CXX_EXTENSIONS NO)
# General Qt configuration.
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
add_compile_definitions(${RELEASE_NAME} QT_DEBUG)
else()
add_compile_definitions(${RELEASE_NAME} QT_NO_DEBUG)
add_compile_definitions(${RELEASE_NAME} QT_NO_DEBUG_OUTPUT)
endif()
# Link against all required Qt modules.
foreach(QT_COMPONENT ${REQUIRED_QT6_COMPONENTS})
target_link_libraries(${RELEASE_NAME} "Qt6::${QT_COMPONENT}")
endforeach()
add_custom_command(TARGET ${RELEASE_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${RELEASE_NAME}> ${CMAKE_BINARY_DIR}/plugins/canbus
)