forked from qtgql/qtgql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
71 lines (54 loc) · 1.67 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
cmake_minimum_required(VERSION 3.22.0)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(QTGQL_VERSION 0.138.0)
project(
qtgql
VERSION ${QTGQL_VERSION}
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
if (WIN32)
set(CMAKE_OBJECT_PATH_MAX 500)
endif ()
find_package(Qt6 REQUIRED COMPONENTS Core Qml Quick WebSockets)
qt_standard_project_setup()
set(WINDOWS_EXPORT_ALL_SYMBOLS ON)
file(GLOB_RECURSE QTGQL_SOURCES "src/*.cpp" "src/*.hpp")
file(GLOB_RECURSE QTGQL_HEADERS "src/*.hpp")
add_library(${PROJECT_NAME} SHARED ${QTGQL_SOURCES}
src/qtgql/routers/detail/routers.cpp)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
target_compile_definitions(${PROJECT_NAME} PRIVATE QTGQL_CORE_LIB_SHARED_BUILD)
target_link_libraries(
${PROJECT_NAME}
PUBLIC
Qt6::Core
Qt6::WebSockets
Qt6::Network
)
# header files get added via FILE_SET
# BASE_DIR should point to the same directory that is used as the
# target_include_directory, otherwise the install paths may be off.
target_sources(${PROJECT_NAME} PUBLIC FILE_SET HEADERS
BASE_DIRS src
FILES
${QTGQL_HEADERS}
)
# install with headers
install(TARGETS ${PROJECT_NAME} FILE_SET HEADERS)
# --options--
option(QTGQL_VERBOSE "display helpful build information" true)
option(QTGQL_TESTING "Enable tests" FALSE)
# ───── LIBRARY TESTS ─────
if(QTGQL_TESTING)
if(QTGQL_VERBOSE)
message(STATUS "building tests")
endif()
include(CTest)
add_subdirectory(tests)
add_custom_target(
tidy
COMMAND run-clang-tidy -p ${CMAKE_BINARY_DIR}
COMMENT "cpp linter")
endif()