summaryrefslogtreecommitdiffstats
path: root/Tests/QtAutogen/mocRerun/CMakeLists.txt
blob: ca0eedf393238a7f79bae70adb9407f259ebd8d1 (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.7)
project(mocRerun CXX)

if (QT_TEST_VERSION STREQUAL 4)
  find_package(Qt4 REQUIRED)
  set(QT_CORE_TARGET Qt4::QtCore)
else()
  if (NOT QT_TEST_VERSION STREQUAL 5)
    message(SEND_ERROR "Invalid Qt version specified.")
  endif()

  find_package(Qt5Core REQUIRED)
  set(QT_CORE_TARGET Qt5::Core)
endif()

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

configure_file(test1a.h.in test1.h COPYONLY)

add_executable(test1
  ${CMAKE_CURRENT_BINARY_DIR}/test1.h
  test1.cpp
  res1.qrc
  )
target_include_directories(test1 PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(test1 ${QT_CORE_TARGET})
add_custom_command(TARGET test1 POST_BUILD COMMAND
  ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:test1>" > target1.txt)