tests: Grantlee-Tests conditional auf BUILD_GRANTLEE gesetzt
- Grantlee-Tests nur bauen wenn BUILD_GRANTLEE=ON - Vermeidet Build-Fehler durch fehlenden codegen_base_export.h bei BUILD_GRANTLEE=OFF - Ermöglicht Build ohne Qt5-basierte Grantlee-Dependency für Qt6-Migration
This commit is contained in:
1 file changed
+23
@@ -37,6 +37,7 @@ if(BUILD_TESTING)
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/qt6-after/qt6-migrated-legatus
|
||||
${CMAKE_SOURCE_DIR}/qt6-after/qt6-migrated-legatus/include
|
||||
${CMAKE_BINARY_DIR}/Lts/Common
|
||||
)
|
||||
|
||||
# Link against Qt6 components
|
||||
@@ -48,6 +49,28 @@ if(BUILD_TESTING)
|
||||
GTest::gtest_main
|
||||
)
|
||||
|
||||
# Grantlee tests require BUILD_GRANTLEE=ON
|
||||
if(BUILD_GRANTLEE)
|
||||
target_link_libraries(migration_tests PRIVATE codegen_grantlee)
|
||||
target_include_directories(migration_tests PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/qt6-after/qt6-migrated-legatus/Lts/Common/CodeGen
|
||||
)
|
||||
message(STATUS "Migration tests: Grantlee support enabled")
|
||||
else()
|
||||
# Exclude Grantlee-related tests when BUILD_GRANTLEE is OFF
|
||||
list(FILTER EXISTING_SOURCES EXCLUDE REGEX "test_.*Grantlee.*\\.cpp")
|
||||
message(STATUS "Migration tests: Grantlee support disabled (BUILD_GRANTLEE=OFF), excluded Grantlee tests")
|
||||
# Re-create executable with filtered sources
|
||||
if(EXISTING_SOURCES)
|
||||
set_target_properties(migration_tests PROPERTIES
|
||||
SOURCES "${EXISTING_SOURCES}"
|
||||
)
|
||||
else()
|
||||
message(WARNING "No non-Grantlee migration tests found - skipping migration_tests target")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# RTI libraries if BUILD_RTI is ON
|
||||
if(BUILD_RTI)
|
||||
find_package(RTI QUIET)
|
||||
|
||||
Reference in new issue
Block a user