1 |
# - Generate a libarchive.pc like autotools for pkg-config |
2 |
# |
3 |
|
4 |
# Set the required variables (we use the same input file as autotools) |
5 |
SET(prefix ${CMAKE_INSTALL_PREFIX}) |
6 |
SET(exec_prefix \${prefix}) |
7 |
SET(libdir \${exec_prefix}/lib) |
8 |
SET(includedir \${prefix}/include) |
9 |
# Now, this is not particularly pretty, nor is it terribly accurate... |
10 |
# Loop over all our additional libs |
11 |
FOREACH(mylib ${ADDITIONAL_LIBS}) |
12 |
# Extract the filename from the absolute path |
13 |
GET_FILENAME_COMPONENT(mylib_name ${mylib} NAME_WE) |
14 |
# Strip the lib prefix |
15 |
STRING(REGEX REPLACE "^lib" "" mylib_name ${mylib_name}) |
16 |
# Append it to our LIBS string |
17 |
SET(LIBS "${LIBS} -l${mylib_name}") |
18 |
ENDFOREACH() |
19 |
# libxml2 is easier, since it's already using pkg-config |
20 |
FOREACH(mylib ${PC_LIBXML_STATIC_LDFLAGS}) |
21 |
SET(LIBS "${LIBS} ${mylib}") |
22 |
ENDFOREACH() |
23 |
# FIXME: The order of the libraries doesn't take dependencies into account, |
24 |
# thus there's a good chance it'll make some binutils versions unhappy... |
25 |
# This only affects Libs.private (looked up for static builds) though. |
26 |
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/pkgconfig/libarchive.pc.in |
27 |
${CMAKE_CURRENT_SOURCE_DIR}/build/pkgconfig/libarchive.pc |
28 |
@ONLY) |
29 |
# And install it, of course ;). |
30 |
IF(ENABLE_INSTALL) |
31 |
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/build/pkgconfig/libarchive.pc |
32 |
DESTINATION "lib/pkgconfig") |
33 |
ENDIF() |