diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c36f4fc6..b19ac6227 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,13 +107,19 @@ endif() # succeeds and the link fails. FindBacktrace resolves both the header and # whichever library actually provides the symbol, so gate on it instead - see # the QET_CRASH_BACKTRACE guard in sources/logging/crashhandler.cpp. -find_package(Backtrace QUIET) -if(Backtrace_FOUND) - list(APPEND QET_PRIVATE_LIBRARIES ${Backtrace_LIBRARIES}) - include_directories(${Backtrace_INCLUDE_DIRS}) - add_compile_definitions(QET_CRASH_BACKTRACE) -else() - message(STATUS "backtrace() not available: crash dumps will carry the log ring without a backtrace") +# Windows uses a separate native exception path and must not probe for the +# POSIX execinfo/backtrace API. +if(NOT WIN32) + find_package(Backtrace QUIET) + if(Backtrace_FOUND) + list(APPEND QET_PRIVATE_LIBRARIES ${Backtrace_LIBRARIES}) + include_directories(${Backtrace_INCLUDE_DIRS}) + add_compile_definitions(QET_CRASH_BACKTRACE) + else() + message(STATUS + "backtrace() not available: crash dumps will carry the log ring " + "without a backtrace") + endif() endif() find_package(SQLite3 REQUIRED) diff --git a/tests/qttest/CMakeLists.txt b/tests/qttest/CMakeLists.txt index 603cc52e9..2b68aa048 100644 --- a/tests/qttest/CMakeLists.txt +++ b/tests/qttest/CMakeLists.txt @@ -51,8 +51,9 @@ find_package( # tst_crashhandler compiles crashhandler.cpp, which on a non-Windows build # may pull in backtrace(). Resolved the same way as in the top-level # CMakeLists so this directory also configures standalone -- on FreeBSD the -# symbol lives in libexecinfo, not libc. -if(NOT DEFINED Backtrace_FOUND) +# symbol lives in libexecinfo, not libc. Windows uses a separate native +# exception path and must not probe for the POSIX execinfo/backtrace API. +if(NOT WIN32 AND NOT DEFINED Backtrace_FOUND) find_package(Backtrace QUIET) if(Backtrace_FOUND) include_directories(${Backtrace_INCLUDE_DIRS}) @@ -155,7 +156,12 @@ add_test(NAME tst_crashhandler COMMAND tst_crashhandler) target_include_directories(tst_crashhandler PRIVATE ${QET_DIR}/sources) # Qt::Xml because crashhandler.cpp includes qetversion.h for the header it # builds at install() time, and that pulls in QDomElement. -target_link_libraries(tst_crashhandler PRIVATE Qt::Test Qt::Xml ${Backtrace_LIBRARIES}) +if(NOT WIN32 AND Backtrace_FOUND) + target_link_libraries(tst_crashhandler PRIVATE + Qt::Test Qt::Xml ${Backtrace_LIBRARIES}) +else() + target_link_libraries(tst_crashhandler PRIVATE Qt::Test Qt::Xml) +endif() # The crash-dump bookkeeping from #905: which dumps get listed, offered and # deleted, and what redact() masks. qetlogger.cpp needs exactly one symbol @@ -174,7 +180,12 @@ target_include_directories(tst_crashdumps PRIVATE ${QET_DIR}/sources ${QET_DIR}/sources/NameList ${QET_DIR}/pugixml/src) -target_link_libraries(tst_crashdumps PRIVATE Qt::Test Qt::Widgets Qt::Xml ${Backtrace_LIBRARIES}) +if(NOT WIN32 AND Backtrace_FOUND) + target_link_libraries(tst_crashdumps PRIVATE + Qt::Test Qt::Widgets Qt::Xml ${Backtrace_LIBRARIES}) +else() + target_link_libraries(tst_crashdumps PRIVATE Qt::Test Qt::Widgets Qt::Xml) +endif() add_executable( tst_menubarkeyboard diff --git a/tests/qttest/tst_crashhandler.cpp b/tests/qttest/tst_crashhandler.cpp index 704e167cd..42411bad2 100644 --- a/tests/qttest/tst_crashhandler.cpp +++ b/tests/qttest/tst_crashhandler.cpp @@ -100,7 +100,9 @@ void tst_CrashHandler::formatsTheHandledSignals() { QCOMPARE(format(SIGSEGV), QByteArray::number(SIGSEGV)); QCOMPARE(format(SIGABRT), QByteArray::number(SIGABRT)); +#if defined(SIGBUS) QCOMPARE(format(SIGBUS), QByteArray::number(SIGBUS)); +#endif QCOMPARE(format(SIGFPE), QByteArray::number(SIGFPE)); QCOMPARE(format(SIGILL), QByteArray::number(SIGILL)); }