Clean up Qt CMakeLists

This commit is contained in:
Jeffrey Pfau 2014-10-13 01:25:39 -07:00
parent dd1387732d
commit eef1a5e8a3
1 changed files with 6 additions and 13 deletions

View File

@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 2.8.8)
project(mGBA-Qt)
set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wextra --std=c++11")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -Wextra --std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Wall -Wextra --std=c++11")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -Wall -Wextra --std=c++11")
if(BUILD_SDL)
find_package(SDL 1.2 REQUIRED)
@ -14,17 +14,10 @@ endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(REQUIRES "Qt5Widgets")
find_package(Qt5Widgets)
find_package(OpenGL)
if(APPLE)
find_package(OpenGL REQUIRED)
else()
list(APPEND REQUIRES "OpenGL")
endif()
find_feature(BUILD_QT ${REQUIRES})
if(NOT BUILD_QT)
if(NOT Qt5Widgets_FOUND OR NOT OPENGL_FOUND)
set(BUILD_QT OFF PARENT_SCOPE)
return()
endif()
@ -41,4 +34,4 @@ set_source_files_properties(${CMAKE_SOURCE_DIR}/res/mgba.icns PROPERTIES MACOSX_
add_executable(mGBA WIN32 MACOSX_BUNDLE main.cpp ${CMAKE_SOURCE_DIR}/res/mgba.icns ${SOURCE_FILES})
qt5_use_modules(mGBA Widgets Multimedia OpenGL)
target_link_libraries(mGBA ${PLATFORM_LIBRARY} ${OPENGL_LIBRARY} ${BINARY_NAME})
target_link_libraries(mGBA ${PLATFORM_LIBRARY} ${OPENGL_LIBRARY} ${BINARY_NAME} Qt5::Widgets)