Skip to content

build: fix pkg-config output and USE_QCBOR definition - #30

Open
Ali Erdinc Koroglu (aekoroglu) wants to merge 4 commits into
qualcomm:mainfrom
aekoroglu:dev
Open

Ali Erdinc Koroglu (aekoroglu) wants to merge 4 commits into
qualcomm:mainfrom
aekoroglu:dev

Conversation

@aekoroglu

Copy link
Copy Markdown

Follow-up to #23. Four build fixes, two files, no functional change to the library.

1. qcomtee.pc points at the wrong libdir

qcomtee.pc.in hardcodes libdir="${prefix}/lib", but the library installs to
${CMAKE_INSTALL_LIBDIR}. Where that resolves to lib64, as on Fedora and
openSUSE, consumers get a -L path that does not contain libqcomtee.so. Now
expands CMAKE_INSTALL_FULL_LIBDIR and CMAKE_INSTALL_FULL_INCLUDEDIR.

2. USE_QCBOR is set with the wrong command

add_compile_definitions() takes no target and no scope keyword, so

add_compile_definitions(${PROJECT_NAME} PRIVATE -DUSE_QCBOR)

defines three macros for the whole directory instead of one:

-Dlibqcomtee -DPRIVATE -DUSE_QCBOR

Switched to target_compile_definitions() on the qcomtee target.

3. Requires.private ignores the libcbor fallback

#23 made the CBOR backend selectable, but pc_req_private stayed hardcoded to
qcbor. A libcbor build installs a .pc declaring a private dependency on a
module that is not present, which breaks static linking and downstream
dependency generation. Now follows QCBOR_FOUND. The pkg-config module for
libcbor is named libcbor, not cbor.

4. find_package(QCBOR REQUIRED)

QCBOR is optional since #23, so REQUIRED states the opposite of the intent. It
is inert only because cmake/FindQCBOR.cmake sets QCBOR_FOUND by hand and
never calls find_package_handle_standard_args(). Happy to drop this commit if
you would rather keep REQUIRED for now.

Testing

Configured both backends with -DCMAKE_INSTALL_LIBDIR=lib64:

# libcbor fallback
libdir="/usr/lib64"
Requires.private: libcbor

# QCBOR present
libdir="/usr/lib64"
Requires.private: qcbor

Not addressed

Requires: @pc_req_public@ expands empty since pc_req_public is never set.
Harmless, left alone to keep this minimal.

qcomtee.pc.in hardcodes libdir as ${prefix}/lib, but the library itself
is installed to ${CMAKE_INSTALL_LIBDIR}. On distributions that use a
multiarch or 64-bit suffixed library directory, such as Fedora and
openSUSE where CMAKE_INSTALL_LIBDIR resolves to lib64, the two disagree
and every consumer of qcomtee.pc is handed a -L path that does not
contain libqcomtee.so.

Expand CMAKE_INSTALL_FULL_LIBDIR and CMAKE_INSTALL_FULL_INCLUDEDIR
instead. GNUInstallDirs is already included from the top-level
CMakeLists.txt, so both variables are available at configure time.

Signed-off-by: Ali Erdinc Koroglu <ali.koroglu@oss.qualcomm.com>
add_compile_definitions() takes no target and no scope keyword, so

    add_compile_definitions(${PROJECT_NAME} PRIVATE -DUSE_QCBOR)

defines three macros for the whole directory instead of one:

    -Dlibqcomtee -DPRIVATE -DUSE_QCBOR

Use target_compile_definitions() on the qcomtee target, next to the
matching target_link_libraries() call.

Signed-off-by: Ali Erdinc Koroglu <ali.koroglu@oss.qualcomm.com>
…private

Commit "Enable libcbor fallback when QCBOR is unavailable" (PR qualcomm#23) made
the CBOR backend selectable at configure time, but pc_req_private stayed
hardcoded to qcbor. A build that falls back to libcbor therefore installs
a qcomtee.pc declaring a private dependency on a module that is not
present, which breaks static linking and dependency generation for
downstream consumers.

Set pc_req_private from QCBOR_FOUND. The libcbor pkg-config module is
named libcbor, not cbor.

Signed-off-by: Ali Erdinc Koroglu <ali.koroglu@oss.qualcomm.com>
QCBOR has been optional since the libcbor fallback landed, so REQUIRED
now states the opposite of the intent. It has no effect today only
because cmake/FindQCBOR.cmake sets QCBOR_FOUND by hand and never calls
find_package_handle_standard_args(), which is what would otherwise honor
REQUIRED and abort. Should that module ever be converted to the standard
helper, the fallback path would become unreachable

Signed-off-by: Ali Erdinc Koroglu <ali.koroglu@oss.qualcomm.com>
@aekoroglu Ali Erdinc Koroglu (aekoroglu) changed the title Dev build: fix pkg-config output and USE_QCBOR definition Aug 14, 2026
@harshaldev27

Copy link
Copy Markdown
Contributor

Can you drop the [PATCH] prefix from your commit headers and also only use the name of the folder is prefix which you modifying, build: can be replaced by libqcomtee:.

Amirreza Zarrabi (@qc-azarrabi) FYI.

Comment thread libqcomtee/CMakeLists.txt
message(WARNING "QCBOR not found, falling back to libcbor")
endif()

include_directories(${QCBOR_INCLUDE_DIRS})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be moved under if (QCBOR_FOUND) condition as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants