summaryrefslogtreecommitdiffstats
path: root/Tests/QtAutogen/MocOnly/CMakeLists.txt
blob: b5d405a1e0e3e8bac21def0a48b10e8794a60ff9 (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
cmake_minimum_required(VERSION 3.16)
project(MocOnly)
include("../AutogenCoreTest.cmake")

add_executable(mocOnly
  main.cpp
  # Test different Q_OBJECT position styles
  StyleA.cpp
  StyleB.cpp
  # Test different moc_/.moc include positions
  IncA.cpp
  IncB.cpp
)
# XXX(xcode-per-cfg-src): Drop the NO_PER_CONFIG_SOURCES exclusion
# when the Xcode generator supports per-config sources.
if(NOT NO_PER_CONFIG_SOURCES)
  target_sources(mocOnly PRIVATE
    "$<$<CONFIG:Debug>:${CMAKE_CURRENT_SOURCE_DIR}/CfgDebug.cpp>"
    "$<$<NOT:$<CONFIG:Debug>>:${CMAKE_CURRENT_SOURCE_DIR}/CfgOther.cpp>"
    )
  target_compile_definitions(mocOnly PRIVATE
    "$<$<CONFIG:Debug>:HAVE_CFG_DEBUG>"
    "$<$<NOT:$<CONFIG:Debug>>:HAVE_CFG_OTHER>"
    )
endif()
set_property(TARGET mocOnly PROPERTY AUTOMOC ON)
target_link_libraries(mocOnly ${QT_LIBRARIES})
# Add compile definitions with unusual characters
target_compile_definitions(mocOnly PUBLIC "TOKEN=\"hello\;\"" )