CMakeLists.txt 1.46 KB
Newer Older
Hurstel's avatar
Hurstel committed
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
cmake_minimum_required (VERSION 3.1)

SET( MOD_NAME UI )

SET( MOD_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR} )




set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

find_package(Qt5 COMPONENTS Quick Core Gui Qml Widgets OpenGL)

set(CMAKE_AUTOMOC ON)

SET(QML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qml)

file(GLOB_RECURSE QRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.qrc)
file(GLOB_RECURSE QML_FILES ${QML_DIR}/*.qml)

qt5_add_resources(QT_RESOURCES ${QRC_FILES})

INCLUDE_DIRECTORIES(
    ${CORE_INCLUDE_DIR}
    ${MOD_ROOT_DIR}
    ${MOD_ROOT_DIR}/include
    ${CMAKE_CURRENT_BINARY_DIR}
)

file(
        GLOB_RECURSE
        MOD_FILES
        ${MOD_ROOT_DIR}/*.h
        ${MOD_ROOT_DIR}/src/*.cpp
        ${MOD_ROOT_DIR}/include/*.h
        ${MOD_ROOT_DIR}/include/*.hpp
)

set(MOD_FILES ${MOD_FILES} ${QRC_FILES} ${QML_FILES})

set(MODS ${MODS} PARENT_SCOPE)

SET(MOD_LINK_LIBS ${QT_RESOURCES} Threads::Threads)

if( ${Qt5Quick_VERSION} VERSION_GREATER_EQUAL 5.11.0 )
    SET(MOD_LINK_LIBS ${MOD_LINK_LIBS} ${Qt5Quick_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Qml_LIBRARIES} ${Q5Widgets_LIBRARIES} ${Qt5OpenGL_LIBRARIES})
endif ( ${Qt5Quick_VERSION} VERSION_GREATER_EQUAL 5.11.0 )

set(MOD_DEPENDENCIES ${MOD_DEPENDENCIES})

base_mod_compile()

if( ${Qt5Quick_VERSION} VERSION_LESS 5.11.0 )
    qt5_use_modules(${MOD_NAME} Quick Core Gui Qml Widgets OpenGL)
endif( ${Qt5Quick_VERSION} VERSION_LESS 5.11.0 )

set(MODS ${MODS} PARENT_SCOPE)
SET(MOD_DIRS ${MOD_DIRS} PARENT_SCOPE)