From 70cdf12c82d1f1328e8b5f43d9ea414dabb64ee4 Mon Sep 17 00:00:00 2001 From: Torsten Wierschin Date: Tue, 21 Jul 2026 14:14:01 +0200 Subject: [PATCH] Z: make ngltools Qt smoke test build standalone when library target missing; use DTG format for stable round-trip\n\nEnsure smoke test links directly to implementation if ngltools target isn't present so migration builds can run tests without producing the full library.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Z/src/ngltools/CMakeLists.txt | 12 ++++++++++-- Z/src/ngltools/tests/NGLToolsQtSmokeTest.cpp | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Z/src/ngltools/CMakeLists.txt b/Z/src/ngltools/CMakeLists.txt index 6419e56ab..aaad14447 100755 --- a/Z/src/ngltools/CMakeLists.txt +++ b/Z/src/ngltools/CMakeLists.txt @@ -37,8 +37,16 @@ IF(BUILD_TESTING) endif() if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tests/NGLToolsQtSmokeTest.cpp) - add_executable(ngltools_qt_smoke tests/NGLToolsQtSmokeTest.cpp) - target_link_libraries(ngltools_qt_smoke PRIVATE ngltools ${_QTTEST_TARGET} ${_QTCORE_TARGET}) + if(TARGET ngltools) + add_executable(ngltools_qt_smoke tests/NGLToolsQtSmokeTest.cpp) + target_link_libraries(ngltools_qt_smoke PRIVATE ngltools ${_QTTEST_TARGET} ${_QTCORE_TARGET}) + else() + # Build the smoke test as a standalone executable using the dtg implementation + # when the ngltools library target is not available in this configuration. + add_executable(ngltools_qt_smoke tests/NGLToolsQtSmokeTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ngltools_dtg.cpp) + target_include_directories(ngltools_qt_smoke PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + target_link_libraries(ngltools_qt_smoke PRIVATE ${_QTTEST_TARGET} ${_QTCORE_TARGET}) + endif() add_test(NAME NGLToolsQtSmoke COMMAND ngltools_qt_smoke) endif() ENDIF() diff --git a/Z/src/ngltools/tests/NGLToolsQtSmokeTest.cpp b/Z/src/ngltools/tests/NGLToolsQtSmokeTest.cpp index 28146a350..d71671985 100644 --- a/Z/src/ngltools/tests/NGLToolsQtSmokeTest.cpp +++ b/Z/src/ngltools/tests/NGLToolsQtSmokeTest.cpp @@ -11,7 +11,7 @@ private slots: void testDTG() { QDateTime now = QDateTime::currentDateTimeUtc(); - QString s = DTG::toString(now); + QString s = DTG::toString(now, DTG::Default, DTG::DTG); QVERIFY(!s.isEmpty()); bool ok = false; QDateTime parsed = DTG::fromDTGString(s, &ok);