Qt5.cmake 1010 B

123456789101112131415161718192021222324252627282930
  1. enable_language(CXX)
  2. find_package(Qt5Core REQUIRED)
  3. set(CMAKE_AUTOMOC ON)
  4. set(CMAKE_AUTOMOC_COMPILER_PREDEFINES OFF)
  5. add_executable(exe qt5.cxx)
  6. target_link_libraries(exe PRIVATE Qt5::Core)
  7. include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake)
  8. generate_output_files(exe)
  9. set(moc_writes_depfiles 0)
  10. if(Qt5Core_VERSION VERSION_GREATER_EQUAL "5.15.0")
  11. set(moc_writes_depfiles 1)
  12. endif()
  13. set(autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/mocs_compilation.cpp")
  14. if(moc_writes_depfiles)
  15. list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/deps")
  16. list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/timestamp")
  17. endif()
  18. foreach(c IN LISTS CMAKE_CONFIGURATION_TYPES)
  19. list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include_${c}/moc_qt5.cpp")
  20. if(moc_writes_depfiles)
  21. list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include_${c}/moc_qt5.cpp.d")
  22. endif()
  23. endforeach()
  24. file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "set(AUTOGEN_FILES [==[${autogen_files}]==])\n")