cmake: Remove `SelectLibraryConfigurations` from `FindQRencode` module
What changed, and why it matters
This commit is a minor cleanup of the CMake build script used to locate the QR code encoding library. It removes an unnecessary helper function and simplifies how the library target is created. There is no indication this change fixes or introduces a security problem.
No security action required. Treat as ordinary build-system maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch refactors cmake/module/FindQRencode.cmake. It drops the CMake built-in SelectLibraryConfigurations helper, which previously combined separate release/debug library variables into a single QRencode_LIBRARY variable. The patch now uses QRencode_LIBRARY_RELEASE directly as the required variable and creates the imported QRencode::QRencode target only when it does not already exist. It also marks the release/debug library variables as advanced. The functional effect is equivalent: the same library paths and include directory are exposed to consumers.
Changed components
cmake/module/FindQRencode.cmakeInspect captured patch +10 / −19
diff --git a/cmake/module/FindQRencode.cmake b/cmake/module/FindQRencode.cmake
index aa0e8222..7c213989 100644
--- a/cmake/module/FindQRencode.cmake
+++ b/cmake/module/FindQRencode.cmake
@@ -17,33 +17,25 @@ This is a wrapper around find_package()/pkg_check_modules() commands that:
find_path(QRencode_INCLUDE_DIR
NAMES qrencode.h
)
-
find_library(QRencode_LIBRARY_RELEASE
NAMES qrencode
)
find_library(QRencode_LIBRARY_DEBUG
NAMES qrencoded qrencode
)
-include(SelectLibraryConfigurations)
-select_library_configurations(QRencode)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(QRencode
- REQUIRED_VARS QRencode_LIBRARY QRencode_INCLUDE_DIR
+ REQUIRED_VARS QRencode_LIBRARY_RELEASE QRencode_INCLUDE_DIR
)
-if(QRencode_FOUND)
- if(NOT TARGET QRencode::QRencode)
- add_library(QRencode::QRencode UNKNOWN IMPORTED)
- endif()
- if(QRencode_LIBRARY_RELEASE)
- set_property(TARGET QRencode::QRencode APPEND PROPERTY
- IMPORTED_CONFIGURATIONS RELEASE
- )
- set_target_properties(QRencode::QRencode PROPERTIES
- IMPORTED_LOCATION_RELEASE "${QRencode_LIBRARY_RELEASE}"
- )
- endif()
+if(QRencode_FOUND AND NOT TARGET QRencode::QRencode)
+ add_library(QRencode::QRencode UNKNOWN IMPORTED)
+ set_target_properties(QRencode::QRencode PROPERTIES
+ IMPORTED_CONFIGURATIONS RELEASE
+ IMPORTED_LOCATION_RELEASE "${QRencode_LIBRARY_RELEASE}"
+ INTERFACE_INCLUDE_DIRECTORIES "${QRencode_INCLUDE_DIR}"
+ )
if(QRencode_LIBRARY_DEBUG)
set_property(TARGET QRencode::QRencode APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG
@@ -52,11 +44,10 @@ if(QRencode_FOUND)
IMPORTED_LOCATION_DEBUG "${QRencode_LIBRARY_DEBUG}"
)
endif()
- set_target_properties(QRencode::QRencode PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${QRencode_INCLUDE_DIR}"
- )
endif()
mark_as_advanced(
QRencode_INCLUDE_DIR
+ QRencode_LIBRARY_RELEASE
+ QRencode_LIBRARY_DEBUG
)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.