diff --git a/src/plugins/tracing/CMakeLists.txt b/src/plugins/tracing/CMakeLists.txt index 94e9eccfdd2..823e11c1749 100644 --- a/src/plugins/tracing/CMakeLists.txt +++ b/src/plugins/tracing/CMakeLists.txt @@ -25,3 +25,8 @@ qt_internal_extend_target(QCtfTracePlugin CONDITION QT_FEATURE_zstd LIBRARIES WrapZSTD::WrapZSTD ) + +qt_internal_extend_target(QCtfTracePlugin CONDITION (QT_FEATURE_cxx17_filesystem) AND (GCC AND (QMAKE_GCC_MAJOR_VERSION LESS 9)) + LINK_OPTIONS + "-lstdc++fs" +) diff --git a/src/plugins/tracing/qctflib.cpp b/src/plugins/tracing/qctflib.cpp index dc8bd77bd43..fe3946d27cf 100644 --- a/src/plugins/tracing/qctflib.cpp +++ b/src/plugins/tracing/qctflib.cpp @@ -15,7 +15,7 @@ #include #include "qctflib_p.h" -#ifndef Q_OS_INTEGRITY +#if QT_CONFIG(cxx17_filesystem) #include #endif @@ -121,7 +121,7 @@ QCtfLibImpl::QCtfLibImpl() m_session.tracepoints.append(allLiteral()); m_session.name = defaultLiteral(); } else { -#ifdef Q_OS_INTEGRITY +#if !QT_CONFIG(cxx17_filesystem) qCWarning(lcDebugTrace) << "Unable to use filesystem"; return; #endif @@ -168,7 +168,7 @@ QCtfLibImpl::QCtfLibImpl() m_session.name = defaultLiteral(); } m_location = location + u"/ust"; -#ifndef Q_OS_INTEGRITY +#if QT_CONFIG(cxx17_filesystem) std::filesystem::create_directory(qPrintable(m_location), qPrintable(location)); #endif } @@ -185,7 +185,7 @@ QCtfLibImpl::QCtfLibImpl() void QCtfLibImpl::clearLocation() { -#ifndef Q_OS_INTEGRITY +#if QT_CONFIG(cxx17_filesystem) const std::filesystem::path location{qUtf16Printable(m_location)}; for (auto const& dirEntry : std::filesystem::directory_iterator{location}) {