Skip to content

Commit

Permalink
BUILD: Explicitly encode minimum Qt version in CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzmbrzl committed Oct 3, 2024
1 parent c9eff88 commit ab7285f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmake/pkg-utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ endfunction()
# It also handles multiple package names and searches them with pkg-config if they are not found.
macro(find_pkg ARG_ALIASES)
# We specify "CONFIG", "MODULE" and "NO_MODULE" so that they are not considered unparsed arguments (passed to find_package()).
cmake_parse_arguments(FIND_PACKAGE "ARG_ALIASES;CONFIG;MODULE;NO_DEFAULT_PATH;NO_MODULE;REQUIRED;QUIET" "" "COMPONENTS;OPTIONAL_COMPONENTS;PATHS" ${ARGN})
cmake_parse_arguments(FIND_PACKAGE "ARG_ALIASES;CONFIG;MODULE;NO_DEFAULT_PATH;NO_MODULE;REQUIRED;QUIET" "VERSION" "COMPONENTS;OPTIONAL_COMPONENTS;PATHS" ${ARGN})

if(FIND_PACKAGE_PATHS)
list(APPEND FIND_PACKAGE_ARGUMENTS "PATHS" ${FIND_PACKAGE_PATHS})
Expand All @@ -74,21 +74,21 @@ macro(find_pkg ARG_ALIASES)

if(FIND_PACKAGE_COMPONENTS)
foreach(COMPONENT ${FIND_PACKAGE_COMPONENTS})
find_package(${NAME} COMPONENTS ${COMPONENT} ${FIND_PACKAGE_ARGUMENTS} ${QUIET_STR} CONFIG ${FIND_PACKAGE_UNPARSED_ARGUMENTS})
find_package(${NAME} ${FIND_PACKAGE_VERSION} COMPONENTS ${COMPONENT} ${FIND_PACKAGE_ARGUMENTS} ${QUIET_STR} CONFIG ${FIND_PACKAGE_UNPARSED_ARGUMENTS})
if(NOT ${NAME}_FOUND)
find_package(${NAME} COMPONENTS ${COMPONENT} ${FIND_PACKAGE_ARGUMENTS} ${QUIET_STR} MODULE ${FIND_PACKAGE_UNPARSED_ARGUMENTS})
find_package(${NAME} ${FIND_PACKAGE_VERSION} COMPONENTS ${COMPONENT} ${FIND_PACKAGE_ARGUMENTS} ${QUIET_STR} MODULE ${FIND_PACKAGE_UNPARSED_ARGUMENTS})
endif()

if(NOT ${NAME}_FOUND)
if(NOT ${NAME} STREQUAL ${LAST_ALIAS})
break()
else()
if(FIND_PACKAGE_REQUIRED)
message(FATAL_ERROR "${NAME} component not found: ${COMPONENT}")
message(FATAL_ERROR "${NAME} component not found: ${COMPONENT} ${FIND_PACKAGE_VERSION}")
endif()

if(NOT FIND_PACKAGE_QUIET)
message(STATUS "${NAME} component not found: ${COMPONENT}")
message(STATUS "${NAME} component not found: ${COMPONENT} ${FIND_PACKAGE_VERSION}")
endif()

break()
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ option(bundled-gsl "Use the bundled GSL version instead of looking for one on th


find_pkg(Qt6
VERSION 6.2
COMPONENTS
Core
Network
Expand Down

0 comments on commit ab7285f

Please sign in to comment.