Skip to content

Commit

Permalink
Deal with MacOS X handling of SO versions log4cplus#479.
Browse files Browse the repository at this point in the history
  • Loading branch information
wilx committed Feb 24, 2021
1 parent 21f0c7f commit a379db4
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ log4cplus_get_version ("${PROJECT_SOURCE_DIR}/include"
message("-- Generating build for Log4cplus version ${log4cplus_version_major}.${log4cplus_version_minor}.${log4cplus_version_patch}")
set (log4cplus_soversion 0)
set (log4cplus_postfix "")
if (APPLE)
set (log4cplus_macho_current_version 7.0.0)
set (log4cplus_macho_compatibility_version 3.0.0)
endif ()

option(LOG4CPLUS_BUILD_TESTING "Build the test suite." ON)
option(LOG4CPLUS_BUILD_LOGGINGSERVER "Build the logging server." ON)
Expand Down
6 changes: 6 additions & 0 deletions qt4debugappender/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ set_target_properties (${qt4debugappender} PROPERTIES
SOVERSION "${log4cplus_soversion}")
target_compile_definitions (${qt4debugappender} PRIVATE INSIDE_LOG4CPLUS_QT4DEBUGAPPENDER)

if (APPLE)
set_target_properties (${log4cplus} PROPERTIES
MACHO_CURRENT_VERSION "${log4cplus_macho_current_version}"
MACHO_COMPATIBILITY_VERSION "${log4cplus_macho_compatibility_version}")
endif ()

if (WIN32)
set_target_properties (${qt4debugappender} PROPERTIES
DEBUG_POSTFIX "D")
Expand Down
6 changes: 6 additions & 0 deletions qt5debugappender/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ set_target_properties (${qt5debugappender} PROPERTIES
SOVERSION "${log4cplus_soversion}")
target_compile_definitions (${qt5debugappender} PRIVATE INSIDE_LOG4CPLUS_QT5DEBUGAPPENDER)

if (APPLE)
set_target_properties (${log4cplus} PROPERTIES
MACHO_CURRENT_VERSION "${log4cplus_macho_current_version}"
MACHO_COMPATIBILITY_VERSION "${log4cplus_macho_compatibility_version}")
endif ()

qt5_use_modules(${qt5debugappender} Core)

if (WIN32)
Expand Down
4 changes: 3 additions & 1 deletion scripts/propagate-version.pl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ BEGIN
local @ARGV = ("CMakeLists.txt");
while (my $line = <>)
{
$line =~ s/^(\s* set \s* \( \s* log4cplus_soversion \s*) (\d+)/$1$so_current_adjusted/x;
$line =~ s/^(\s* set \s* \( \s* log4cplus_soversion \s*) (\d+)/$1$so_current_adjusted/x
|| $line =~ s/^(\s* set \s* \( \s* log4cplus_macho_current_version \s*) (\d+(?:\.\d+)+)/$1$so_current.0.0/x
|| $line =~ s/^(\s* set \s* \( \s* log4cplus_macho_compatibility_version \s*) (\d+(?:\.\d+)+)/$1$so_current_adjusted.0.0/x;
print $line;
}
}
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ else ()
target_compile_definitions (${log4cplus} PRIVATE INSIDE_LOG4CPLUS)
endif ()

if (APPLE)
set_target_properties (${log4cplus} PROPERTIES
MACHO_CURRENT_VERSION "${log4cplus_macho_current_version}"
MACHO_COMPATIBILITY_VERSION "${log4cplus_macho_compatibility_version}")
endif ()

if (MINGW AND LOG4CPLUS_MINGW_STATIC_RUNTIME)
# avoid dependency from mingw libstdc++/libgcc in resulting dll
set_target_properties (${log4cplus} PROPERTIES
Expand Down

0 comments on commit a379db4

Please sign in to comment.