From 0bfd15daf1d86f5227affbd2f2a9df1cf7a8296f Mon Sep 17 00:00:00 2001 From: Christopher Degawa Date: Tue, 11 Feb 2025 16:41:28 -0600 Subject: [PATCH] pkg-config: use PROJECT_NAME instead of CMAKE_PROJECT_NAME [`PROJECT_NAME`][1] refers to the most recent `project()` call, while [`CMAKE_PROJECT_NAME`][2] refers to the top-most `project()` call. In the cases where cpuinfo is installed as a standalone project, this is perfectly fine and works as intended where the installed pkg-config file contains libcpuinfo as the name. However, if cpuinfo is used as a subproject, such as when using FetchContent, the name of the calling project would be used instead, leading to something like libOuterProject rather than libcpuinfo. [1]: https://cmake.org/cmake/help/latest/variable/PROJECT_NAME.html#variable:PROJECT_NAME [2]: https://cmake.org/cmake/help/latest/variable/CMAKE_PROJECT_NAME.html#variable:CMAKE_PROJECT_NAME Signed-off-by: Christopher Degawa --- libcpuinfo.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcpuinfo.pc.in b/libcpuinfo.pc.in index 3027da34..f9a9db62 100644 --- a/libcpuinfo.pc.in +++ b/libcpuinfo.pc.in @@ -3,7 +3,7 @@ exec_prefix=@CMAKE_INSTALL_PREFIX@ libdir=@libdir_for_pc_file@ includedir=@includedir_for_pc_file@ -Name: lib@CMAKE_PROJECT_NAME@ +Name: lib@PROJECT_NAME@ Description: Library to detect essential performance optimization information about host CPU. Version: URL: @PROJECT_HOMEPAGE_URL@