File tree Expand file tree Collapse file tree 2 files changed +27
-12
lines changed
Expand file tree Collapse file tree 2 files changed +27
-12
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ add_subdirectory(external)
3737
3838
3939# Find the QtWidgets library
40- find_package (Qt6
40+ find_package (Qt6 QUIET
4141 COMPONENTS
4242 Core
4343 Widgets
@@ -46,7 +46,7 @@ find_package(Qt6
4646)
4747
4848if (NOT Qt6_FOUND)
49- find_package (Qt5 5.13
49+ find_package (Qt5 QUIET
5050 COMPONENTS
5151 Core
5252 Widgets
@@ -59,8 +59,13 @@ if (NOT (Qt6_FOUND OR Qt5_FOUND))
5959 message (FATAL_ERRROR "Qt libraries were not found." )
6060endif ()
6161
62-
63- qt_add_resources(RESOURCES ./resources/resources.qrc)
62+ if (Qt6_FOUND)
63+ qt_add_resources(RESOURCES ./resources/resources.qrc)
64+ set (Qt Qt)
65+ else ()
66+ qt5_add_resources(RESOURCES ./resources/resources.qrc)
67+ set (Qt Qt5)
68+ endif ()
6469
6570# Unfortunately, as we have a split include/src, AUTOMOC doesn't work.
6671# We'll have to manually specify some files
@@ -109,10 +114,10 @@ target_include_directories(nodes
109114
110115target_link_libraries (nodes
111116 PUBLIC
112- Qt ::Core
113- Qt ::Widgets
114- Qt ::Gui
115- Qt ::OpenGL
117+ ${Qt} ::Core
118+ ${Qt} ::Widgets
119+ ${Qt} ::Gui
120+ ${Qt} ::OpenGL
116121)
117122
118123target_compile_definitions (nodes
@@ -155,11 +160,19 @@ set_target_properties(nodes
155160
156161file (GLOB_RECURSE HEADERS_TO_MOC include /nodes/internal /*.hpp)
157162
158- qt_wrap_cpp (nodes_moc
159- ${HEADERS_TO_MOC}
163+ if (Qt6_FOUND)
164+ qt_wrap_cpp (nodes_moc
165+ ${HEADERS_TO_MOC}
166+ TARGET nodes
167+ OPTIONS --no -notes # Don't display a note for the headers which don't produce a moc_*.cpp
168+ )
169+ else ()
170+ qt5_wrap_cpp(nodes_moc
171+ ${HEADERS_TO_MOC}
160172 TARGET nodes
161173 OPTIONS --no -notes # Don't display a note for the headers which don't produce a moc_*.cpp
162- )
174+ )
175+ endif ()
163176
164177target_sources (nodes PRIVATE ${nodes_moc} )
165178
Original file line number Diff line number Diff line change @@ -2,8 +2,10 @@ find_package(Catch2 2.3.0 REQUIRED)
22
33if (Qt6_FOUND)
44 find_package (Qt6 COMPONENTS Test )
5+ set (Qt Qt)
56else ()
67 find_package (Qt5 COMPONENTS Test )
8+ set (Qt Qt5)
79endif ()
810
911add_executable (test_nodes
@@ -25,7 +27,7 @@ target_link_libraries(test_nodes
2527 PRIVATE
2628 NodeEditor::nodes
2729 Catch2::Catch2
28- Qt ::Test
30+ ${Qt} ::Test
2931)
3032
3133add_test (
You can’t perform that action at this time.
0 commit comments