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) 5SET(prefix ${CMAKE_INSTALL_PREFIX}) 6SET(exec_prefix \${prefix}) 7SET(libdir \${exec_prefix}/lib) 8SET(includedir \${prefix}/include) 9# Now, this is not particularly pretty, nor is it terribly accurate... 10# Loop over all our additional libs 11FOREACH(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}") 18ENDFOREACH() 19# libxml2 is easier, since it's already using pkg-config 20FOREACH(mylib ${PC_LIBXML_STATIC_LDFLAGS}) 21 SET(LIBS "${LIBS} ${mylib}") 22ENDFOREACH() 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. 26CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/pkgconfig/libarchive.pc.in 27 ${CMAKE_CURRENT_BINARY_DIR}/build/pkgconfig/libarchive.pc 28 @ONLY) 29# And install it, of course ;). 30IF(ENABLE_INSTALL) 31 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/build/pkgconfig/libarchive.pc 32 DESTINATION "lib/pkgconfig") 33ENDIF() 34