From ea6890e041c3889ff7cb80a8546d2a3b6b8804bf Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Mon, 24 Jul 2023 22:22:49 -0700 Subject: [PATCH] pkgconfig: fallback to Ptex_static when Ptex_dynamic is not built Ensure that the generated ptex.pc file has a valid name when shared libraries are not enabled. Signed-off-by: David Aguilar --- src/build/CMakeLists.txt | 6 +++++- src/build/ptex.pc.in | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/build/CMakeLists.txt b/src/build/CMakeLists.txt index b8944f1..deb1441 100644 --- a/src/build/CMakeLists.txt +++ b/src/build/CMakeLists.txt @@ -31,7 +31,11 @@ endif() string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE) -get_target_property(PTEX_DYNAMIC_OUTPUT_NAME Ptex_dynamic OUTPUT_NAME) +if (PTEX_BUILD_SHARED_LIBS) + get_target_property(PTEX_OUTPUT_NAME Ptex_dynamic OUTPUT_NAME) +else() + get_target_property(PTEX_OUTPUT_NAME Ptex_static OUTPUT_NAME) +endif() configure_file("${PROJECT_NAME_LOWERCASE}.pc.in" "${PROJECT_NAME_LOWERCASE}.pc" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWERCASE}.pc" COMPONENT devel DESTINATION share/pkgconfig) diff --git a/src/build/ptex.pc.in b/src/build/ptex.pc.in index a9f24da..b81a2fd 100644 --- a/src/build/ptex.pc.in +++ b/src/build/ptex.pc.in @@ -17,5 +17,5 @@ Version: @PROJECT_VERSION@ Requires: @pc_req_public@ Requires.private: @pc_req_private@ Cflags: -I"${includedir}" -Libs: -L"${libdir}" -l@PTEX_DYNAMIC_OUTPUT_NAME@ +Libs: -L"${libdir}" -l@PTEX_OUTPUT_NAME@