cmake: Add --libs output for pkg-config.
authorAndreas Schneider <asn@samba.org>
Tue, 4 Feb 2014 10:56:33 +0000 (11:56 +0100)
committerAndreas Schneider <asn@samba.org>
Tue, 4 Feb 2014 11:44:38 +0000 (12:44 +0100)
CMakeLists.txt
socket_wrapper.pc.cmake
src/CMakeLists.txt

index 134960a6288c91468e90b9dedb8ee98d9ae07e0f..9eecc20978da7a8561a600a82279ef894e222bb3 100644 (file)
@@ -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)
index e465733b8480737767e1cbd70f1e528638a49d4e..6dc71f7355426e826fab63d4096140fb0beda4e2 100644 (file)
@@ -1,3 +1,4 @@
 Name: @APPLICATION_NAME@
 Description: The socket_wrapper library
 Version: @APPLICATION_VERSION@
+Libs: @LIB_INSTALL_DIR@/@SOCKET_WRAPPER_LIB@
index bdbe8909df94ea86c24bbd9c3dd9895a5a57f726..cf7050132473255772bc4a29280d13632e35554d 100644 (file)
@@ -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)