# CMakeLists.txt für Qt6-Migrationstests # Diese Tests validieren BUILD_RTI Guards, Qt6-Kompatibilität und RTI-Integration cmake_minimum_required(VERSION 3.16) # Qt6 finden (wird vom Hauptprojekt gesetzt, aber sicherheitshalber hier auch) find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Test) # Try to find system-wide GTest first, fallback to FetchContent find_package(GTest QUIET) if(NOT TARGET GTest::gtest_main) include(FetchContent) FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git GIT_TAG v1.13.0 ) # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) endif() # Nur bauen wenn BUILD_TESTING aktiviert ist if(BUILD_TESTING) # Collect all test source files dynamically file(GLOB MIGRATION_TEST_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/test_*.cpp") if(MIGRATION_TEST_SOURCES) set(EXISTING_SOURCES ${MIGRATION_TEST_SOURCES}) if(EXISTING_SOURCES) add_executable(migration_tests ${EXISTING_SOURCES}) target_compile_features(migration_tests PRIVATE cxx_std_23) target_include_directories(migration_tests PRIVATE ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/qt6-after/qt6-migrated-legatus ${CMAKE_SOURCE_DIR}/qt6-after/qt6-migrated-legatus/include ) # Link against Qt6 components target_link_libraries(migration_tests PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Test GTest::gtest_main ) # RTI libraries if BUILD_RTI is ON if(BUILD_RTI) find_package(RTI QUIET) if(RTI_FOUND) target_include_directories(migration_tests PRIVATE ${RTI_INCLUDE_DIRS}) target_link_libraries(migration_tests PRIVATE ${RTI_LIBRARIES}) target_compile_definitions(migration_tests PRIVATE BUILD_RTI=1) message(STATUS "RTI found: ${RTI_LIBRARIES}") else() message(STATUS "BUILD_RTI=ON but RTI not found - building tests without RTI") endif() endif() # Register with CTest include(GoogleTest) gtest_discover_tests(migration_tests) message(STATUS "Migration tests enabled: ${EXISTING_SOURCES}") else() message(WARNING "No migration test sources found in ${CMAKE_CURRENT_SOURCE_DIR}") endif() endif()