framelesshelper/examples/QQPlayer-demo/CMakeLists.txt

47 lines
1.3 KiB
CMake

cmake_minimum_required(VERSION 3.15)
project(QQPlayer LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(WIN32)
set(CMAKE_DEBUG_POSTFIX "d")
else()
set(CMAKE_DEBUG_POSTFIX "_debug")
endif()
find_package(Qt5 COMPONENTS Core Quick QuickCompiler REQUIRED)
set(source_files images.qrc main.cpp ../../framelessquickhelper.h ../../framelessquickhelper.cpp)
if(WIN32)
enable_language(RC)
list(APPEND source_files QQPlayer.exe.manifest QQPlayer.rc ../../winnativeeventfilter.h ../../winnativeeventfilter.cpp)
else()
list(APPEND source_files ../../framelesshelper.h ../../framelesshelper.cpp)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND source_files qml.qrc)
else()
set(qml_files "")
qtquick_compiler_add_resources(qml_files qml.qrc)
list(APPEND source_files ${qml_files})
endif()
add_executable(QQPlayer ${source_files})
if(MSVC)
target_compile_options(QQPlayer PRIVATE -utf-8)
endif()
target_compile_definitions(QQPlayer PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
target_link_libraries(QQPlayer PRIVATE Qt::Core Qt::Quick Qt::GuiPrivate)