From 77944cd180a758655e0c7863e19449adeecbf7dc Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 4 Feb 2014 11:56:33 +0100 Subject: cmake: Add --libs output for pkg-config. --- CMakeLists.txt | 19 +++++++++++-------- socket_wrapper.pc.cmake | 1 + src/CMakeLists.txt | 4 ++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 134960a..9eecc20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,18 @@ find_package(Threads) include(ConfigureChecks.cmake) configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) +# check subdirectories +add_subdirectory(src) + +if (UNIT_TESTING) + find_package(CMocka REQUIRED) + include(AddCMockaTest) + add_subdirectory(tests) +endif (UNIT_TESTING) + # pkg-config file +get_filename_component(SOCKET_WRAPPER_LIB ${SOCKET_WRAPPER_LOCATION} NAME) + configure_file(socket_wrapper.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/socket_wrapper.pc @ONLY) install( FILES @@ -69,11 +80,3 @@ install( devel ) -# check subdirectories -add_subdirectory(src) - -if (UNIT_TESTING) - find_package(CMocka REQUIRED) - include(AddCMockaTest) - add_subdirectory(tests) -endif (UNIT_TESTING) diff --git a/socket_wrapper.pc.cmake b/socket_wrapper.pc.cmake index e465733..6dc71f7 100644 --- a/socket_wrapper.pc.cmake +++ b/socket_wrapper.pc.cmake @@ -1,3 +1,4 @@ Name: @APPLICATION_NAME@ Description: The socket_wrapper library Version: @APPLICATION_VERSION@ +Libs: @LIB_INSTALL_DIR@/@SOCKET_WRAPPER_LIB@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bdbe890..cf70501 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,3 +21,7 @@ set_target_properties( SOVERSION ${LIBRARY_SOVERSION} ) + +# This needs to be at the end +get_target_property(SWRAP_LOCATION socket_wrapper LOCATION) +set(SOCKET_WRAPPER_LOCATION ${SWRAP_LOCATION} PARENT_SCOPE) -- cgit