Skip to content

CMake: exporting libraries #334

@breese

Description

@breese

Here is a patch to export the (Boost) libraries used by cpp-netlib. This is needed when using cpp-netlib as a git-submodule of another project.

The other project than has to do the following to link correctly:

target_link_libraries(myproject ${CPP-NETLIB_LIBRARIES})

From f2be5268dc67eacd5e575a985942d4112c7cf6ec Mon Sep 17 00:00:00 2001
From: Bjorn Reese 
Date: Thu, 28 Nov 2013 15:23:06 +0100
Subject: [PATCH] Added a variable to export the libraries used by cpp-netlib
 to parent CMake project

---
 CMakeLists.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c152f49..5fc2c57 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -108,6 +108,8 @@ if (CPP-NETLIB_EXAMPLES)
   add_subdirectory(libs/network/example)
 endif()
 
+set(CPP-NETLIB_LIBRARIES ${Boost_LIBRARIES} CACHE INTERNAL "Dependent libraries for header-only use")
+
 install(DIRECTORY boost DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
 
 ###
-- 
1.8.3.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions