summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2014-02-04 11:56:33 +0100
committerAndreas Schneider <asn@samba.org>2014-02-04 12:44:38 +0100
commit77944cd180a758655e0c7863e19449adeecbf7dc (patch)
tree63a6e01ac676385fb56bd8731117e9cdde81b81c
parent23631b4c920bdcf14d6151a1f4f89d49b78c2feb (diff)
downloadsocket_wrapper-77944cd180a758655e0c7863e19449adeecbf7dc.tar.gz
socket_wrapper-77944cd180a758655e0c7863e19449adeecbf7dc.tar.xz
socket_wrapper-77944cd180a758655e0c7863e19449adeecbf7dc.zip
cmake: Add --libs output for pkg-config.
-rw-r--r--CMakeLists.txt19
-rw-r--r--socket_wrapper.pc.cmake1
-rw-r--r--src/CMakeLists.txt4
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)