CMake handle Qt6

This commit is contained in:
Martin Delille 2023-01-26 10:19:50 +01:00
parent 5975f82739
commit 76b4e5e3a7
No known key found for this signature in database
GPG Key ID: C073D887B6E32DE5
3 changed files with 24 additions and 6 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.DS_Store
*.pro.user
CMakeLists.txt.user
/*build*

View File

@ -1,15 +1,15 @@
project(QtAwesome)
add_library(QtAwesome
add_library(${PROJECT_NAME}
QtAwesome.cpp
QtAwesomeAnim.cpp
QtAwesome.qrc
)
target_include_directories(QtAwesome
PUBLIC ${PROJECT_SOURCE_DIR}
target_include_directories(${PROJECT_NAME}
INTERFACE ${PROJECT_SOURCE_DIR}
)
target_link_libraries(QtAwesome PUBLIC
Qt5::Widgets
target_link_libraries(${PROJECT_NAME} PUBLIC
Qt${QT_VERSION_MAJOR}::Widgets
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.16)
project(QtAwesomeSample)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
add_subdirectory(../QtAwesome QtAwesome)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME}
PUBLIC QtAwesome
)