Skip to content

Commit

Permalink
[CMake] Fixed Qt Discovery (#1368)
Browse files Browse the repository at this point in the history
- Fixed handling of legacy HAS_QT5 option
- qt_msvc_path now sets the legacy Qt5 / Qt6 variables (with version) as well.
  • Loading branch information
FlorianReimold committed Feb 16, 2024
1 parent a892451 commit 2893f8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ endif()
# use it that way cmake .. -DBUILD_APPS=ON -DBUILD_SAMPLES=ON
# --------------------------------------------------------
option(HAS_HDF5 "Platform supports HDF5 library" ON)
option(HAS_QT "Platform supports Qt 5 / 6 library." ON)

# If the user set the legacy HAS_QT5 option, but didn't set the new HAS_QT option, set it to the value of HAS_QT5
if(DEFINED HAS_QT5 AND NOT DEFINED HAS_QT)
set(HAS_QT ${HAS_QT5})
message(WARNING "The option HAS_QT5 is deprecated and may be removed at any time. Please use HAS_QT instead.")
endif()

option(HAS_QT "Platform supports Qt 5 / 6 library." ON)

option(HAS_CURL "Build with CURL (i.e. upload support in the recorder app)" ON)
option(HAS_CAPNPROTO "Platform supports Cap'n Proto library" OFF)
option(HAS_FLATBUFFERS "Platform supports flatbuffers library" OFF)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,14 @@ macro(autodetect_qt_msvc_dir)
endif()

message(STATUS "Using Qt ${BEST_QT_MAJOR}.${BEST_QT_MINOR}.${BEST_QT_PATCH} MSVC ${BEST_QT_MSVC_YEAR} from ${BEST_QT_DIRECTORY}")

# Dirs for legacy targets with version:
SET(Qt${BEST_QT_MAJOR}_DIR "${BEST_QT_DIRECTORY}/lib/cmake/Qt${BEST_QT_MAJOR}/")
SET(Qt${BEST_QT_MAJOR}Test_DIR "${BEST_QT_DIRECTORY}/lib/cmake/Qt${BEST_QT_MAJOR}Test")

# Dirs for modern version-less targets
SET(QT_DIR "${BEST_QT_DIRECTORY}/lib/cmake/Qt${BEST_QT_MAJOR}/")
SET(QTTest_DIR "${BEST_QT_DIRECTORY}/lib/cmake/Qt${BEST_QT_MAJOR}Test")

endif()
endmacro()

0 comments on commit 2893f8c

Please sign in to comment.