Skip to content
Snippets Groups Projects
Commit 183fb704 authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files

builds with CMake

parent f7736e48
No related branches found
No related tags found
No related merge requests found
# typical build steps if cumbia are installed under /usr/local/cumbia-libs:
#
# > mkdir build && cd build
# > cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/cumbia-libs
# -DCMAKE_PREFIX_PATH=/usr/local/cumbia-libs/lib
# -DCMAKE_MODULE_PATH=/usr/local/cumbia-libs/lib/cmake
cmake_minimum_required(VERSION 3.16)
project(airliquide VERSION 1.0.0 LANGUAGES C CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(cumbia REQUIRED)
find_package(cumbia-qtcontrols REQUIRED)
find_package(quapps REQUIRED)
if(quapps_FOUND)
message(STATUS "+ found quapps")
endif()
find_package(cumbia-http QUIET)
# Check if the package was found
if(cumbia-http_FOUND)
message(STATUS "+ found cumbia-http module")
else()
message(WARNING "cumbia-http not found, continuing without it.")
endif()
find_package(qumbia-tango-controls QUIET)
if(qumbia-tango-controls_FOUND)
message(STATUS "+ found qumbia-tango-controls module")
# Use the found library
else()
message(WARNING "qumbia-tango-controls not found, continuing without it.")
endif()
qt_standard_project_setup()
# in order to find quapps-pre-target and quapps-post-target (below)
# make sure you specify -DCMAKE_MODULE_PATH=/usr/local/cumbia-libs/lib/cmake
# alongside the cmake command
#
include(quapps-pre-target)
file(GLOB_RECURSE SOURCES src/*.cpp)
file(GLOB_RECURSE HEADERS src/*.h)
......@@ -54,33 +38,10 @@ else()
)
endif()
# Check if the package was found
if(qumbia-tango-controls_FOUND)
target_link_libraries(${PROJECT_NAME} PRIVATE qumbia-tango-controls)
endif()
# Check if the package was found
if(cumbia-http_FOUND)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network WebSockets)
target_link_libraries(${PROJECT_NAME} PRIVATE cumbia-http)
endif()
if(quapps_FOUND)
target_link_libraries(${PROJECT_NAME} PRIVATE quapps)
endif()
set(CU_USER_CONFIG_DIR ".config/cumbia" CACHE STRING "Default cumbia user configuration dir (~/.config/cumbia)" )
message(STATUS "CU_USER_CONFIG_DIR is set to: ${CU_USER_CONFIG_DIR}")
message(STATUS "Change it calling cmake -DCU_USER_CONFIG_DIR=\"another/dir\", with the desired directory")
add_compile_definitions(
CUMBIA_USER_CONFIG_DIR="${CU_USER_CONFIG_DIR}"
)
include(quapps-post-target) # needs -DCMAKE_MODULE_PATH=
target_link_libraries(${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(${PROJECT_NAME})
endif()
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment