blob: 8d1fa6a5481448b76330ea4e2e27200869ee89d2 (
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
|
cmake_minimum_required(VERSION 3.10)
project(MocSkipSource)
include("../AutogenTest.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})
# 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})
|