8000 Attempt better CMake integration for log4cplus users. · log4cplus/log4cplus@c60b532 · GitHub
[go: up one dir, main page]

Skip to content

Commit c60b532

Browse files
committed
Attempt better CMake integration for log4cplus users.
See also GitHub issue #417.
1 parent fa5dadc commit c60b532

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

qt4debugappender/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ set (qt4debugappender_sources
44
if (${BUILD_SHARED_LIBS})
55
add_definitions (-D${log4cplus}_EXPORTS)
66
endif ()
7-
if (UNICODE)
8-
add_definitions (-DUNICODE -D_UNICODE -UMBCS -U_MBCS)
9-
endif (UNICODE)
107

118
find_package (Qt4 REQUIRED)
129
include (${QT_USE_FILE})
1310

1411
set (qt4debugappender log4cplusqt4debugappender${log4cplus_postfix})
1512
add_library (${qt4debugappender} ${qt4debugappender_sources})
13+
if (UNICODE)
14+
target_compile_definitions (${qt4debugappender} PUBLIC UNICODE)
15+
target_compile_definitions (${qt4debugappender} PUBLIC _UNICODE)
16+
add_definitions (-UMBCS -U_MBCS)
17+
endif (UNICODE)
1618
target_link_libraries (${qt4debugappender}
1719
${log4cplus}
1820
${QT_LIBRARIES}

qt5debugappender/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@ set (qt5debugappender_sources
44
if (${BUILD_SHARED_LIBS})
55
add_definitions (-D${log4cplus}_EXPORTS)
66
endif ()
7-
if (UNICODE)
8-
add_definitions (-DUNICODE -D_UNICODE -UMBCS -U_MBCS)
9-
endif (UNICODE)
107

118
find_package (Qt5Core REQUIRED)
129
#include (${QT_USE_FILE})
1310

1411
set (qt5debugappender log4cplusqt5debugappender${log4cplus_postfix})
1512
add_library (${qt5debugappender} ${qt5debugappender_sources})
13+
if (UNICODE)
14+
target_compile_definitions (${qt5debugappender} PUBLIC UNICODE)
15+
target_compile_definitions (${qt5debugappender} PUBLIC _UNICODE)
16+
add_definitions (-UMBCS -U_MBCS)
17+
endif (UNICODE)
1618
target_link_libraries (${qt5debugappender}
1719
${log4cplus}
1820
${Qt5Widgets_LIBRARIES}

simpleserver/CMakeLists.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
if (UNICODE)
2-
add_definitions (-DUNICODE -D_UNICODE -UMBCS -U_MBCS)
3-
endif (UNICODE)
4-
51
message (STATUS "Threads: ${CMAKE_THREAD_LIBS_INIT}")
6-
72
set (loggingserver_sources loggingserver.cxx)
83

94
message (STATUS "Sources: ${loggingserver_sources}")
105

11-
add_executable (loggingserver ${loggingserver_sources})
12-
target_link_libraries (loggingserver ${log4cplus})
6+
set (loggingserver loggingserver${log4cplus_postfix})
7+
add_executable (${loggingserver} ${loggingserver_sources})
8+
if (UNICODE)
9+
target_compile_definitions (${loggingserver} PUBLIC UNICODE)
10+
target_compile_definitions (${loggingserver} PUBLIC _UNICODE)
11+
add_definitions (-UMBCS -U_MBCS)
12+
endif (UNICODE)
13+
target_link_libraries (${loggingserver} ${log4cplus})
1314

14-
install(TARGETS loggingserver DESTINATION ${CMAKE_INSTALL_BINDIR})
15+
install(TARGETS ${loggingserver} DESTINATION ${CMAKE_INSTALL_BINDIR})

src/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ endif ()
6767

6868
# Define _GNU_SOURCE so that functions like `pipe2()` are visible.
6969
add_definitions (-D_GNU_SOURCE=1)
70-
if (UNICODE)
71-
add_definitions (-DUNICODE -D_UNICODE -UMBCS -U_MBCS)
72-
endif (UNICODE)
7370
if (WIN32)
7471
add_definitions (-DMINGW_HAS_SECURE_API=1)
7572
add_definitions (-D_WIN32_WINNT=${_WIN32_WINNT})
@@ -85,6 +82,12 @@ endif (WIN32)
8582

8683
add_library (${log4cplus} ${log4cplus_sources})
8784

85+
if (UNICODE)
86+
target_compile_definitions (${log4cplus} PUBLIC UNICODE)
87+
target_compile_definitions (${log4cplus} PUBLIC _UNICODE)
88+
add_definitions (-UMBCS -U_MBCS)
89+
endif (UNICODE)
90+
8891
set (log4cplus_LIBS ${CMAKE_THREAD_LIBS_INIT})
8992
if (LIBRT)
9093
list (APPEND log4cplus_LIBS ${LIBRT})

0 commit comments

Comments
 (0)
0