Skip to content

Commit a1e87c1

Browse files
committed
Updates to logging CMake configuration.
1 parent 4f55b19 commit a1e87c1

File tree

5 files changed

+19
-43
lines changed

5 files changed

+19
-43
lines changed

concurrency/test/CMakeLists.txt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@
55

66
include_directories(${CPP-NETLIB_SOURCE_DIR}/concurrency/src
77
${GTEST_INCLUDE_DIRS}
8+
${CPP-NETLIB_SOURCE_DIR}
89
)
910

10-
add_executable(cpp-netlib-thread_pool_test thread_pool_test.cpp)
11-
target_link_libraries(cpp-netlib-thread_pool_test
12-
cppnetlib-concurrency
13-
${Boost_LIBRARIES}
14-
${GTEST_BOTH_LIBRARIES}
15-
${CMAKE_THREAD_LIBS_INIT})
16-
set_target_properties(cpp-netlib-thread_pool_test
17-
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
18-
add_test(cpp-netlib-thread_pool_test ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-thread_pool_test)
11+
if (CPP-NETLIB_BUILD_TESTS)
12+
add_executable(cpp-netlib-thread_pool_test thread_pool_test.cpp)
13+
target_link_libraries(cpp-netlib-thread_pool_test
14+
cppnetlib-concurrency
15+
${Boost_LIBRARIES}
16+
${GTEST_BOTH_LIBRARIES}
17+
${CMAKE_THREAD_LIBS_INIT})
18+
set_target_properties(cpp-netlib-thread_pool_test PROPERTIES
19+
RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
20+
add_test(cpp-netlib-thread_pool_test
21+
${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-thread_pool_test)
22+
endif()

http/test/CMakeLists.txt

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ if (OPENSSL_FOUND)
1717
add_definitions(-DNETWORK_ENABLE_HTTPS)
1818
endif()
1919

20-
if( NOT CPP-NETLIB_DISABLE_LOGGING )
21-
set( CPP-NETLIB_LOGGING_LIB cppnetlib-logging )
22-
endif()
23-
24-
# this library name is defined only if we created the target
25-
# if not then it will be empty
26-
set( CPP-NETLIB_LOGGING_LIB cppnetlib-logging )
27-
2820
if (CPP-NETLIB_BUILD_TESTS)
2921
# These are the internal (simple) tests.
3022
set (MESSAGE_TESTS request_base_test request_test response_test
@@ -37,8 +29,7 @@ if (CPP-NETLIB_BUILD_TESTS)
3729
cppnetlib-http-message
3830
cppnetlib-http-message-wrappers
3931
cppnetlib-uri
40-
cppnetlib-constants
41-
)
32+
cppnetlib-constants)
4233
target_link_libraries(cpp-netlib-http-${test}
4334
${Boost_LIBRARIES}
4435
${GTEST_BOTH_LIBRARIES}
@@ -49,8 +40,7 @@ if (CPP-NETLIB_BUILD_TESTS)
4940
cppnetlib-http-message
5041
cppnetlib-http-message-wrappers
5142
cppnetlib-uri
52-
cppnetlib-constants
53-
)
43+
cppnetlib-constants)
5444
set_target_properties(cpp-netlib-http-${test}
5545
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
5646
add_test(cpp-netlib-http-${test}
@@ -73,8 +63,7 @@ if (CPP-NETLIB_BUILD_TESTS)
7363
cppnetlib-http-message
7464
cppnetlib-http-message-wrappers
7565
cppnetlib-http-client
76-
cppnetlib-http-client-connections
77-
cppnetlib-logging)
66+
cppnetlib-http-client-connections)
7867
if (OPENSSL_FOUND)
7968
target_link_libraries(cpp-netlib-http-client_test ${OPENSSL_LIBRARIES})
8069
endif()

logging/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ if( NOT CPP-NETLIB_DISABLE_LOGGING )
1414
# this library name is defined only if we created the target
1515
# if not then it will be empty
1616
set( CPP-NETLIB_LOGGING_LIB cppnetlib-logging )
17+
add_definitions(-DNETWORK_ENABLE_LOGGING)
1718

1819
if(CPP-NETLIB_BUILD_TESTS)
1920
enable_testing()

logging/src/CMakeLists.txt

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,8 @@
33
# (See accompanying file LICENSE_1_0.txt or copy at
44
# http://www.boost.org/LICENSE_1_0.txt)
55

6-
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
7-
set(CPP-NETLIB_CXXFLAGS "-Wall -std=c++11")
8-
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
9-
CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD11)
10-
if (CPP-NETLIB_DISABLE_LIBCXX)
11-
set(CPP-NETLIB_CXXFLAGS "-Wall -std=c++11")
12-
else()
13-
set(CPP-NETLIB_CXXFLAGS "-Wall -std=c++11 -stdlib=libc++")
14-
endif()
15-
endif()
16-
17-
include_directories(${CPP-NETLIB_SOURCE_DIR}/logging/src)
6+
include_directories(${CPP-NETLIB_SOURCE_DIR}/logging/src ${CPP-NETLIB_SOURCE_DIR})
187
set(CPP-NETLIB_LOGGING_SRCS logging.cpp)
198
add_library(cppnetlib-logging ${CPP-NETLIB_LOGGING_SRCS})
209
foreach (src_file ${CPP-NETLIB_LOGGING_SRCS})
21-
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
22-
set_source_files_properties(${src_file}
23-
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
24-
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
25-
set_source_files_properties(${src_file}
26-
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
27-
endif()
2810
endforeach(src_file)

message/src/network/detail/debug.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
The user can force the logging to be enabled by defining NETWORK_ENABLE_LOGGING.
1717
*/
18-
#if defined(NETWORK_DEBUG) && !defined(NETWORK_ENABLE_LOGGING)
18+
#if defined(NETWORK_DEBUG) && defined(NETWORK_ENABLE_LOGGING)
1919
#define NETWORK_ENABLE_LOGGING
2020
#endif
2121

0 commit comments

Comments
 (0)