Skip to content

Boost include directories are now tied to targets directly #549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ install:
- sudo apt-get install libboost-system1.53-dev
- sudo apt-get install libboost-regex1.53-dev
- sudo apt-get install libboost-filesystem1.53-dev
- wget -qO- http://www.cmake.org/files/v3.3/cmake-3.3.2-Linux-x86_64.tar.gz | tar xvz && sudo cp -fR cmake-3.3.2-Linux-x86_64/* /usr

before_script:
# update compilers
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
project(CPP-NETLIB)

option( CPP-NETLIB_BUILD_SHARED_LIBS "Build cpp-netlib as shared libraries." OFF )
Expand Down Expand Up @@ -84,7 +84,6 @@ endif(MSVC)
if (WIN32)
add_definitions(-D_WIN32_WINNT=0x0501)
endif(WIN32)
include_directories(${Boost_INCLUDE_DIRS})

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)")
Expand Down Expand Up @@ -157,7 +156,7 @@ if (DOXYGEN_FOUND)
endif(DOXYGEN_FOUND)

if(CPP-NETLIB_BUILD_SINGLE_LIB)
include_directories(
set( all_include_dirs
${CMAKE_CURRENT_SOURCE_DIR}/config/src
${CMAKE_CURRENT_SOURCE_DIR}/concurrency/src
${CMAKE_CURRENT_SOURCE_DIR}/http/src
Expand Down Expand Up @@ -194,4 +193,5 @@ if(CPP-NETLIB_BUILD_SINGLE_LIB)
${CPP-NETLIB_CONCURRENCY_SRCS}
)
target_link_libraries(cppnetlib ${Boost_LIBRARIES})
target_include_directories(cppnetlib PUBLIC ${all_include_dirs} ${Boost_INCLUDE_DIRS})
endif()
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ Building with CMake
~~~~~~~~~~~~~~~~~~~

To build the libraries and run the tests with CMake, you will need to
have CMake version 2.8.10 or higher installed appropriately in your
have CMake version 3.0 or higher installed appropriately in your
system.

::

$ cmake --version
cmake version 2.8.10
cmake version 3.2.2

Inside the cpp-netlib directory, you can issue the following statements to
configure and generate the Makefiles, and build the tests::
Expand Down
1 change: 1 addition & 0 deletions concurrency/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set(CPP-NETLIB_CONCURRENCY_SRCS

if(NOT CPP-NETLIB_BUILD_SINGLE_LIB)
add_library(network-concurrency ${CPP-NETLIB_CONCURRENCY_SRCS})
target_include_directories(network-concurrency PUBLIC ${Boost_INCLUDE_DIRS})
endif()

# prepend current directory to make paths absolute
Expand Down
1 change: 1 addition & 0 deletions concurrency/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ if (CPP-NETLIB_BUILD_TESTS)
${Boost_LIBRARIES}
${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT})
target_include_directories(cpp-netlib-thread_pool_test PUBLIC ${Boost_INCLUDE_DIRS})
set_target_properties(cpp-netlib-thread_pool_test PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
add_test(cpp-netlib-thread_pool_test
Expand Down
1 change: 1 addition & 0 deletions contrib/http_examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ foreach(example ${EXAMPLES})
${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
target_include_directories(${example} PUBLIC ${Boost_INCLUDE_DIRS})
set_target_properties(${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/example)
endforeach(example)
5 changes: 5 additions & 0 deletions http/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,23 @@ if(NOT CPP-NETLIB_BUILD_SINGLE_LIB)
target_link_libraries(network-http-message
${Boost_LIBRARIES}
network-message)
target_include_directories(network-http-message PUBLIC ${Boost_INCLUDE_DIRS})
endif()

set(CPP-NETLIB_HTTP_MESSAGE_WRAPPERS_SRCS
http/message/wrappers.cpp)

if(NOT CPP-NETLIB_BUILD_SINGLE_LIB)
add_library(network-http-message-wrappers ${CPP-NETLIB_HTTP_MESSAGE_WRAPPERS_SRCS})
target_include_directories(network-http-message-wrappers PUBLIC ${Boost_INCLUDE_DIRS})
endif()

set(CPP-NETLIB_CONSTANTS_SRCS
constants.cpp)

if(NOT CPP-NETLIB_BUILD_SINGLE_LIB)
add_library(network-constants ${CPP-NETLIB_CONSTANTS_SRCS})
target_include_directories(network-constants PUBLIC ${Boost_INCLUDE_DIRS})
endif()

# Server implementation files.
Expand All @@ -52,6 +55,7 @@ set(CPP-NETLIB_HTTP_SERVER_SRCS

if (NOT CPP-NETLIB_BUILD_SINGLE_LIB)
add_library(network-http-server ${CPP-NETLIB_HTTP_SERVER_SRCS})
target_include_directories(network-http-server PUBLIC ${Boost_INCLUDE_DIRS})
endif()

# HTTP client
Expand All @@ -64,6 +68,7 @@ target_link_libraries(network-http-v2-client
${Boost_LIBRARIES}
network-uri
)
target_include_directories(network-http-v2-client PUBLIC ${Boost_INCLUDE_DIRS})
if (OPENSSL_FOUND)
target_link_libraries(network-http-v2-client ${OPENSSL_LIBRARIES})
endif()
Expand Down
2 changes: 2 additions & 0 deletions http/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ if (CPP-NETLIB_BUILD_TESTS)
${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${CPPNETLIB_LIBRARIES} )
target_include_directories(cpp-netlib-http-${test} PUBLIC ${Boost_INCLUDE_DIRS})
set_target_properties(cpp-netlib-http-${test}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
add_test(cpp-netlib-http-${test}
Expand Down Expand Up @@ -91,6 +92,7 @@ if (CPP-NETLIB_BUILD_TESTS)
${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${CPPNETLIB_SERVER_LIBRARIES} )
target_include_directories(cpp-netlib-http-${test} PUBLIC ${Boost_INCLUDE_DIRS})
set_target_properties(cpp-netlib-http-${test} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
add_test(cpp-netlib-http-${test}
Expand Down
1 change: 1 addition & 0 deletions http/test/v2/client/features/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ foreach(test ${CPP-NETLIB_CLIENT_TESTS})
${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
target_include_directories(cpp-netlib-http-v2-${test} PUBLIC ${Boost_INCLUDE_DIRS})
set_target_properties(cpp-netlib-http-v2-${test}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
add_test(cpp-netlib-http-v2-${test}
Expand Down
1 change: 1 addition & 0 deletions http/test/v2/client/units/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ foreach(test ${CPP-NETLIB_CLIENT_TESTS})
${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
target_include_directories(cpp-netlib-http-v2-${test} PUBLIC ${Boost_INCLUDE_DIRS})
set_target_properties(cpp-netlib-http-v2-${test}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
add_test(cpp-netlib-http-v2-${test}
Expand Down
1 change: 1 addition & 0 deletions logging/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ if (CPP-NETLIB_BUILD_TESTS)
add_executable(cpp-netlib-${test} ${test}.cpp)
target_link_libraries(cpp-netlib-${test}
${Boost_LIBRARIES} ${GTEST_BOTH_LIBRARIES} ${link_cppnetlib_lib})
target_include_directories(cpp-netlib-${test} PUBLIC ${Boost_INCLUDE_DIRS})
set_target_properties(cpp-netlib-${test}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
add_test(cpp-netlib-${test}
Expand Down
3 changes: 3 additions & 0 deletions message/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@ set(CPP-NETLIB_MESSAGE_SRCS
message.cpp)

add_library(network-message ${CPP-NETLIB_MESSAGE_SRCS})
target_include_directories(network-message PUBLIC ${Boost_INCLUDE_DIRS})
target_link_libraries(network-message network-uri)

set(CPP-NETLIB_MESSAGE_DIRECTIVES_SRCS
directives.cpp)

add_library(network-message-directives ${CPP-NETLIB_MESSAGE_DIRECTIVES_SRCS})
target_include_directories(network-message-directives PUBLIC ${Boost_INCLUDE_DIRS})

set(CPP-NETLIB_MESSAGE_WRAPPERS_SRCS
wrappers.cpp)

add_library(network-message-wrappers ${CPP-NETLIB_MESSAGE_WRAPPERS_SRCS})
target_include_directories(network-message-wrappers PUBLIC ${Boost_INCLUDE_DIRS})

# prepend current directory to make paths absolute
prependToElements( "${CMAKE_CURRENT_SOURCE_DIR}/"
Expand Down