CMakeLists.txt 1.71 KB
cmake_minimum_required(VERSION 3.12)
# ============================================================================
# Check to see if we have cmake directory
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/cmake)
    message( STATUS "Looks like we're a single module" )
    LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
else()
    message( FATAL_ERROR "No cmake directory found. Did you run the submodules script?" )
endif()

# ==============================================================================
# Check to see if there is versioning information available
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/versioning)
    LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/versioning/cmake)
else()
    message( FATAL_ERROR "No ${CMAKE_SOURCE_DIR}/osdev_versioning directory found." )
endif()

# ==============================================================================
include(projectheader)
project_header(mqttcc)

find_package( Qt5Core    REQUIRED )
find_package( Qt5Gui     REQUIRED )
find_package( Qt5Widgets REQUIRED )

include(compiler)

include_directories( SYSTEM
    ${Qt5Core_INCLUDE_DIRS}
    ${Qt5Gui_INCLUDE_DIRS}
    ${Qt5Widgets_INCLUDE_DIRS}
)

set(SRC_LIST
    ${CMAKE_CURRENT_SOURCE_DIR}/controlcentre.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
)

include(qtmoc)
create_mocs( SRC_LIST MOC_LIST
    ${CMAKE_CURRENT_SOURCE_DIR}/controlcentre.h
)

add_executable( ${PROJECT_NAME}
    ${SRC_LIST}
)

target_link_libraries( ${PROJECT_NAME}
    ${Qt5Core_LIBRARIES}
    ${Qt5Gui_LIBRARIES}
    ${Qt5Widgets_LIBRARIES}
    mqtt-cpp
)

set_target_properties( ${PROJECT_NAME} PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
    LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
)

include(installation)
install_application()