blob: b9e20c84c2f412706c86de29ef0b4ba3aa11ef0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
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})
|