@@ -28,28 +28,18 @@ PROJECT( pianobooster )
2828# enable warnings
2929ADD_DEFINITIONS (-Wall)
3030
31- # by default only QtCore and QtGui modules are enabled
32- # other modules must be enabled like this:
33- SET (QT_USE_QTOPENGL TRUE )
34- SET (QT_USE_QTXML TRUE )
35-
36-
3731FIND_PACKAGE ( OpenGL REQUIRED )
3832
39- # this command finds Qt4 libraries and sets all required variables
40- # note that it's Qt4, not QT4 or qt4
41- FIND_PACKAGE ( Qt4 REQUIRED )
42-
43- # add some useful macros and variables
44- # (QT_USE_FILE is a variable defined by FIND_PACKAGE( Qt4 ) that contains a path to CMake script)
45- INCLUDE ( ${QT_USE_FILE} )
33+ # Find the QtWidgets library
34+ find_package (Qt5Widgets)
35+ find_package (Qt5Xml)
36+ find_package (Qt5OpenGL)
4637
4738IF (USE_PCH)
4839INCLUDE (precompile/PCHSupport_26.cmake)
4940INCLUDE_DIRECTORIES ( precompile .)
5041ENDIF (USE_PCH)
5142
52-
5343# Add in the link libraries for each operating system
5444IF (${CMAKE_SYSTEM} MATCHES "Linux" )
5545 #FIND_PACKAGE(PkgConfig REQUIRED)
@@ -100,12 +90,6 @@ ENDIF(USE_FLUIDSYNTH)
10090# (CMAKE_BINARY_DIR holds a path to the build directory, while INCLUDE_DIRECTORIES() works just like INCLUDEPATH from qmake)
10191INCLUDE_DIRECTORIES ( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ${OPENGL_INCLUDE_DIR} )
10292
103- # tell CMake what libraries our executable needs,
104- # luckily FIND_PACKAGE prepared QT_LIBRARIES variable for us:
105- LINK_LIBRARIES ( ${QT_LIBRARIES} )
106-
107-
108-
10993SET (PB_BASE_SRCS MidiFile.cpp MidiTrack.cpp Song.cpp Conductor.cpp Util.cpp
11094 Chord.cpp Tempo.cpp MidiDevice.cpp MidiDeviceRt.cpp rtmidi/RtMidi.cpp ${PB_BASE_SRCS} )
11195SET (PB_BASE_HDR MidiFile.h MidiTrack.h Song.h Conductor.h Rating.h Util.h
@@ -175,16 +159,10 @@ SET( PIANOBOOSTER_RCS
175159 ./application.qrc
176160)
177161
178- # this command will generate rules that will run rcc on all files from PIANOBOOSTER_RCS
179- # in result PIANOBOOSTER_RC_SRCS variable will contain paths to files produced by rcc
180- QT4_ADD_RESOURCES( PIANOBOOSTER_RC_SRCS ${PIANOBOOSTER_RCS} )
181-
182- # this will run uic on .ui files:
183- QT4_WRAP_UI( PIANOBOOSTER_UI_HDRS ${PIANOBOOSTER_UIS} )
184-
185- # and finally this will run moc:
186- QT4_WRAP_CPP( PIANOBOOSTER_MOC_SRCS ${PIANOBOOSTER_MOC_HDRS} )
187-
162+ set (CMAKE_AUTOMOC ON )
163+ set (CMAKE_AUTOUIC ON )
164+ set (CMAKE_AUTORCC ON )
165+ set (CMAKE_INCLUDE_CURRENT_DIR ON )
188166
189167# here we instruct CMake to build "pianobooster" executable from all of the source files
190168IF (APPLE )
@@ -211,6 +189,7 @@ IF (USE_PCH)
211189ADD_PRECOMPILED_HEADER( pianobooster ${CMAKE_CURRENT_SOURCE_DIR} /precompile/precompile.h )
212190ENDIF (USE_PCH)
213191
192+ target_link_libraries (pianobooster Qt5::Widgets Qt5::Xml Qt5::OpenGL)
214193
215194INSTALL ( FILES pianobooster.desktop DESTINATION share/applications )
216195INSTALL (TARGETS pianobooster RUNTIME DESTINATION bin)
0 commit comments