File tree Expand file tree Collapse file tree 4 files changed +23
-50
lines changed Expand file tree Collapse file tree 4 files changed +23
-50
lines changed Original file line number Diff line number Diff line change @@ -13,22 +13,18 @@ set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "verbose")
13
13
SET (CMAKE_AUTOUIC ON )
14
14
SET (CMAKE_AUTOMOC ON )
15
15
SET (CMAKE_AUTORCC ON )
16
- SET (CMAKE_VERBOSE_MAKEFILE ON )
17
16
18
17
#需要的QT组件
19
18
if (CMAKE_VERSION VERSION_LESS "3.7.0" )
20
19
set (CMAKE_INCLUDE_CURRENT_DIR ON )
21
20
endif ()
22
- SET (QT_COMPONENTS Widgets )
21
+ SET (QT_COMPONENTS Core )
23
22
find_package (QT NAMES Qt6 Qt5 COMPONENTS Core )
24
23
find_package (Qt${QT_VERSION_MAJOR} COMPONENTS ${QT_COMPONENTS} )
25
24
message ("QT_VERSION:${Qt${QT_VERSION_MAJOR} _VERSION}" )
26
- if (Qt${QT_VERSION_MAJOR}_VERSION VERSION_LESS 5.10.0 AND ANDROID )
27
- message (FATAL_ERROR "Qt must great 5.10.0" )
28
- endif ()
29
25
if (Qt${QT_VERSION_MAJOR}_FOUND )
30
26
FOREACH (_COMPONENT ${QT_COMPONENTS} )
31
- SET ( QT_LIBRARIES ${ QT_LIBRARIES} Qt${QT_VERSION_MAJOR}::${_COMPONENT} )
27
+ list ( APPEND QT_LIBRARIES Qt${QT_VERSION_MAJOR}::${_COMPONENT} )
32
28
ENDFOREACH ()
33
29
endif ()
34
30
get_filename_component (QT_INSTALL_DIR "${Qt${QT_VERSION_MAJOR} _DIR}/../../.." ABSOLUTE )
@@ -133,7 +129,7 @@ endif()
133
129
134
130
add_subdirectory (src )
135
131
136
- option (BUILD_EXAMPLES "Build examples" ON )
132
+ option (BUILD_EXAMPLES "Build examples" OFF )
137
133
if (BUILD_EXAMPLES )
138
134
add_subdirectory (examples )
139
135
endif (BUILD_EXAMPLES )
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ project(interactive)
6
6
if (CMAKE_VERSION VERSION_LESS "3.7.0" )
7
7
set (CMAKE_INCLUDE_CURRENT_DIR ON )
8
8
endif ()
9
- SET (QT_COMPONENTS Core Gui Widgets )
9
+ SET (QT_LIBRARIES )
10
+ SET (QT_COMPONENTS Gui Widgets )
10
11
find_package (QT NAMES Qt6 Qt5 COMPONENTS Core )
11
12
find_package (Qt${QT_VERSION_MAJOR} COMPONENTS ${QT_COMPONENTS} )
12
13
message ("QT_VERSION:${Qt${QT_VERSION_MAJOR} _VERSION}" )
@@ -15,12 +16,12 @@ if(Qt${QT_VERSION_MAJOR}_VERSION VERSION_LESS 5.10.0 AND ANDROID)
15
16
endif ()
16
17
if (Qt${QT_VERSION_MAJOR}_FOUND )
17
18
FOREACH (_COMPONENT ${QT_COMPONENTS} )
18
- SET ( QT_LIBRARIES ${ QT_LIBRARIES} Qt${QT_VERSION_MAJOR}::${_COMPONENT} )
19
+ LIST ( APPEND QT_LIBRARIES Qt${QT_VERSION_MAJOR}::${_COMPONENT} )
19
20
ENDFOREACH ()
20
21
endif ()
21
22
get_filename_component (QT_INSTALL_DIR "${Qt${QT_VERSION_MAJOR} _DIR}/../../.." ABSOLUTE )
22
- message ("QT_INSTALL_DIR:${QT_INSTALL_DIR} " )
23
- message ("QT_LIBRARIES:${QT_LIBRARIES} " )
23
+ message ("${PROJECT_NAME} QT_INSTALL_DIR:${QT_INSTALL_DIR} " )
24
+ message ("${PROJECT_NAME} QT_LIBRARIES:${QT_LIBRARIES} " )
24
25
25
26
add_executable (${PROJECT_NAME} main.cpp )
26
27
target_link_libraries (${PROJECT_NAME} PRIVATE QtService ${QT_LIBRARIES} )
Original file line number Diff line number Diff line change @@ -7,25 +7,6 @@ if(CMAKE_VERSION VERSION_LESS "3.7.0")
7
7
set (CMAKE_INCLUDE_CURRENT_DIR ON )
8
8
endif ()
9
9
10
- list (APPEND QT_COMPONENTS Core Network )
11
- if (ANDROID )
12
- SET (QT_COMPONENTS ${QT_COMPONENTS} AndroidExtras )
13
- endif ()
14
- find_package (QT NAMES Qt6 Qt5 COMPONENTS Core )
15
- find_package (Qt${QT_VERSION_MAJOR} COMPONENTS ${QT_COMPONENTS} )
16
- message ("QT_VERSION:${Qt${QT_VERSION_MAJOR} _VERSION}" )
17
- if (Qt${QT_VERSION_MAJOR}_VERSION VERSION_LESS 5.10.0 AND ANDROID )
18
- message (FATAL_ERROR "Qt must great 5.10.0" )
19
- endif ()
20
- if (Qt${QT_VERSION_MAJOR}_FOUND )
21
- FOREACH (_COMPONENT ${QT_COMPONENTS} )
22
- SET (QT_LIBRARIES ${QT_LIBRARIES} Qt${QT_VERSION_MAJOR}::${_COMPONENT} )
23
- ENDFOREACH ()
24
- endif ()
25
- get_filename_component (QT_INSTALL_DIR "${Qt${QT_VERSION_MAJOR} _DIR}/../../.." ABSOLUTE )
26
- message ("QT_INSTALL_DIR:${QT_INSTALL_DIR} " )
27
- message ("QT_LIBRARIES:${QT_LIBRARIES} " )
28
-
29
10
add_executable (${PROJECT_NAME} main.cpp )
30
11
31
- target_link_libraries (${PROJECT_NAME} PRIVATE QtService ${QT_LIBRARIES} )
12
+ target_link_libraries (${PROJECT_NAME} PRIVATE QtService )
Original file line number Diff line number Diff line change 2
2
3
3
cmake_minimum_required (VERSION 3.5 )
4
4
5
- project (QtService )
6
-
7
- #需要的QT组件
8
5
if (CMAKE_VERSION VERSION_LESS "3.7.0" )
9
6
set (CMAKE_INCLUDE_CURRENT_DIR ON )
10
7
endif ()
11
- SET (QT_COMPONENTS Core )
8
+
9
+ project (QtService )
10
+
11
+ # Open qt complie tools
12
+ SET (CMAKE_AUTOUIC ON )
13
+ SET (CMAKE_AUTOMOC ON )
14
+ SET (CMAKE_AUTORCC ON )
15
+ SET (CMAKE_VERBOSE_MAKEFILE ON )
16
+
17
+ set (QT_COMPONENTS )
18
+ # Need qt components
12
19
if (UNIX )
13
20
list (APPEND QT_COMPONENTS Network )
14
21
endif ()
15
- if (ANDROID )
16
- SET (QT_COMPONENTS ${QT_COMPONENTS} AndroidExtras )
17
- endif ()
18
22
find_package (QT NAMES Qt6 Qt5 COMPONENTS Core )
19
23
find_package (Qt${QT_VERSION_MAJOR} COMPONENTS ${QT_COMPONENTS} )
20
24
message ("QT_VERSION:${Qt${QT_VERSION_MAJOR} _VERSION}" )
21
- if (Qt${QT_VERSION_MAJOR}_VERSION VERSION_LESS 5.10.0 AND ANDROID )
22
- message (FATAL_ERROR "Qt must great 5.10.0" )
23
- endif ()
24
25
if (Qt${QT_VERSION_MAJOR}_FOUND )
25
26
FOREACH (_COMPONENT ${QT_COMPONENTS} )
26
- SET ( QT_LIBRARIES ${ QT_LIBRARIES} Qt${QT_VERSION_MAJOR}::${_COMPONENT} )
27
+ LIST ( APPEND QT_LIBRARIES Qt${QT_VERSION_MAJOR}::${_COMPONENT} )
27
28
ENDFOREACH ()
28
29
endif ()
29
30
get_filename_component (QT_INSTALL_DIR "${Qt${QT_VERSION_MAJOR} _DIR}/../../.." ABSOLUTE )
30
- message ("QT_INSTALL_DIR:${QT_INSTALL_DIR} " )
31
- message ("QT_LIBRARIES:${QT_LIBRARIES} " )
32
-
33
- #打开 qt 编译工具
34
- SET (CMAKE_AUTOUIC ON )
35
- SET (CMAKE_AUTOMOC ON )
36
- SET (CMAKE_AUTORCC ON )
37
- SET (CMAKE_VERBOSE_MAKEFILE ON )
31
+ message ("${PROJECT_NAME} QT_INSTALL_DIR:${QT_INSTALL_DIR} " )
32
+ message ("${PROJECT_NAME} QT_LIBRARIES:${QT_LIBRARIES} " )
38
33
39
34
set (SOURCE_FILES
40
35
qtservice.cpp
You can’t perform that action at this time.
0 commit comments