forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge bitcoin#31173: cmake: Add
FindQRencode
module and enable `lib…
…qrencode` package for MSVC 9e5089d build, msvc: Enable `libqrencode` vcpkg package (Hennadii Stepanov) 30089b0 cmake: Add `FindQRencode` module (Hennadii Stepanov) Pull request description: This PR introduces the `FindQRencode` CMake module, following the official CMake [guidelines](https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#find-modules) for managing [upstream libraries](https://github.com/fukuchi/libqrencode) that lack a config file package. This module enhances flexibility in locating the `libqrencode` library by making the use of `pkg-config` optional. With this update, `libqrencode` can be detected on systems where either `pkg-config` or the `libqrencode.pc` file is unavailable, such as Windows environments using the vcpkg package manager. However, if `libqrencode.pc` is available, it remains beneficial as the only direct source of the library's version information. Additionally, the `libqrencode` vcpkg package is enabled for MSVC builds. Here is a diff for configuration output on Ubuntu 24.10: ```diff -- Detecting CXX compile features - done -- Found SQLite3: /usr/include (found suitable version "3.46.1", minimum required is "3.7.17") -- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1") --- Checking for module 'libqrencode' --- Found libqrencode, version 4.1.1 +-- Found QRencode: /usr/lib/x86_64-linux-gnu/libqrencode.so (found version "4.1.1") -- Found Qt: /usr/lib/x86_64-linux-gnu/cmake/Qt5 (found suitable version "5.15.15", minimum required is "5.11.3") -- Performing Test CXX_SUPPORTS__WERROR -- Performing Test CXX_SUPPORTS__WERROR - Success ``` ACKs for top commit: fanquake: ACK 9e5089d Tree-SHA512: bb9baca64386772f2f4752b1cbff1230792562ca6b2e37c56ad28580b55b1ae6ff65c2cf0d8ab026111d7b5a056d7ac672496a3cfd1a81e4fdd2b84c8cf75fff
- Loading branch information
Showing
6 changed files
with
78 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Copyright (c) 2024-present The Bitcoin Core developers | ||
# Distributed under the MIT software license, see the accompanying | ||
# file COPYING or https://opensource.org/license/mit/. | ||
|
||
#[=======================================================================[ | ||
FindQRencode | ||
------------ | ||
Finds the QRencode header and library. | ||
This is a wrapper around find_package()/pkg_check_modules() commands that: | ||
- facilitates searching in various build environments | ||
- prints a standard log message | ||
#]=======================================================================] | ||
|
||
find_package(PkgConfig QUIET) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(PC_QRencode QUIET libqrencode) | ||
endif() | ||
|
||
find_path(QRencode_INCLUDE_DIR | ||
NAMES qrencode.h | ||
PATHS ${PC_QRencode_INCLUDE_DIRS} | ||
) | ||
|
||
find_library(QRencode_LIBRARY_RELEASE | ||
NAMES qrencode | ||
PATHS ${PC_QRencode_LIBRARY_DIRS} | ||
) | ||
find_library(QRencode_LIBRARY_DEBUG | ||
NAMES qrencoded qrencode | ||
PATHS ${PC_QRencode_LIBRARY_DIRS} | ||
) | ||
include(SelectLibraryConfigurations) | ||
select_library_configurations(QRencode) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(QRencode | ||
REQUIRED_VARS QRencode_LIBRARY QRencode_INCLUDE_DIR | ||
VERSION_VAR PC_QRencode_VERSION | ||
) | ||
|
||
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_LIBRARY_DEBUG) | ||
set_property(TARGET QRencode::QRencode APPEND PROPERTY | ||
IMPORTED_CONFIGURATIONS DEBUG | ||
) | ||
set_target_properties(QRencode::QRencode PROPERTIES | ||
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 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters