forked from qmlbook/qt6book
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request qmlbook#97 from qmlbook/fix-ch12-networking
Fixed the oauth example (cmake configuration was clunky).
- Loading branch information
Showing
6 changed files
with
30 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,31 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
cmake_minimum_required(VERSION 3.16.0) | ||
|
||
project(SpotifyOAuth VERSION 0.1 LANGUAGES CXX) | ||
project(SpotifyOAuth VERSION 1.0.0 LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
set(CMAKE_AUTOUIC ON) | ||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Quick QuickControls2 Network NetworkAuth REQUIRED) | ||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick QuickControls2 Network NetworkAuth REQUIRED) | ||
find_package(Qt6 COMPONENTS Core Quick QuickControls2 Network NetworkAuth REQUIRED) | ||
|
||
set( | ||
PROJECT_SOURCES | ||
main.cpp | ||
qt_add_executable(SpotifyOAuth main.cpp) | ||
|
||
qt_add_qml_module(SpotifyOAuth | ||
VERSION 1.0.0 | ||
URI Spotify | ||
QML_FILES | ||
main.qml | ||
SOURCES | ||
spotifyapi.h spotifyapi.cpp | ||
spotifymodel.h spotifymodel.cpp | ||
qml.qrc | ||
) | ||
|
||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) | ||
qt_add_executable(SpotifyOAuth MANUAL_FINALIZATION ${PROJECT_SOURCES}) | ||
else() | ||
add_executable(SpotifyOAuth ${PROJECT_SOURCES}) | ||
endif() | ||
|
||
target_compile_definitions( | ||
SpotifyOAuth | ||
PRIVATE | ||
$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG> | ||
) | ||
|
||
target_link_libraries( | ||
SpotifyOAuth | ||
PRIVATE | ||
Qt${QT_VERSION_MAJOR}::Core | ||
Qt${QT_VERSION_MAJOR}::Quick | ||
Qt${QT_VERSION_MAJOR}::QuickControls2 | ||
Qt${QT_VERSION_MAJOR}::Network | ||
Qt${QT_VERSION_MAJOR}::NetworkAuth | ||
) | ||
|
||
set_target_properties( | ||
SpotifyOAuth | ||
PROPERTIES | ||
QT_QML_MODULE_URI SpotifyOAuth | ||
QT_QML_MODULE_VERSION 1.0 | ||
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com | ||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} | ||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} | ||
set_target_properties(SpotifyOAuth PROPERTIES | ||
WIN32_EXECUTABLE TRUE | ||
MACOSX_BUNDLE TRUE | ||
) | ||
|
||
if(QT_VERSION_MAJOR EQUAL 6) | ||
qt6_qml_type_registration(SpotifyOAuth) | ||
qt_import_qml_plugins(SpotifyOAuth) | ||
qt_finalize_executable(SpotifyOAuth) | ||
endif() | ||
target_link_libraries(SpotifyOAuth PRIVATE Qt6::Core Qt6::Quick Qt6::QuickControls2 Qt6::Network Qt6::NetworkAuth) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters