diff --git a/CMakeLists.txt b/CMakeLists.txt index c2cd2c0ef..cb4a0febd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 $ DESTINATION ${CMAKE_INSTALL_BINDIR} CONFIGURATIONS RelWithDebInfo Debug diff --git a/src/examples/cpp/com/foo/config3.cpp b/src/examples/cpp/com/foo/config3.cpp index 349740517..c980248f8 100644 --- a/src/examples/cpp/com/foo/config3.cpp +++ b/src/examples/cpp/com/foo/config3.cpp @@ -28,8 +28,10 @@ #include #elif __APPLE__ #include +#elif (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 500) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) +#include // getpid #else -#include /* getpid */ +#include // strncpy #endif @@ -51,12 +53,14 @@ auto DefaultConfigurationFileNames(std::string& altPrefix) -> std::vector= 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); diff --git a/src/main/resources/CMakeLists.txt b/src/main/resources/CMakeLists.txt index ce653e553..dfcc89dd3 100644 --- a/src/main/resources/CMakeLists.txt +++ b/src/main/resources/CMakeLists.txt @@ -16,7 +16,7 @@ # # Configure -if(WIN32) +if(MSVC) target_sources(log4cxx PRIVATE ../resources/log4cxx.rc