Skip to content

Commit

Permalink
replace Qt_VERSION_MAJOR with the more standard QT_VERSION_MAJOR
Browse files Browse the repository at this point in the history
  • Loading branch information
winterz authored and dfaure-kdab committed Jan 5, 2024
1 parent 18d29f7 commit 6b9d75b
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 21 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
endif()

if(${PROJECT_NAME}_QT6)
set(Qt_VERSION_MAJOR 6)
set(QT_VERSION_MAJOR 6)
set(QT_MIN_VERSION "6.0.0")
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Network)
list(APPEND QT_LIBRARIES Qt6::Core Qt6::Network)
set(${PROJECT_NAME}_LIBRARY_QTID "-qt6")
set(libkode_QT6 ON)
else()
set(Qt_VERSION_MAJOR 5)
set(QT_VERSION_MAJOR 5)
# Qt 5.9 required for QNetworkRequest::NoLessSafeRedirectPolicy
set(QT_MIN_VERSION "5.9.0")
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Network)
Expand Down Expand Up @@ -247,7 +247,7 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)

# Generate .pri file for qmake users (except when using the VS generator)
if(NOT CMAKE_CONFIGURATION_TYPES)
if(Qt_VERSION_MAJOR EQUAL 5 OR (Qt_VERSION_MAJOR EQUAL 6 AND Qt6Core_VERSION VERSION_GREATER "6.2"))
if(QT_VERSION_MAJOR EQUAL 5 OR (QT_VERSION_MAJOR EQUAL 6 AND Qt6Core_VERSION VERSION_GREATER "6.2"))
include(ECMGeneratePriFile)
ecm_generate_pri_file(
BASE_NAME
Expand Down
4 changes: 2 additions & 2 deletions KDSoapConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

include(CMakeFindDependencyMacro)

find_dependency(Qt@Qt_VERSION_MAJOR@Core @QT_MIN_VERSION@)
find_dependency(Qt@Qt_VERSION_MAJOR@Network @QT_MIN_VERSION@)
find_dependency(Qt@QT_VERSION_MAJOR@Core @QT_MIN_VERSION@)
find_dependency(Qt@QT_VERSION_MAJOR@Network @QT_MIN_VERSION@)

set_and_check(KDSoap_INCLUDE_DIR "@PACKAGE_INSTALL_INCLUDE_DIR@")

Expand Down
2 changes: 1 addition & 1 deletion KDSoapMacros.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ macro(KDSOAP_GENERATE_WSDL _sources)
SKIP_AUTOMOC ON
SKIP_AUTOUIC ON
)
qt@Qt_VERSION_MAJOR@_wrap_cpp(_sources_MOCS ${_header_wsdl_FILE})
qt@QT_VERSION_MAJOR@_wrap_cpp(_sources_MOCS ${_header_wsdl_FILE})
list(APPEND ${_sources} ${_header_wsdl_FILE} ${_source_wsdl_FILE} ${_sources_MOCS})
endforeach()
endmacro()
17 changes: 10 additions & 7 deletions cmake/KDAB/modules/KDQtInstallPaths.cmake
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#
# SPDX-FileCopyrightText: 2016-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
# SPDX-FileCopyrightText: 2016 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]>
# Author: Allen Winter <[email protected]>
#
# SPDX-License-Identifier: BSD-3-Clause
#

# Assumes you've already found Qt and Qt_VERSION_MAJOR is set
# Assumes you've already found Qt and QT_VERSION_MAJOR is set
#
# Create variables for all the various install paths for the Qt version in use
# Make sure to have found Qt before using this.
# sets variables like QT_INSTALL_PREFIX, QT_INSTALL_DATA, QT_INSTALL_DOCS, etc.
# run qmake -query to see a full list

if(NOT DEFINED Qt_VERSION_MAJOR)
message(FATAL_ERROR "Please set Qt_VERSION_MAJOR first (ie. set(Qt_VERSION_MAJOR 5))")
if(NOT DEFINED QT_VERSION_MAJOR)
message(FATAL_ERROR "Please set QT_VERSION_MAJOR first (ie. set(QT_VERSION_MAJOR 5))")
endif()

if(TARGET Qt${Qt_VERSION_MAJOR}::qmake)
get_target_property(QT_QMAKE_EXECUTABLE Qt${Qt_VERSION_MAJOR}::qmake LOCATION)
if(TARGET Qt${QT_VERSION_MAJOR}::qmake)
get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qmake LOCATION)
else()
message(FATAL_ERROR "No supported Qt version found. Make sure you find Qt before calling this")
endif()
Expand Down Expand Up @@ -46,7 +46,10 @@ foreach(qval ${VARS_LIST})
list(GET QVAL_LIST 1 path)
endif()
if(NOT ${var}) #if set already on the command line for example
set(${var} ${path} CACHE PATH "Qt install path for ${var}")
set(${var}
${path}
CACHE PATH "Qt install path for ${var}"
)
endif()
endif()
endforeach()
4 changes: 2 additions & 2 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#

find_package(
Qt${Qt_VERSION_MAJOR} ${QT_MIN_VERSION}
Qt${QT_VERSION_MAJOR} ${QT_MIN_VERSION}
COMPONENTS Widgets CONFIG
REQUIRED
)
list(APPEND QT_LIBRARIES Qt${Qt_VERSION_MAJOR}::Widgets)
list(APPEND QT_LIBRARIES Qt${QT_VERSION_MAJOR}::Widgets)

include(${CMAKE_BINARY_DIR}/KDSoap/KDSoapMacros.cmake)
include_directories(../src/ ../src/KDSoapClient/ ../src/KDSoapServer/)
Expand Down
4 changes: 2 additions & 2 deletions kdwsdl2cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#

find_package(
Qt${Qt_VERSION_MAJOR} ${QT_MIN_VERSION}
Qt${QT_VERSION_MAJOR} ${QT_MIN_VERSION}
COMPONENTS Xml CONFIG
REQUIRED
) #libkode requires Xml
list(APPEND QT_LIBRARIES Qt${Qt_VERSION_MAJOR}::Xml)
list(APPEND QT_LIBRARIES Qt${QT_VERSION_MAJOR}::Xml)

include_directories(libkode)

Expand Down
4 changes: 2 additions & 2 deletions testtools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#

find_package(
Qt${Qt_VERSION_MAJOR} ${QT_MIN_VERSION}
Qt${QT_VERSION_MAJOR} ${QT_MIN_VERSION}
COMPONENTS Xml CONFIG
REQUIRED
)
list(APPEND QT_LIBRARIES Qt${Qt_VERSION_MAJOR}::Xml)
list(APPEND QT_LIBRARIES Qt${QT_VERSION_MAJOR}::Xml)

include_directories(.. ../src/KDSoapClient)

Expand Down
4 changes: 2 additions & 2 deletions unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#

find_package(
Qt${Qt_VERSION_MAJOR} ${QT_MIN_VERSION}
Qt${QT_VERSION_MAJOR} ${QT_MIN_VERSION}
COMPONENTS Test CONFIG
REQUIRED
)
list(APPEND QT_LIBRARIES Qt${Qt_VERSION_MAJOR}::Test)
list(APPEND QT_LIBRARIES Qt${QT_VERSION_MAJOR}::Test)

include_directories(
../src/
Expand Down

0 comments on commit 6b9d75b

Please sign in to comment.