# HG changeset patch # User Steve Borho <st...@borho.org> # Date 1382480398 18000 # Tue Oct 22 17:19:58 2013 -0500 # Node ID a8d4928926e82026ed71ca0af210a5f4f16d405d # Parent 6d96d64c4e9a2c526b57274760a7147241328cb3 cmake: generate and install pkgconfig file
This installs the x265.pc into /usr/local/lib/pkgconfig/ with these contents: prefix=/usr/local exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: x265 Description: H.265/HEVC video encoder Version: 0.4.1 Libs: -L${libdir} -lx265 Libs.private: -lstdc++ -lm -lc -lpthread -lrt Cflags: -I${includedir} The pkg-config file is only generated and installed if CMake finds pkg-config Q1: it seems unwise to hard-code "/lib" in a few places, what if lib64 is used or something else? Q2: Should x265.pc have a version number like x265-0.4.1.pc? diff -r 6d96d64c4e9a -r a8d4928926e8 source/CMakeLists.txt --- a/source/CMakeLists.txt Tue Oct 22 23:36:36 2013 +0530 +++ b/source/CMakeLists.txt Tue Oct 22 17:19:58 2013 -0500 @@ -108,7 +108,7 @@ endif(YASM_FOUND) if(UNIX) - SET(PLATFORM_LIBS pthread m) + SET(PLATFORM_LIBS pthread) if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") SET(PLATFORM_LIBS ${PLATFORM_LIBS} rt) endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") @@ -182,6 +182,18 @@ RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + + include(FindPkgConfig QUIET) + if(PKG_CONFIG_FOUND) + # convert lists of link libraries into -lstdc++ -lm etc.. + foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS}) + set(PRIVATE_LIBS "${PRIVATE_LIBS} -l${LIB}") + endforeach() + # Produce a pkg-config file for linking against the shared lib + configure_file("x265.pc.in" "x265.pc" @ONLY) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/x265.pc" + DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig") + endif() endif() install(TARGETS x265-static RUNTIME DESTINATION bin diff -r 6d96d64c4e9a -r a8d4928926e8 source/x265.pc.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/x265.pc.in Tue Oct 22 17:19:58 2013 -0500 @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: @CMAKE_PROJECT_NAME@ +Description: H.265/HEVC video encoder +Version: @X265_LATEST_TAG@ +Libs: -L${libdir} -lx265 +Libs.private: @PRIVATE_LIBS@ +Cflags: -I${includedir} _______________________________________________ x265-devel mailing list x265-devel@videolan.org https://mailman.videolan.org/listinfo/x265-devel