fix(cmake): project not compiling under qt6 due to missing opengl widgets dependency
This commit is contained in:
		
							parent
							
								
									bfaab69daa
								
							
						
					
					
						commit
						f81964e395
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		| 
						 | 
					@ -14,6 +14,8 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
 | 
				
			||||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets LinguistTools)
 | 
					find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets LinguistTools)
 | 
				
			||||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools)
 | 
					find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set(TS_FILES editor_en_US.ts)
 | 
					set(TS_FILES editor_en_US.ts)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set(PROJECT_SOURCES
 | 
					set(PROJECT_SOURCES
 | 
				
			||||||
| 
						 | 
					@ -65,6 +67,16 @@ endif()
 | 
				
			||||||
target_include_directories(editor PUBLIC "../core/src" "../include")
 | 
					target_include_directories(editor PUBLIC "../core/src" "../include")
 | 
				
			||||||
target_link_libraries(editor PRIVATE openblocks Qt${QT_VERSION_MAJOR}::Widgets)
 | 
					target_link_libraries(editor PRIVATE openblocks Qt${QT_VERSION_MAJOR}::Widgets)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Qt6 does not include QOpenGLWidgets as part of Widgets base anymore, so
 | 
				
			||||||
 | 
					# we have to include it manually
 | 
				
			||||||
 | 
					if (${QT_VERSION} GREATER_EQUAL 6)
 | 
				
			||||||
 | 
					    find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS OpenGL OpenGLWidgets)
 | 
				
			||||||
 | 
					    find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS OpenGL OpenGLWidgets)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    target_include_directories(editor PUBLIC Qt6::OpenGL Qt6::OpenGLWidgets)
 | 
				
			||||||
 | 
					    target_link_libraries(editor PRIVATE Qt6::OpenGL Qt6::OpenGLWidgets)
 | 
				
			||||||
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
 | 
					# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
 | 
				
			||||||
# If you are developing for iOS or macOS you should consider setting an
 | 
					# If you are developing for iOS or macOS you should consider setting an
 | 
				
			||||||
# explicit, fixed bundle identifier manually though.
 | 
					# explicit, fixed bundle identifier manually though.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue