Skip to content

Commit

Permalink
pkgconfig: fallback to Ptex_static when Ptex_dynamic is not built
Browse files Browse the repository at this point in the history
Ensure that the generated ptex.pc file has a valid name when
shared libraries are not enabled.

Signed-off-by: David Aguilar <[email protected]>
  • Loading branch information
davvid committed Jul 25, 2023
1 parent 5be2cab commit ea6890e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion src/build/ptex.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@

0 comments on commit ea6890e

Please sign in to comment.