-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
56 lines (42 loc) · 1.75 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
cmake_minimum_required(VERSION 3.12)
project(MobileSharing LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_AUTOMOC ON)
################################################################################
if(NOT QT_DEFAULT_MAJOR_VERSION)
set(QT_DEFAULT_MAJOR_VERSION 6 CACHE STRING "Qt version to use (5 or 6), defaults to 6")
endif()
# Generic dependencies
set(CORE_COMPONENTS Core Gui Qml)
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED COMPONENTS ${CORE_COMPONENTS})
set(CORE_LIBRARIES Qt::Core Qt::Gui Qt::Qml)
# Generic sources
set(CORE_SOURCES
SharingApplication.cpp SharingApplication.h
SharingUtils.cpp SharingUtils.h)
# OS specific sources & dependencies
if (ANDROID)
if(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
set(PLATFORM_SOURCES
SharingUtils_android_qt6.cpp
SharingUtils_android.h)
set(PLATFORM_LIBRARIES Qt::CorePrivate)
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
set(PLATFORM_SOURCES
SharingUtils_android_qt5.cpp
SharingUtils_android.h)
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED COMPONENTS AndroidExtras)
set(PLATFORM_LIBRARIES Qt::AndroidExtras)
endif()
elseif (IOS)
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED COMPONENTS Quick)
set(PLATFORM_LIBRARIES Qt::Quick)
set(PLATFORM_SOURCES
SharingUtils_ios.mm
docviewcontroller_ios.mm)
endif()
################################################################################
add_library(MobileSharing OBJECT ${CORE_SOURCES} ${PLATFORM_SOURCES})
add_library(MobileSharing::MobileSharing ALIAS MobileSharing)
target_link_libraries(MobileSharing PRIVATE ${CORE_LIBRARIES} ${PLATFORM_LIBRARIES})
target_include_directories(MobileSharing PUBLIC ${CMAKE_CURRENT_LIST_DIR})