Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a pkg-config file #128

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion CMakeLists.txt
Expand Up @@ -17,7 +17,10 @@ if (POLICY CMP0127)
cmake_policy(SET CMP0127 NEW)
endif()

project(base64 LANGUAGES C VERSION 0.5.1)
project(base64 LANGUAGES C
VERSION 0.5.1
DESCRIPTION "Fast Base64 stream encoder/decoder in C99, with SIMD acceleration"
)

include(GNUInstallDirs)
include(CMakeDependentOption)
Expand Down Expand Up @@ -239,6 +242,10 @@ if (BASE64_BUILD_TESTS)
add_subdirectory(test)
endif()

########################################################################
# pkg-config file
configure_file("${CMAKE_CURRENT_LIST_DIR}/cmake/base64.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/base64.pc" @ONLY)

########################################################################
# base64
if (BASE64_BUILD_CLI)
Expand Down Expand Up @@ -280,6 +287,10 @@ install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/base64-config-version.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/base64.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)

install(EXPORT base64-targets
NAMESPACE aklomp::
Expand Down
10 changes: 10 additions & 0 deletions cmake/base64.pc.in
@@ -0,0 +1,10 @@
prefix="@CMAKE_INSTALL_PREFIX@"
exec_prefix="${prefix}"
libdir="${prefix}/lib"
includedir="${prefix}/include"
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't account for user configured CMAKE_INSTALL_INCLUDEDIR, CMAKE_INSTALL_LIBDIR (or CMAKE_INSTALL_BINDIR on Windows) variables.


Name: @PROJECT_NAME@
Description: @CMAKE_PROJECT_DESCRIPTION@
Version: @PROJECT_VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -l@PROJECT_NAME@
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, this doesn't account for CMAKE_(STATIC|SHARED|IMPORT)_LIBRARY_(PRE|SUF)FIX(_C)?. Please also note that the PROJECT_NAME <=> target name equivalence is rather coincidental.