mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-08 07:10:12 -05:00
a742088472
The minimum CMake version for Qt6 is 3.16, so all the calls to cmake_minimum_required() are updated here to enforce that minimum. This will avoid any CMake version-related warnings from Qt. Avoid hard-coding Qt5 where the tests could now be using Qt5 or Qt6. Fixes: #22188
44 lines
1.4 KiB
CMake
44 lines
1.4 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(MocSkipSource)
|
|
include("../AutogenCoreTest.cmake")
|
|
|
|
# Test for SKIP_AUTOMOC and SKIP_AUTOGEN on an AUTOMOC enabled target
|
|
|
|
# Generate header mocs manually
|
|
qtx_wrap_cpp(skipMocWrapMoc
|
|
qItemA.hpp
|
|
qItemB.hpp
|
|
qItemC.hpp
|
|
qItemD.hpp
|
|
)
|
|
set(skipMocSources
|
|
skipMoc.cpp
|
|
qItemA.cpp
|
|
qItemB.cpp
|
|
qItemC.cpp
|
|
qItemD.cpp
|
|
)
|
|
# When cpp files are skipped, the hpp won't be processed either,
|
|
# unless they are mentioned in the sources - which they aren't.
|
|
set_property(SOURCE qItemA.cpp PROPERTY SKIP_AUTOMOC ON)
|
|
set_property(SOURCE qItemB.cpp PROPERTY SKIP_AUTOGEN ON)
|
|
# When hpp files are skipped, the cpp still get processed.
|
|
set_property(SOURCE qItemC.hpp PROPERTY SKIP_AUTOMOC ON)
|
|
set_property(SOURCE qItemD.hpp PROPERTY SKIP_AUTOGEN ON)
|
|
# AUTOMOC enabled only
|
|
add_executable(skipMocA ${skipMocSources} ${skipMocWrapMoc})
|
|
set_property(TARGET skipMocA PROPERTY AUTOMOC ON)
|
|
target_link_libraries(skipMocA ${QT_LIBRARIES})
|
|
|
|
if(CMAKE_XCODE_BUILD_SYSTEM VERSION_GREATER_EQUAL 12)
|
|
# FIXME: Fix AUTOMOC for the Xcode "new build system" to avoid
|
|
# duplicating custom commands in multiple _autogen targets.
|
|
return()
|
|
endif()
|
|
|
|
# AUTOMOC and AUTOUIC enabled
|
|
add_executable(skipMocB ${skipMocSources} ${skipMocWrapMoc})
|
|
set_property(TARGET skipMocB PROPERTY AUTOMOC ON)
|
|
set_property(TARGET skipMocB PROPERTY AUTOUIC ON)
|
|
target_link_libraries(skipMocB ${QT_LIBRARIES})
|