CMakeLists.txt 772 B

123456789101112131415161718192021222324
  1. cmake_minimum_required(VERSION 3.10)
  2. project(MocBasic)
  3. include("../../AutogenTest.cmake")
  4. set(CMAKE_AUTOMOC ON)
  5. set(CMAKE_AUTORCC ON)
  6. # Generated source file
  7. add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/main.cpp
  8. COMMAND ${CMAKE_COMMAND} -E sleep 2
  9. COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/main.cpp
  10. )
  11. add_executable(mocBasic
  12. ${CMAKE_CURRENT_BINARY_DIR}/test1.h
  13. ${CMAKE_CURRENT_BINARY_DIR}/main.cpp
  14. res1.qrc
  15. )
  16. target_include_directories(mocBasic PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
  17. target_link_libraries(mocBasic ${QT_QTCORE_TARGET})
  18. # Write target name to text file
  19. add_custom_command(TARGET mocBasic POST_BUILD COMMAND
  20. ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:mocBasic>" > mocBasic.txt
  21. )