Skip to content

Commit a9908cb

Browse files
committed
use qt5 libraries
1 parent 63fb6ff commit a9908cb

File tree

3 files changed

+17
-24
lines changed

3 files changed

+17
-24
lines changed

CMakeLists.txt

+7-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 2.6)
1+
cmake_minimum_required(VERSION 2.8.8)
22

33
project(demo-rpg)
44
set(target demo-rpg)
@@ -9,9 +9,9 @@ IF(NOT MSVC)
99
ADD_DEFINITIONS(-std=c++0x -Werror=return-type)
1010
ENDIF(NOT MSVC)
1111

12-
13-
find_package(Qt4 COMPONENTS QtCore QtGui QtXml REQUIRED)
14-
include(${QT_USE_FILE})
12+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
13+
set(CMAKE_AUTOMOC ON)
14+
find_package(Qt5Core REQUIRED)
1515

1616
include_directories("include" "lib/tmx/include" "lib/tmxrenderer/include" )
1717

@@ -36,22 +36,12 @@ set(sources
3636
src/MapEvent.cpp
3737
)
3838

39-
QT4_WRAP_CPP(moc_sources
40-
include/GameWidget.h
41-
include/GameRenderer.h
42-
include/Game.h
43-
include/Map.h
44-
include/EventTrigger.h
45-
include/Engine.h
46-
)
47-
#QT4_WRAP_UI(ui_headers ...)
48-
4939
add_subdirectory("lib")
5040

51-
add_executable(${target} ${sources} ${moc_sources} ${headers})
52-
53-
target_link_libraries(${target} tmx tmxrenderer ${QT_LIBRARIES})
41+
add_executable(${target} ${sources} ${headers})
5442

43+
target_link_libraries(${target} tmx tmxrenderer)
44+
qt5_use_modules(${target} Widgets Xml)
5545

5646
#copy data
5747
add_custom_command(

lib/tmx/CMakeLists.txt

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ IF(NOT MSVC)
77
ADD_DEFINITIONS(-std=c++0x -Werror=return-type)
88
ENDIF(NOT MSVC)
99

10+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
11+
set(CMAKE_AUTOMOC ON)
12+
find_package(Qt5Core REQUIRED)
1013
find_package(ZLIB REQUIRED)
11-
find_package(Qt4 COMPONENTS QtCore QtXml REQUIRED)
12-
include(${QT_USE_FILE})
1314

1415
include_directories("include")
1516

@@ -37,4 +38,5 @@ set(sources
3738

3839
add_library(${target} SHARED ${sources} ${headers})
3940

40-
target_link_libraries(${target} ${QT_LIBRARIES} ${ZLIB_LIBRARIES})
41+
target_link_libraries(${target} ${ZLIB_LIBRARIES})
42+
qt5_use_modules(${target} Widgets Xml)

lib/tmxrenderer/CMakeLists.txt

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ IF(NOT MSVC)
77
ADD_DEFINITIONS(-std=c++0x -Werror=return-type)
88
ENDIF(NOT MSVC)
99

10-
11-
find_package(Qt4 COMPONENTS QtCore REQUIRED)
12-
include(${QT_USE_FILE})
10+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
11+
set(CMAKE_AUTOMOC ON)
12+
find_package(Qt5Core REQUIRED)
1313

1414
include_directories("include" "../tmx/include")
1515

@@ -21,4 +21,5 @@ set(sources
2121

2222
add_library(${target} SHARED ${sources} ${headers})
2323

24-
target_link_libraries(${target} tmx ${QT_LIBRARIES})
24+
target_link_libraries(${target} tmx)
25+
qt5_use_modules(${target} Widgets)

0 commit comments

Comments
 (0)