Skip to content

Commit

Permalink
Fix build error when using msys2 gcc 13.2.0 (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
swebb2066 authored Nov 20, 2023
1 parent 2a381ae commit d9433fc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ if(LOG4CXX_QT_SUPPORT)
)
endif(LOG4CXX_QT_SUPPORT)

IF(WIN32 AND BUILD_SHARED_LIBS AND LOG4CXX_INSTALL_PDB)
IF(MSVC AND BUILD_SHARED_LIBS AND LOG4CXX_INSTALL_PDB)
INSTALL(FILES $<TARGET_PDB_FILE:log4cxx>
DESTINATION ${CMAKE_INSTALL_BINDIR}
CONFIGURATIONS RelWithDebInfo Debug
Expand Down
8 changes: 6 additions & 2 deletions src/examples/cpp/com/foo/config3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
#include <Windows.h>
#elif __APPLE__
#include <mach-o/dyld.h>
#elif (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 500) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L)
#include <unistd.h> // getpid
#else
#include <unistd.h> /* getpid */
#include <cstring> // strncpy
#endif


Expand All @@ -51,12 +53,14 @@ auto DefaultConfigurationFileNames(std::string& altPrefix) -> std::vector<std::s
pathSepar = '\\';
#elif defined(__APPLE__)
_NSGetExecutablePath(buf, &bufCount);
#else
#elif (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 500) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L)
std::ostringstream exeLink;
exeLink << "/proc/" << getpid() << "/exe";
bufCount = readlink(exeLink.str().c_str(), buf, bufSize);
if (0 < bufCount)
buf[bufCount] = 0;
#else
strncpy(buf, "auto-configured", bufSize);
#endif
std::string programFileName(buf);
auto slashIndex = programFileName.rfind(pathSepar);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

# Configure
if(WIN32)
if(MSVC)
target_sources(log4cxx
PRIVATE
../resources/log4cxx.rc
Expand Down

0 comments on commit d9433fc

Please sign in to comment.