Skip to content

Commit eacf307

Browse files
committed
Updated build script references.
1 parent 9c4f0a5 commit eacf307

File tree

4 files changed

+54
-12
lines changed

4 files changed

+54
-12
lines changed

logging/CMakeLists.txt

+17-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,21 @@
33
# (See accompanying file LICENSE_1_0.txt or copy at
44
# http://www.boost.org/LICENSE_1_0.txt)
55

6-
add_subdirectory(src)
76

8-
if(CPP-NETLIB_BUILD_TESTS)
9-
enable_testing()
10-
add_subdirectory(test)
11-
endif(CPP-NETLIB_BUILD_TESTS)
7+
if( CPP-NETLIB_ALWAYS_LOGGING )
8+
add_definitions( /D NETWORK_ENABLE_LOGGING )
9+
endif()
10+
11+
if( NOT CPP-NETLIB_DISABLE_LOGGING )
12+
add_subdirectory(src)
13+
14+
# this library name is defined only if we created the target
15+
# if not then it will be empty
16+
set( CPP-NETLIB_LOGGING_LIB cppnetlib-logging )
17+
18+
if(CPP-NETLIB_BUILD_TESTS)
19+
enable_testing()
20+
add_subdirectory(test)
21+
endif(CPP-NETLIB_BUILD_TESTS)
22+
23+
endif()

logging/test/CMakeLists.txt

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
# Copyright (c) A. Joel Lamotte 2012.
2+
# Copyright (c) Glyn Matthews 2012.
23
# Distributed under the Boost Software License, Version 1.0.
34
# (See accompanying file LICENSE_1_0.txt or copy at
45
# http://www.boost.org/LICENSE_1_0.txt)
56

6-
include_directories(${CPP-NETLIB_SOURCE_DIR}/include)
7-
include_directories(${CPP-NETLIB_SOURCE_DIR})
7+
include_directories(${CPP-NETLIB_SOURCE_DIR}/uri/src)
8+
include_directories(${CPP-NETLIB_SOURCE_DIR}/message/src)
9+
include_directories(${CPP-NETLIB_SOURCE_DIR}/logging/src)
810

911
if (Boost_FOUND)
1012
set(
1113
TESTS
12-
logging_log_record
14+
logging_log_record
1315
logging_custom_handler
1416
)
1517
foreach (test ${TESTS})
1618
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
1719
set_source_files_properties(${test}.cpp
18-
PROPERTIES COMPILE_FLAGS "-Wall")
20+
PROPERTIES COMPILE_FLAGS "-Wall")
1921
endif()
2022
add_executable(cpp-netlib-${test} ${test}.cpp)
2123
add_dependencies(cpp-netlib-${test} cppnetlib-logging)

message/src/CMakeLists.txt

+29-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
1616
endif()
1717

1818
include_directories(${CPP-NETLIB_SOURCE_DIR}/uri/src ${CPP-NETLIB_SOURCE_DIR}/message/src)
19-
set(CPP-NETLIB_MESSAGE_SRCS message.cpp directives.cpp wrappers.cpp)
19+
20+
set(CPP-NETLIB_MESSAGE_SRCS message.cpp)
2021
add_library(cppnetlib-message ${CPP-NETLIB_MESSAGE_SRCS})
22+
add_dependencies(cppnetlib-message cppnetlib-uri)
23+
target_link_libraries(cppnetlib-message cppnetlib-uri)
2124
foreach (src_file ${CPP-NETLIB_MESSAGE_SRCS})
2225
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
2326
set_source_files_properties(${src_file}
@@ -27,3 +30,28 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
2730
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
2831
endif()
2932
endforeach(src_file)
33+
34+
set(CPP-NETLIB_MESSAGE_DIRECTIVES_SRCS directives.cpp)
35+
add_library(cppnetlib-message-directives ${CPP-NETLIB_MESSAGE_DIRECTIVES_SRCS})
36+
foreach (src_file ${CPP-NETLIB_MESSAGE_DIRECTIVES_SRCS})
37+
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
38+
set_source_files_properties(${src_file}
39+
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
40+
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
41+
set_source_files_properties(${src_file}
42+
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
43+
endif()
44+
endforeach(src_file)
45+
46+
set(CPP-NETLIB_MESSAGE_WRAPPERS_SRCS wrappers.cpp)
47+
add_library(cppnetlib-message-wrappers ${CPP-NETLIB_MESSAGE_WRAPPERS_SRCS})
48+
foreach (src_file ${CPP-NETLIB_MESSAGE_WRAPPERS_SRCS})
49+
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
50+
set_source_files_properties(${src_file}
51+
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
52+
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
53+
set_source_files_properties(${src_file}
54+
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
55+
endif()
56+
endforeach(src_file)
57+

message/test/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ if (Boost_FOUND)
1818
PROPERTIES COMPILE_FLAGS "-Wall")
1919
endif()
2020
add_executable(cpp-netlib-${test} ${test}.cpp)
21-
add_dependencies(cpp-netlib-${test} cppnetlib-uri cppnetlib-message)
21+
add_dependencies(cpp-netlib-${test} cppnetlib-uri cppnetlib-message cppnetlib-message-directives cppnetlib-message-wrappers)
2222
target_link_libraries(cpp-netlib-${test}
23-
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} cppnetlib-uri cppnetlib-message)
23+
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} cppnetlib-uri cppnetlib-message cppnetlib-message-directives cppnetlib-message-wrappers)
2424
if (OPENSSL_FOUND)
2525
target_link_libraries(cpp-netlib-${test} ${OPENSSL_LIBRARIES})
2626
endif()

0 commit comments

Comments
 (0)