51 lines
1.9 KiB
CMake
Raw Normal View History

2020-08-30 11:54:41 +02:00
enable_language(CXX)
2021-11-20 13:41:27 +01:00
set(QtX Qt${with_qt_version})
find_package(${QtX} REQUIRED COMPONENTS Core)
2020-08-30 11:54:41 +02:00
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOMOC_COMPILER_PREDEFINES OFF)
2021-11-20 13:41:27 +01:00
# Source files are always named qt5.* for simplicity but apply to Qt5 and later
2020-08-30 11:54:41 +02:00
add_executable(exe qt5.cxx)
2021-11-20 13:41:27 +01:00
target_link_libraries(exe PRIVATE ${QtX}::Core)
2020-08-30 11:54:41 +02:00
include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake)
generate_output_files(exe)
set(moc_writes_depfiles 0)
2021-11-20 13:41:27 +01:00
if(${QtX}Core_VERSION VERSION_GREATER_EQUAL "5.15.0")
2020-08-30 11:54:41 +02:00
set(moc_writes_depfiles 1)
endif()
2024-04-14 22:45:38 +02:00
foreach(CONFIG IN LISTS CMAKE_CONFIGURATION_TYPES)
set(config_suffix "_${CONFIG}")
if (CMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG)
set(autogen_files_config_suffix "${config_suffix}")
endif()
set(autogen_files)
2020-08-30 11:54:41 +02:00
if(moc_writes_depfiles)
2024-04-14 22:45:38 +02:00
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/deps${autogen_files_config_suffix}")
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/timestamp${autogen_files_config_suffix}")
2020-08-30 11:54:41 +02:00
endif()
2024-04-14 22:45:38 +02:00
if (CMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG)
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/mocs_compilation${config_suffix}.cpp")
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include${config_suffix}/moc_qt5.cpp")
if(moc_writes_depfiles)
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include${config_suffix}/moc_qt5.cpp.d")
endif()
else()
foreach(c IN LISTS CMAKE_CONFIGURATION_TYPES)
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/mocs_compilation_${c}.cpp")
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include_${c}/moc_qt5.cpp")
if(moc_writes_depfiles)
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include_${c}/moc_qt5.cpp.d")
endif()
endforeach()
endif()
file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "set(AUTOGEN_FILES${config_suffix} [==[${autogen_files}]==])\n")
unset(autogen_files)
2020-08-30 11:54:41 +02:00
endforeach()