Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Enable cpp-netlib to be build into a single library #227

Merged
merged 4 commits into from

2 participants

@torbjoernk

Sometimes I find it tedious to include the various cpp-netlib libraries in my project. Thus I added the possibility to build a single library out of all cpp-netlib's separated libraries -- including uri (I'm sending a PR there too).

The configuration of the tests and examples has been adjusted to cope with the fact, that when CPP-NETLIB_BUILD_SINGLE_LIB is enabled, the separated libraries are not build.

Tested with GCC 4.7 and Boost 1.53.

Notes

  1. This PR includes an update for the uri submodule provided by an PR there (see cpp-netlib/uri#10)
  2. This PR is based on my other PR #226 fixing http-client_test
torbjoernk added some commits
@torbjoernk torbjoernk fix running http-client_test with 'make test'
when issuing 'make test' the http-client_test were not found due to
wrong parameter in add_test() call
e0b3f97
@torbjoernk torbjoernk enabling cpp-netlib to be compiled into a sincle library
this adds the CMake variable 'CPP-NETLIB_BUILD_SINGLE_LIB', which
defaults to OFF and will enable build of a single library 'libcppnetlib'
to be compiled instead of the different separated libraries.

the tests and examples have been adjusted to deal with a single library

the uri submodule has also been changed
cdd0e00
@torbjoernk torbjoernk include uri-changes related to previous commit b00dc81
@deanberris
Owner

LGTM. Thanks for the PR!

@deanberris deanberris merged commit 7af8275 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 8, 2013
  1. @torbjoernk

    fix running http-client_test with 'make test'

    torbjoernk authored
    when issuing 'make test' the http-client_test were not found due to
    wrong parameter in add_test() call
  2. @torbjoernk

    enabling cpp-netlib to be compiled into a sincle library

    torbjoernk authored
    this adds the CMake variable 'CPP-NETLIB_BUILD_SINGLE_LIB', which
    defaults to OFF and will enable build of a single library 'libcppnetlib'
    to be compiled instead of the different separated libraries.
    
    the tests and examples have been adjusted to deal with a single library
    
    the uri submodule has also been changed
  3. @torbjoernk
  4. @torbjoernk
This page is out of date. Refresh to see the latest.
View
29 CMakeLists.txt
@@ -8,6 +8,7 @@ cmake_minimum_required(VERSION 2.8)
project(CPP-NETLIB)
option( CPP-NETLIB_BUILD_SHARED_LIBS "Build cpp-netlib as shared libraries." OFF )
+option( CPP-NETLIB_BUILD_SINGLE_LIB "Build cpp-netlib into a single library" OFF )
option( CPP-NETLIB_BUILD_TESTS "Build the unit tests." ON )
option( CPP-NETLIB_BUILD_EXAMPLES "Build the examples using cpp-netlib." ON )
option( CPP-NETLIB_ALWAYS_LOGGING "Allow cpp-netlib to log debug messages even in non-debug mode." OFF )
@@ -83,6 +84,7 @@ endif(Boost_FOUND)
message(STATUS "CPP-NETLIB options selected:")
message(STATUS " CPP-NETLIB_BUILD_SHARED_LIBS: ${CPP-NETLIB_BUILD_SHARED_LIBS}\t(Build cpp-netlib as shared libraries: OFF, ON)")
+message(STATUS " CPP-NETLIB_BUILD_SINGLE_LIB: ${CPP-NETLIB_BUILD_SINGLE_LIB}\t(Build cpp-netlib into a single library: OFF, ON)")
message(STATUS " CPP-NETLIB_BUILD_TESTS: ${CPP-NETLIB_BUILD_TESTS}\t(Build the unit tests: ON, OFF)")
message(STATUS " CPP-NETLIB_BUILD_EXAMPLES: ${CPP-NETLIB_BUILD_EXAMPLES}\t(Build the examples using cpp-netlib: ON, OFF)")
message(STATUS " CPP-NETLIB_ALWAYS_LOGGING: ${CPP-NETLIB_ALWAYS_LOGGING}\t(Allow cpp-netlib to log debug messages even in non-debug mode: ON, OFF)")
@@ -123,6 +125,16 @@ if(CPP-NETLIB_BUILD_TESTS)
set(GMOCK_BOTH_LIBRARIES ${GMOCK_LIBRARIES} ${GMOCK_MAIN_LIBRARIES})
endif()
+if(CPP-NETLIB_BUILD_SINGLE_LIB)
+ include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}/concurrency/src
+ ${CMAKE_CURRENT_SOURCE_DIR}/http/src
+ ${CMAKE_CURRENT_SOURCE_DIR}/logging/src
+ ${CMAKE_CURRENT_SOURCE_DIR}/message/src
+ ${CMAKE_CURRENT_SOURCE_DIR}/uri/src
+ )
+endif()
+
add_subdirectory(uri)
add_subdirectory(message)
add_subdirectory(logging)
@@ -132,3 +144,20 @@ add_subdirectory(http)
if(CPP-NETLIB_BUILD_EXAMPLES)
add_subdirectory(contrib/http_examples)
endif()
+
+if(CPP-NETLIB_BUILD_SINGLE_LIB)
+ add_library(cppnetlib
+ ${Uri_SRCS}
+ ${CPP-NETLIB_MESSAGE_SRCS}
+ ${CPP-NETLIB_MESSAGE_DIRECTIVES_SRCS}
+ ${CPP-NETLIB_MESSAGE_WRAPPERS_SRCS}
+ ${CPP-NETLIB_LOGGING_SRCS}
+ ${CPP-NETLIB_HTTP_CLIENT_SRCS}
+ ${CPP-NETLIB_HTTP_CLIENT_CONNECTIONS_SRCS}
+ ${CPP-NETLIB_HTTP_MESSAGE_SRCS}
+ ${CPP-NETLIB_HTTP_MESSAGE_WRAPPERS_SRCS}
+ ${CPP-NETLIB_CONSTANTS_SRCS}
+ ${CPP-NETLIB_CONCURRENCY_SRCS}
+ )
+ target_link_libraries(cppnetlib ${Boost_LIBRARIES})
+endif()
View
3  concurrency/CMakeLists.txt
@@ -9,3 +9,6 @@ if(CPP-NETLIB_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif(CPP-NETLIB_BUILD_TESTS)
+
+# propagate sources to parent directory for one-lib-build
+set(CPP-NETLIB_CONCURRENCY_SRCS ${CPP-NETLIB_CONCURRENCY_SRCS} PARENT_SCOPE)
View
9 concurrency/src/CMakeLists.txt
@@ -16,8 +16,10 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
endif()
endif()
-set(CPP-NETLIB_CONCURRENCY_SRCS thread_pool.cpp)
-add_library(cppnetlib-concurrency ${CPP-NETLIB_CONCURRENCY_SRCS})
+set(CPP-NETLIB_CONCURRENCY_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/thread_pool.cpp)
+if(NOT CPP-NETLIB_BUILD_SINGLE_LIB)
+ add_library(cppnetlib-concurrency ${CPP-NETLIB_CONCURRENCY_SRCS})
+endif()
foreach (src_file ${CPP-NETLIB_CONCURRENCY_SRCS})
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set_source_files_properties(${src_file}
@@ -27,3 +29,6 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
endif()
endforeach(src_file)
+
+# propagate sources to parent directory for one-lib-build
+set(CPP-NETLIB_CONCURRENCY_SRCS ${CPP-NETLIB_CONCURRENCY_SRCS} PARENT_SCOPE)
View
7 concurrency/test/CMakeLists.txt
@@ -7,11 +7,16 @@ include_directories(${CPP-NETLIB_SOURCE_DIR}/concurrency/src
${GTEST_INCLUDE_DIRS}
)
+if(CPP-NETLIB_BUILD_SINGLE_LIB)
+ set(link_cppnetlib_lib cppnetlib)
+else()
+ set(link_cppnetlib_lib cppnetlib-concurrency)
+endif()
set_source_files_properties(thread_pool_test.cpp
PROPERTIES COMPILE_FLAGS "-Wall")
add_executable(cpp-netlib-thread_pool_test thread_pool_test.cpp)
target_link_libraries(cpp-netlib-thread_pool_test
- cppnetlib-concurrency
+ ${link_cppnetlib_lib}
${Boost_LIBRARIES}
${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT})
View
44 contrib/http_examples/CMakeLists.txt
@@ -40,9 +40,10 @@ set(BOOST_SERVER_LIBS
${Boost_PROGRAM_OPTIONS_LIBRARY}
)
-target_link_libraries(simple_wget
- ${BOOST_CLIENT_LIBS}
- ${CMAKE_THREAD_LIBS_INIT}
+if(CPP-NETLIB_BUILD_SINGLE_LIB)
+ set(simple_wget_linklibs cppnetlib)
+else()
+ set(simple_wget_linklibs
cppnetlib-uri
cppnetlib-message
cppnetlib-message-directives
@@ -53,10 +54,16 @@ target_link_libraries(simple_wget
cppnetlib-http-client
cppnetlib-http-client-connections
${CPP-NETLIB_LOGGING_LIB})
-
-target_link_libraries(atom_reader
+endif()
+target_link_libraries(simple_wget
${BOOST_CLIENT_LIBS}
${CMAKE_THREAD_LIBS_INIT}
+ ${simple_wget_linklibs})
+
+if(CPP-NETLIB_BUILD_SINGLE_LIB)
+ set(atom_reader_linklibs cppnetlib)
+else()
+ set(atom_reader_linklibs
cppnetlib-uri
cppnetlib-message
cppnetlib-message-directives
@@ -67,10 +74,16 @@ target_link_libraries(atom_reader
cppnetlib-http-client
cppnetlib-http-client-connections
${CPP-NETLIB_LOGGING_LIB})
-
-target_link_libraries(rss_reader
+endif()
+target_link_libraries(atom_reader
${BOOST_CLIENT_LIBS}
${CMAKE_THREAD_LIBS_INIT}
+ ${atom_reader_linklibs})
+
+if(CPP-NETLIB_BUILD_SINGLE_LIB)
+ set(rss_reader_linklibs cppnetlib)
+else()
+ set(rss_reader_linklibs
cppnetlib-uri
cppnetlib-message
cppnetlib-message-directives
@@ -80,6 +93,11 @@ target_link_libraries(rss_reader
cppnetlib-http-client
cppnetlib-http-client-connections
${CPP-NETLIB_LOGGING_LIB})
+endif()
+target_link_libraries(rss_reader
+ ${BOOST_CLIENT_LIBS}
+ ${CMAKE_THREAD_LIBS_INIT}
+ ${rss_reader_linklibs})
#target_link_libraries(twitter_search
# ${BOOST_CLIENT_LIBS}
@@ -102,9 +120,10 @@ target_link_libraries(rss_reader
# cppnetlib-http-server
# ${CPP-NETLIB_LOGGING_LIB})
-target_link_libraries(hello_world_client
- ${BOOST_CLIENT_LIBS}
- ${CMAKE_THREAD_LIBS_INIT}
+if(CPP-NETLIB_BUILD_SINGLE_LIB)
+ set(hello_world_client_linklibs cppnetlib)
+else()
+ set(hello_world_client_linklibs
cppnetlib-uri
cppnetlib-message
cppnetlib-message-directives
@@ -115,6 +134,11 @@ target_link_libraries(hello_world_client
cppnetlib-http-client
cppnetlib-http-client-connections
${CPP-NETLIB_LOGGING_LIB})
+endif()
+target_link_libraries(hello_world_client
+ ${BOOST_CLIENT_LIBS}
+ ${CMAKE_THREAD_LIBS_INIT}
+ ${hello_world_client_linklibs})
if (OPENSSL_FOUND)
target_link_libraries(simple_wget ${OPENSSL_LIBRARIES})
View
7 http/CMakeLists.txt
@@ -9,3 +9,10 @@ if(CPP-NETLIB_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif(CPP-NETLIB_BUILD_TESTS)
+
+# propagate sources to parent directory for one-lib-build
+set(CPP-NETLIB_HTTP_MESSAGE_SRCS ${CPP-NETLIB_HTTP_MESSAGE_SRCS} PARENT_SCOPE)
+set(CPP-NETLIB_HTTP_MESSAGE_WRAPPERS_SRCS ${CPP-NETLIB_HTTP_MESSAGE_WRAPPERS_SRCS} PARENT_SCOPE)
+set(CPP-NETLIB_HTTP_CLIENT_CONNECTIONS_SRCS ${CPP-NETLIB_HTTP_CLIENT_CONNECTIONS_SRCS} PARENT_SCOPE)
+set(CPP-NETLIB_HTTP_CLIENT_SRCS ${CPP-NETLIB_HTTP_CLIENT_SRCS} PARENT_SCOPE)
+set(CPP-NETLIB_CONSTANTS_SRCS ${CPP-NETLIB_CONSTANTS_SRCS} PARENT_SCOPE)
View
116 http/src/CMakeLists.txt
@@ -33,14 +33,18 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
endif()
endif()
-set(CPP-NETLIB_HTTP_MESSAGE_SRCS http/request.cpp http/response.cpp)
-add_library(cppnetlib-http-message ${CPP-NETLIB_HTTP_MESSAGE_SRCS})
-add_dependencies(cppnetlib-http-message
-# ${Boost_LIBRARIES}
- cppnetlib-message)
-target_link_libraries(cppnetlib-http-message
- ${Boost_LIBRARIES}
- cppnetlib-message)
+set(CPP-NETLIB_HTTP_MESSAGE_SRCS
+ ${CMAKE_CURRENT_SOURCE_DIR}/http/request.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/http/response.cpp)
+if(NOT CPP-NETLIB_BUILD_SINGLE_LIB)
+ add_library(cppnetlib-http-message ${CPP-NETLIB_HTTP_MESSAGE_SRCS})
+ add_dependencies(cppnetlib-http-message
+# ${Boost_LIBRARIES}
+ cppnetlib-message)
+ target_link_libraries(cppnetlib-http-message
+ ${Boost_LIBRARIES}
+ cppnetlib-message)
+endif()
foreach (src_file ${CPP-NETLIB_HTTP_MESSAGE_SRCS})
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set_source_files_properties(${src_file}
@@ -51,8 +55,10 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
endif()
endforeach(src_file)
-set(CPP-NETLIB_HTTP_MESSAGE_WRAPPERS_SRCS http/message/wrappers.cpp)
-add_library(cppnetlib-http-message-wrappers ${CPP-NETLIB_HTTP_MESSAGE_WRAPPERS_SRCS})
+set(CPP-NETLIB_HTTP_MESSAGE_WRAPPERS_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/http/message/wrappers.cpp)
+if(NOT CPP-NETLIB_BUILD_SINGLE_LIB)
+ add_library(cppnetlib-http-message-wrappers ${CPP-NETLIB_HTTP_MESSAGE_WRAPPERS_SRCS})
+endif()
foreach (src_file ${CPP-NETLIB_HTTP_MESSAGE_WRAPPERS_SRCS})
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set_source_files_properties(${src_file}
@@ -118,17 +124,19 @@ endforeach(src_file)
#endforeach(src_file)
set(CPP-NETLIB_HTTP_CLIENT_CONNECTIONS_SRCS
- http/client_connections.cpp
- http/simple_connection_manager.cpp
- http/simple_connection_factory.cpp
- http/connection_delegate_factory.cpp
- http/client_resolver_delegate.cpp
- http/client_resolver_delegate_factory.cpp
- http/client_connection_delegates.cpp
- http/client_connection_factory.cpp
- http/client_async_resolver.cpp
- http/client_connection_normal.cpp)
-add_library(cppnetlib-http-client-connections ${CPP-NETLIB_HTTP_CLIENT_CONNECTIONS_SRCS})
+ ${CMAKE_CURRENT_SOURCE_DIR}/http/client_connections.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/http/simple_connection_manager.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/http/simple_connection_factory.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/http/connection_delegate_factory.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/http/client_resolver_delegate.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/http/client_resolver_delegate_factory.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/http/client_connection_delegates.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/http/client_connection_factory.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/http/client_async_resolver.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/http/client_connection_normal.cpp)
+if(NOT CPP-NETLIB_BUILD_SINGLE_LIB)
+ add_library(cppnetlib-http-client-connections ${CPP-NETLIB_HTTP_CLIENT_CONNECTIONS_SRCS})
+endif()
foreach (src_file ${CPP-NETLIB_HTTP_CLIENT_CONNECTIONS_SRCS})
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set_source_files_properties(${src_file}
@@ -140,31 +148,33 @@ endif()
endforeach(src_file)
set(CPP-NETLIB_HTTP_CLIENT_SRCS
- http/client.cpp)
-add_library(cppnetlib-http-client ${CPP-NETLIB_HTTP_CLIENT_SRCS})
-add_dependencies(cppnetlib-http-client
- ${CPP-NETLIB_LOGGING_LIB}
- cppnetlib-constants
- cppnetlib-uri
- cppnetlib-message
- cppnetlib-message-wrappers
- cppnetlib-message-directives
- cppnetlib-http-message
- cppnetlib-http-message-wrappers
- cppnetlib-http-client-connections
- )
-target_link_libraries(cppnetlib-http-client
- ${Boost_LIBRARIES}
- ${CPP-NETLIB_LOGGING_LIB}
- cppnetlib-constants
- cppnetlib-uri
- cppnetlib-message
- cppnetlib-message-wrappers
- cppnetlib-message-directives
- cppnetlib-http-message
- cppnetlib-http-message-wrappers
- cppnetlib-http-client-connections
- )
+ ${CMAKE_CURRENT_SOURCE_DIR}/http/client.cpp)
+if(NOT CPP-NETLIB_BUILD_SINGLE_LIB)
+ add_library(cppnetlib-http-client ${CPP-NETLIB_HTTP_CLIENT_SRCS})
+ add_dependencies(cppnetlib-http-client
+ ${CPP-NETLIB_LOGGING_LIB}
+ cppnetlib-constants
+ cppnetlib-uri
+ cppnetlib-message
+ cppnetlib-message-wrappers
+ cppnetlib-message-directives
+ cppnetlib-http-message
+ cppnetlib-http-message-wrappers
+ cppnetlib-http-client-connections
+ )
+ target_link_libraries(cppnetlib-http-client
+ ${Boost_LIBRARIES}
+ ${CPP-NETLIB_LOGGING_LIB}
+ cppnetlib-constants
+ cppnetlib-uri
+ cppnetlib-message
+ cppnetlib-message-wrappers
+ cppnetlib-message-directives
+ cppnetlib-http-message
+ cppnetlib-http-message-wrappers
+ cppnetlib-http-client-connections
+ )
+endif()
foreach (src_file ${CPP-NETLIB_HTTP_CLIENT_SRCS})
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set_source_files_properties(${src_file}
@@ -175,8 +185,10 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
endif()
endforeach(src_file)
-set(CPP-NETLIB_CONSTANTS_SRCS constants.cpp)
-add_library(cppnetlib-constants ${CPP-NETLIB_CONSTANTS_SRCS})
+set(CPP-NETLIB_CONSTANTS_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/constants.cpp)
+if(NOT CPP-NETLIB_BUILD_SINGLE_LIB)
+ add_library(cppnetlib-constants ${CPP-NETLIB_CONSTANTS_SRCS})
+endif()
foreach (src_file ${CPP-NETLIB_CONSTANTS_SRCS})
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set_source_files_properties(${src_file}
@@ -186,3 +198,11 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
endif()
endforeach(src_file)
+
+
+# propagate sources to parent directory for one-lib-build
+set(CPP-NETLIB_HTTP_MESSAGE_SRCS ${CPP-NETLIB_HTTP_MESSAGE_SRCS} PARENT_SCOPE)
+set(CPP-NETLIB_HTTP_MESSAGE_WRAPPERS_SRCS ${CPP-NETLIB_HTTP_MESSAGE_WRAPPERS_SRCS} PARENT_SCOPE)
+set(CPP-NETLIB_HTTP_CLIENT_CONNECTIONS_SRCS ${CPP-NETLIB_HTTP_CLIENT_CONNECTIONS_SRCS} PARENT_SCOPE)
+set(CPP-NETLIB_HTTP_CLIENT_SRCS ${CPP-NETLIB_HTTP_CLIENT_SRCS} PARENT_SCOPE)
+set(CPP-NETLIB_CONSTANTS_SRCS ${CPP-NETLIB_CONSTANTS_SRCS} PARENT_SCOPE)
View
58 http/test/CMakeLists.txt
@@ -30,34 +30,37 @@ if (CPP-NETLIB_BUILD_TESTS)
request_base_test
request_test
response_test
- response_incremental_parser_test
- )
+ response_incremental_parser_test)
+ if(CPP-NETLIB_BUILD_SINGLE_LIB)
+ set(link_cppnetlib_lib cppnetlib)
+ set(dependencies cppnetlib)
+ else()
+ set(link_cppnetlib_lib cppnetlib-message
+ cppnetlib-message-wrappers
+ cppnetlib-http-message
+ cppnetlib-http-message-wrappers
+ cppnetlib-uri
+ cppnetlib-constants)
+ set(dependencies cppnetlib-message
+ cppnetlib-message-wrappers
+ cppnetlib-http-message
+ cppnetlib-http-message-wrappers
+ cppnetlib-uri
+ cppnetlib-constants)
+ endif()
foreach ( test ${MESSAGE_TESTS} )
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set_source_files_properties(${test}.cpp
PROPERTIES COMPILE_FLAGS "-Wall")
endif()
add_executable(cpp-netlib-http-${test} ${test}.cpp)
- add_dependencies(cpp-netlib-http-${test}
- cppnetlib-message
- cppnetlib-message-wrappers
- cppnetlib-http-message
- cppnetlib-http-message-wrappers
- cppnetlib-uri
- cppnetlib-constants
- )
+ add_dependencies(cpp-netlib-http-${test} ${dependencies})
target_link_libraries(cpp-netlib-http-${test}
${Boost_LIBRARIES}
${GTEST_BOTH_LIBRARIES}
${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
- cppnetlib-message
- cppnetlib-message-wrappers
- cppnetlib-http-message
- cppnetlib-http-message-wrappers
- cppnetlib-uri
- cppnetlib-constants
- )
+ ${link_cppnetlib_lib})
set_target_properties(cpp-netlib-http-${test}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
add_test(cpp-netlib-http-${test}
@@ -68,13 +71,10 @@ if (CPP-NETLIB_BUILD_TESTS)
set_source_files_properties(client_test.cpp
PROPERTIES COMPILE_FLAGS "-Wall")
endif()
- add_executable(cpp-netlib-http-client_test client_test.cpp)
- target_link_libraries(cpp-netlib-http-client_test
- ${Boost_LIBRARIES}
- ${GTEST_BOTH_LIBRARIES}
- ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES}
- ${CMAKE_THREAD_LIBS_INIT}
- cppnetlib-constants
+ if(CPP-NETLIB_BUILD_SINGLE_LIB)
+ set(link_cppnetlib_lib cppnetlib)
+ else()
+ set(link_cppnetlib_lib cppnetlib-constants
cppnetlib-uri
cppnetlib-message
cppnetlib-message-wrappers
@@ -85,13 +85,21 @@ if (CPP-NETLIB_BUILD_TESTS)
cppnetlib-http-client
cppnetlib-http-client-connections
cppnetlib-logging)
+ endif()
+ add_executable(cpp-netlib-http-client_test client_test.cpp)
+ target_link_libraries(cpp-netlib-http-client_test
+ ${Boost_LIBRARIES}
+ ${GTEST_BOTH_LIBRARIES}
+ ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES}
+ ${CMAKE_THREAD_LIBS_INIT}
+ ${link_cppnetlib_lib})
if (OPENSSL_FOUND)
target_link_libraries(cpp-netlib-http-client_test ${OPENSSL_LIBRARIES})
endif()
set_target_properties(cpp-netlib-http-client_test
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
add_test(cpp-netlib-http-client_test
- ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test})
+ ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-client_test)
# set ( SERVER_API_TESTS
# server_constructor_test
View
5 logging/CMakeLists.txt
@@ -5,7 +5,7 @@
if( CPP-NETLIB_ALWAYS_LOGGING )
- add_definitions( /D NETWORK_ENABLE_LOGGING )
+ add_definitions( -DNETWORK_ENABLE_LOGGING )
endif()
if( NOT CPP-NETLIB_DISABLE_LOGGING )
@@ -21,3 +21,6 @@ if( NOT CPP-NETLIB_DISABLE_LOGGING )
endif(CPP-NETLIB_BUILD_TESTS)
endif()
+
+# propagate sources to parent directory for one-lib-build
+set(CPP-NETLIB_LOGGING_SRCS ${CPP-NETLIB_LOGGING_SRCS} PARENT_SCOPE)
View
9 logging/src/CMakeLists.txt
@@ -15,8 +15,10 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
endif()
include_directories(${CPP-NETLIB_SOURCE_DIR}/logging/src)
-set(CPP-NETLIB_LOGGING_SRCS logging.cpp)
-add_library(cppnetlib-logging ${CPP-NETLIB_LOGGING_SRCS})
+set(CPP-NETLIB_LOGGING_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/logging.cpp)
+if(NOT CPP-NETLIB_BUILD_SINGLE_LIB)
+ add_library(cppnetlib-logging ${CPP-NETLIB_LOGGING_SRCS})
+endif()
foreach (src_file ${CPP-NETLIB_LOGGING_SRCS})
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set_source_files_properties(${src_file}
@@ -26,3 +28,6 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
endif()
endforeach(src_file)
+
+# propagate sources to parent directory for one-lib-build
+set(CPP-NETLIB_LOGGING_SRCS ${CPP-NETLIB_LOGGING_SRCS} PARENT_SCOPE)
View
13 logging/test/CMakeLists.txt
@@ -15,15 +15,22 @@ if (CPP-NETLIB_BUILD_TESTS)
logging_log_record
logging_custom_handler
)
+ if(CPP-NETLIB_BUILD_SINGLE_LIB)
+ set(link_cppnetlib_lib cppnetlib)
+ set(dependency cppnetlib)
+ else()
+ set(link_cppnetlib_lib cppnetlib-logging)
+ set(dependency cppnetlib-logging)
+ endif()
foreach (test ${TESTS})
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set_source_files_properties(${test}.cpp
- PROPERTIES COMPILE_FLAGS "-Wall")
+ PROPERTIES COMPILE_FLAGS "-Wall")
endif()
add_executable(cpp-netlib-${test} ${test}.cpp)
- add_dependencies(cpp-netlib-${test} cppnetlib-logging)
+ add_dependencies(cpp-netlib-${test} ${dependency})
target_link_libraries(cpp-netlib-${test}
- ${Boost_LIBRARIES} ${GTEST_BOTH_LIBRARIES} cppnetlib-logging)
+ ${Boost_LIBRARIES} ${GTEST_BOTH_LIBRARIES} ${link_cppnetlib_lib})
set_target_properties(cpp-netlib-${test}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
add_test(cpp-netlib-${test}
View
5 message/CMakeLists.txt
@@ -9,3 +9,8 @@ if(CPP-NETLIB_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif(CPP-NETLIB_BUILD_TESTS)
+
+# propagate sources to parent directory for one-lib-build
+set(CPP-NETLIB_MESSAGE_SRCS ${CPP-NETLIB_MESSAGE_SRCS} PARENT_SCOPE)
+set(CPP-NETLIB_MESSAGE_DIRECTIVES_SRCS ${CPP-NETLIB_MESSAGE_DIRECTIVES_SRCS} PARENT_SCOPE)
+set(CPP-NETLIB_MESSAGE_WRAPPERS_SRCS ${CPP-NETLIB_MESSAGE_WRAPPERS_SRCS} PARENT_SCOPE)
View
27 message/src/CMakeLists.txt
@@ -16,10 +16,12 @@ endif()
include_directories(${CPP-NETLIB_SOURCE_DIR}/uri/src ${CPP-NETLIB_SOURCE_DIR}/message/src)
-set(CPP-NETLIB_MESSAGE_SRCS message.cpp)
-add_library(cppnetlib-message ${CPP-NETLIB_MESSAGE_SRCS})
-add_dependencies(cppnetlib-message cppnetlib-uri)
-target_link_libraries(cppnetlib-message cppnetlib-uri)
+set(CPP-NETLIB_MESSAGE_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/message.cpp)
+if(NOT CPP-NETLIB_BUILD_SINGLE_LIB)
+ add_library(cppnetlib-message ${CPP-NETLIB_MESSAGE_SRCS})
+ add_dependencies(cppnetlib-message cppnetlib-uri)
+ target_link_libraries(cppnetlib-message cppnetlib-uri)
+endif()
foreach (src_file ${CPP-NETLIB_MESSAGE_SRCS})
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set_source_files_properties(${src_file}
@@ -30,8 +32,10 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
endif()
endforeach(src_file)
-set(CPP-NETLIB_MESSAGE_DIRECTIVES_SRCS directives.cpp)
-add_library(cppnetlib-message-directives ${CPP-NETLIB_MESSAGE_DIRECTIVES_SRCS})
+set(CPP-NETLIB_MESSAGE_DIRECTIVES_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/directives.cpp)
+if(NOT CPP-NETLIB_BUILD_SINGLE_LIB)
+ add_library(cppnetlib-message-directives ${CPP-NETLIB_MESSAGE_DIRECTIVES_SRCS})
+endif()
foreach (src_file ${CPP-NETLIB_MESSAGE_DIRECTIVES_SRCS})
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set_source_files_properties(${src_file}
@@ -42,8 +46,10 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
endif()
endforeach(src_file)
-set(CPP-NETLIB_MESSAGE_WRAPPERS_SRCS wrappers.cpp)
-add_library(cppnetlib-message-wrappers ${CPP-NETLIB_MESSAGE_WRAPPERS_SRCS})
+set(CPP-NETLIB_MESSAGE_WRAPPERS_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/wrappers.cpp)
+if(NOT CPP-NETLIB_BUILD_SINGLE_LIB)
+ add_library(cppnetlib-message-wrappers ${CPP-NETLIB_MESSAGE_WRAPPERS_SRCS})
+endif()
foreach (src_file ${CPP-NETLIB_MESSAGE_WRAPPERS_SRCS})
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set_source_files_properties(${src_file}
@@ -53,3 +59,8 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
endif()
endforeach(src_file)
+
+# propagate sources to parent directory for one-lib-build
+set(CPP-NETLIB_MESSAGE_SRCS ${CPP-NETLIB_MESSAGE_SRCS} PARENT_SCOPE)
+set(CPP-NETLIB_MESSAGE_DIRECTIVES_SRCS ${CPP-NETLIB_MESSAGE_DIRECTIVES_SRCS} PARENT_SCOPE)
+set(CPP-NETLIB_MESSAGE_WRAPPERS_SRCS ${CPP-NETLIB_MESSAGE_WRAPPERS_SRCS} PARENT_SCOPE)
View
21 message/test/CMakeLists.txt
@@ -9,16 +9,29 @@ include_directories(${CPP-NETLIB_SOURCE_DIR}/message/src)
if (CPP-NETLIB_BUILD_TESTS)
set(TESTS message_test message_transform_test)
+ if(CPP-NETLIB_BUILD_SINGLE_LIB)
+ set(link_cppnetlib_lib cppnetlib)
+ set(dependencies cppnetlib)
+ else()
+ set(link_cppnetlib_lib cppnetlib-message
+ cppnetlib-message-directives
+ cppnetlib-message-wrappers)
+ set(dependencies cppnetlib-message
+ cppnetlib-message-directives
+ cppnetlib-message-wrappers)
+ endif()
foreach (test ${TESTS})
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set_source_files_properties(${test}.cpp
- PROPERTIES COMPILE_FLAGS "-Wall")
+ PROPERTIES COMPILE_FLAGS "-Wall")
endif()
add_executable(cpp-netlib-${test} ${test}.cpp)
- add_dependencies(cpp-netlib-${test} cppnetlib-message cppnetlib-message-directives cppnetlib-message-wrappers)
+ add_dependencies(cpp-netlib-${test} ${dependencies})
target_link_libraries(cpp-netlib-${test}
- ${Boost_SYSTEM_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${GTEST_BOTH_LIBRARIES}
- cppnetlib-message cppnetlib-message-directives cppnetlib-message-wrappers)
+ ${Boost_SYSTEM_LIBRARY}
+ ${CMAKE_THREAD_LIBS_INIT}
+ ${GTEST_BOTH_LIBRARIES}
+ ${link_cppnetlib_lib})
if (OPENSSL_FOUND)
target_link_libraries(cpp-netlib-${test} ${OPENSSL_LIBRARIES})
endif()
2  uri
@@ -1 +1 @@
-Subproject commit e3ed456dbec947765018b1dde9ede787bad91814
+Subproject commit 79565659303a8f16244d6cbd2d695e28cad55cbf
Something went wrong with that request. Please try again.