[PATCH] Use CMAKE_INSTALL_FULL_<dir> for pkg-config

6 views
Skip to first unread message

David Engraf

unread,
Mar 20, 2026, 8:39:19 AM (12 days ago) Mar 20
to swup...@googlegroups.com, David Engraf
Fix path in pkg-config when include files or libraries are stored outside
of the prefix folder.

CMAKE_INSTALL_FULL_<dir> is equal to CMAKE_INSTALL_<dir> and prepends
CMAKE_INSTALL_PREFIX automatically if CMAKE_INSTALL_<dir> is not set to
an absolte path.

Signed-off-by: David Engraf <david....@sysgo.com>
---
src/CMakeLists.txt | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3370232..88867ec 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -40,9 +40,9 @@ install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fw_setenv DESTINATION ${CMAKE_INST

# Handle pkg-config files
set(prefix ${CMAKE_INSTALL_PREFIX})
-set(exec_prefix ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
-set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
-set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
+set(exec_prefix ${CMAKE_INSTALL_FULL_BINDIR})
+set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
+set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})

configure_file(${CMAKE_SOURCE_DIR}/src/libubootenv.pc.in ${CMAKE_BINARY_DIR}/libubootenv.pc @ONLY)
set(LIBUBOOTENV_PKG_CONFIG_FILES ${CMAKE_BINARY_DIR}/libubootenv.pc)
--
2.43.0

Stefano Babic

unread,
Mar 20, 2026, 8:43:38 AM (12 days ago) Mar 20
to David Engraf, swup...@googlegroups.com
On 3/20/26 13:38, David Engraf wrote:
> Fix path in pkg-config when include files or libraries are stored outside
> of the prefix folder.
>
> CMAKE_INSTALL_FULL_<dir> is equal to CMAKE_INSTALL_<dir> and prepends
> CMAKE_INSTALL_PREFIX automatically if CMAKE_INSTALL_<dir> is not set to
> an absolte path.
^---- absolute

I can fix myself by merging.

>
> Signed-off-by: David Engraf <david....@sysgo.com>
> ---
> src/CMakeLists.txt | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
> index 3370232..88867ec 100644
> --- a/src/CMakeLists.txt
> +++ b/src/CMakeLists.txt
> @@ -40,9 +40,9 @@ install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fw_setenv DESTINATION ${CMAKE_INST
>
> # Handle pkg-config files
> set(prefix ${CMAKE_INSTALL_PREFIX})
> -set(exec_prefix ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
> -set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
> -set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
> +set(exec_prefix ${CMAKE_INSTALL_FULL_BINDIR})
> +set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
> +set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
>
> configure_file(${CMAKE_SOURCE_DIR}/src/libubootenv.pc.in ${CMAKE_BINARY_DIR}/libubootenv.pc @ONLY)
> set(LIBUBOOTENV_PKG_CONFIG_FILES ${CMAKE_BINARY_DIR}/libubootenv.pc)

Reviewed-by: Stefano Babic <stefan...@swupdate.org>

Best regards,
Stefano Babic

--
_______________________________________________________________________
Nabla Software Engineering GmbH
Hirschstr. 111A | 86156 Augsburg | Tel: +49 821 45592596
Geschäftsführer : Stefano Babic | HRB 40522 Augsburg
E-Mail: sba...@nabladev.com

David Engraf

unread,
Mar 20, 2026, 9:15:05 AM (12 days ago) Mar 20
to Stefano Babic, swup...@googlegroups.com
On 20.03.26 13:43, Stefano Babic wrote:
> On 3/20/26 13:38, David Engraf wrote:
>> Fix path in pkg-config when include files or libraries are stored outside
>> of the prefix folder.
>>
>> CMAKE_INSTALL_FULL_<dir> is equal to CMAKE_INSTALL_<dir> and prepends
>> CMAKE_INSTALL_PREFIX automatically if CMAKE_INSTALL_<dir> is not set to
>> an absolte path.
>          ^---- absolute
>
> I can fix myself by merging.

Okay thanks.

Best regards
- David
Reply all
Reply to author
Forward
0 new messages