x-tools/cmake/x_qt_serialbus.cmake
2025-08-01 14:02:50 +08:00

21 lines
843 B
CMake

find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS SerialBus)
if(Qt${QT_VERSION_MAJOR}SerialBus_FOUND)
add_compile_definitions(X_ENABLE_SERIALBUS)
list(APPEND X_LIBS Qt${QT_VERSION_MAJOR}::SerialBus)
else()
message(STATUS "SerialBus module is disable, SerialBus files will be removed.")
# Remove modbus files
file(GLOB_RECURSE MODBUS_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/src/tools/modbus/*.*")
foreach(file ${MODBUS_SOURCE})
list(REMOVE_ITEM X_SOURCES ${file})
message(STATUS "[Modbus]Remove file: ${file}")
endforeach(file ${MODBUS_SOURCE})
# Remove canbus files
file(GLOB_RECURSE CANBUS_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/src/tools/canbus/*.*")
foreach(file ${CANBUS_SOURCE})
list(REMOVE_ITEM X_SOURCES ${file})
message(STATUS "[Canbus]Remove file: ${file}")
endforeach(file ${CANBUS_SOURCE})
endif()