Skip to content

Commit

Permalink
Add $() to reads from QT_VERSION_MAJOR
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuperino committed Apr 17, 2024
1 parent 0b6c700 commit c616fbd
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 22 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ find_package(
NO_MODULE
QUIET
)
if(QT_VERSION_MAJOR GREATER_EQUAL 6)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
find_package(
Qt${QT_VERSION_MAJOR}StateMachine
${Qt${QT_VERSION_MAJOR}_VERSION}
Expand All @@ -511,7 +511,7 @@ if(GAMMARAY_BUILD_DOCS)
find_package(Qt${QT_VERSION_MAJOR} NO_MODULE QUIET OPTIONAL_COMPONENTS Help LinguistTools)
endif()

if(QT_VERSION_MAJOR GREATER_EQUAL 6)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Expand Down Expand Up @@ -564,7 +564,7 @@ add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050500)
if(WARNINGS_ARE_ERRORS)
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=deprecated-declarations")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND QT_VERSION_MAJOR EQUAL 5)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND ${QT_VERSION_MAJOR} EQUAL 5)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=suggest-override") # Q_OBJECT expansion warnings
endif()

Expand Down Expand Up @@ -636,7 +636,7 @@ else()
set(GAMMARAY_CORE_ONLY_LAUNCHER TRUE)
endif()

if(QT_VERSION_MAJOR EQUAL 5)
if(${QT_VERSION_MAJOR} EQUAL 5)
add_feature_info("QtScript debugger" Qt5ScriptTools_FOUND "Requires QtScript and QtScriptTools.")
endif()
add_feature_info("Widget .ui file export" HAVE_QT_DESIGNER "Requires QtDesigner library.")
Expand Down
2 changes: 1 addition & 1 deletion cmake/KDAB/modules/KDQtInstallPaths.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# 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)
if(NOT DEFINED ${QT_VERSION_MAJOR})
message(FATAL_ERROR "Please set QT_VERSION_MAJOR first (ie. set(QT_VERSION_MAJOR 5))")
endif()

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

# qdoc toolchain
find_package(Qt${QT_VERSION_MAJOR} NO_MODULE QUIET OPTIONAL_COMPONENTS Help)
if(QT_VERSION_MAJOR EQUAL 5)
if(${QT_VERSION_MAJOR} EQUAL 5)
find_package(Qt${QT_VERSION_MAJOR} NO_MODULE QUIET OPTIONAL_COMPONENTS AttributionsScannerTools)
elseif(QT_VERSION_MAJOR GREATER_EQUAL 6)
elseif(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
find_package(Qt${QT_VERSION_MAJOR} NO_MODULE QUIET OPTIONAL_COMPONENTS ToolsTools)
endif()

Expand Down
2 changes: 1 addition & 1 deletion docs/collection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#

find_package(Qt${QT_VERSION_MAJOR} NO_MODULE QUIET OPTIONAL_COMPONENTS Help)
if(QT_VERSION_MAJOR GREATER_EQUAL 6)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
find_package(Qt${QT_VERSION_MAJOR} NO_MODULE QUIET OPTIONAL_COMPONENTS ToolsTools)
endif()
if(NOT TARGET Qt::qhelpgenerator)
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
add_subdirectory(quick-batching)
add_subdirectory(quick-event-handling)

if((QT_VERSION_MAJOR EQUAL 5) OR (QT_VERSION_MAJOR EQUAL 6 AND TARGET Qt6::StateMachine))
if((${QT_VERSION_MAJOR} EQUAL 5) OR (${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::StateMachine))
add_subdirectory(state-machine)
endif()

Expand Down
2 changes: 1 addition & 1 deletion examples/quick-batching/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

qml_lint(quick-batching.qml)

if(QT_VERSION_MAJOR GREATER_EQUAL 6)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qml_lint(Slider.qml)
endif()
6 changes: 3 additions & 3 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
# Contact KDAB at <[email protected]> for commercial licensing options.
#

if(QT_VERSION_MAJOR EQUAL 5 AND TARGET Qt5::Core)
if(${QT_VERSION_MAJOR} EQUAL 5 AND TARGET Qt5::Core)
add_subdirectory(codecbrowser)
endif()
if((QT_VERSION_MAJOR EQUAL 5) OR (QT_VERSION_MAJOR EQUAL 6 AND TARGET Qt6::StateMachine))
if((${QT_VERSION_MAJOR} EQUAL 5) OR (${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::StateMachine))
add_subdirectory(statemachineviewer)
else()
message(STATUS "WARNING: Skipping the statemachineviewer plugin since Qt6StateMachine was not found")
Expand All @@ -35,7 +35,7 @@ if(TARGET Qt::Gui)
add_subdirectory(guisupport)
add_subdirectory(textdocumentinspector)
endif()
if((QT_VERSION_MAJOR EQUAL 5 AND TARGET Qt5::Gui) OR (QT_VERSION_MAJOR EQUAL 6 AND TARGET Qt6::OpenGL))
if((${QT_VERSION_MAJOR} EQUAL 5 AND TARGET Qt5::Gui) OR (${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::OpenGL))
add_subdirectory(openglsupport)
endif()

Expand Down
3 changes: 3 additions & 0 deletions plugins/network/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
networksupportinterface.h
)
if(${QT_VERSION_MAJOR} EQUAL 5 AND TARGET Qt5::Network)
message("6 ${QT_VERSION_MAJOR}")
message(${QT_VERSION_MAJOR})
message(QT_VERSION_MAJOR)
list(APPEND gammaray_network_srcs networkconfigurationmodel.cpp networkconfigurationmodel.h)
endif()
gammaray_add_plugin(
Expand Down
2 changes: 1 addition & 1 deletion plugins/openglsupport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
openglsupport.h
)
target_link_libraries(gammaray_openglsupport gammaray_core Qt::Gui Qt::CorePrivate)
if(QT_VERSION_MAJOR EQUAL 6 AND TARGET Qt6::OpenGL)
if(${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::OpenGL)
target_link_libraries(gammaray_openglsupport Qt6::OpenGL)
endif()
endif()
4 changes: 2 additions & 2 deletions plugins/statemachineviewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
if(TARGET Qt::Scxml)
target_link_libraries(gammaray_statemachineviewer_plugin Qt::Scxml Qt::ScxmlPrivate)
endif()
if(QT_VERSION_MAJOR EQUAL 6 AND TARGET Qt6::StateMachine)
if(${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::StateMachine)
target_link_libraries(gammaray_statemachineviewer_plugin Qt6::StateMachine Qt6::StateMachinePrivate)
endif()
endif()
Expand Down Expand Up @@ -83,7 +83,7 @@ if(GAMMARAY_BUILD_UI AND GAMMARAY_WITH_KDSME)
gammaray_ui
)

if(QT_VERSION_MAJOR EQUAL 6 AND TARGET Qt6::StateMachine)
if(${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::StateMachine)
target_link_libraries(gammaray_statemachineviewer_ui_plugin Qt6::StateMachine)
endif()
endif()
8 changes: 4 additions & 4 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ target_link_libraries(
fontdatabasemodeltest Qt::Gui
)

if(QT_VERSION_MAJOR EQUAL 5 AND TARGET Qt5::Core)
if(${QT_VERSION_MAJOR} EQUAL 5 AND TARGET Qt5::Core)
gammaray_add_test(
codecmodeltest codecmodeltest.cpp ${CMAKE_SOURCE_DIR}/plugins/codecbrowser/codecmodel.cpp
$<TARGET_OBJECTS:modeltestobj>
Expand Down Expand Up @@ -518,7 +518,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
)

# only opengl rhi backend is supported atm
if(QT_VERSION_MAJOR EQUAL 6 AND TARGET Qt6::Quick)
if(${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::Quick)
set_tests_properties(
quickinspectortest PROPERTIES ENVIRONMENT "QT_QUICK_BACKEND=rhi;QSG_RHI_BACKEND=opengl"
)
Expand All @@ -528,7 +528,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
quickinspectortest2 quickinspectortest2.cpp quickinspectortest.qrc $<TARGET_OBJECTS:modeltestobj>
)
target_link_libraries(quickinspectortest2 gammaray_core gammaray_quickinspector_shared Qt::Quick)
if(QT_VERSION_MAJOR EQUAL 6 AND TARGET Qt6::Quick)
if(${QT_VERSION_MAJOR} EQUAL 6 AND TARGET Qt6::Quick)
set_tests_properties(
quickinspectortest2 PROPERTIES ENVIRONMENT "QT_QUICK_BACKEND=rhi;QSG_RHI_BACKEND=opengl"
)
Expand Down Expand Up @@ -562,7 +562,7 @@ if(NOT GAMMARAY_CLIENT_ONLY_BUILD)
gammaray_add_quick_test(
quickmaterialtest quickmaterialtest.cpp quickinspectortest.qrc $<TARGET_OBJECTS:modeltestobj>
)
if(QT_VERSION_MAJOR GREATER_EQUAL 6)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
find_package(Qt6ShaderTools)
if(Qt6ShaderTools_FOUND)
qt6_add_shaders(
Expand Down
4 changes: 2 additions & 2 deletions tests/manual/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if(TARGET Qt::Widgets)
add_dependencies(translator_test translator_test_qm)
endif()

if(QT_VERSION_MAJOR EQUAL 5 AND Qt5Webkit_FOUND)
if(${QT_VERSION_MAJOR} EQUAL 5 AND Qt5Webkit_FOUND)
add_executable(wk1application wk1application.cpp)
target_link_libraries(
wk1application
Expand All @@ -58,7 +58,7 @@ if(QT_VERSION_MAJOR EQUAL 5 AND Qt5Webkit_FOUND)
)
endif()

if(QT_VERSION_MAJOR EQUAL 5
if(${QT_VERSION_MAJOR} EQUAL 5
AND Qt5WebKit_FOUND
AND TARGET Qt::Quick
)
Expand Down

0 comments on commit c616fbd

Please sign in to comment.