| 1 |
enable_language(CXX) |
| 2 |
|
| 3 |
set(QtX Qt${with_qt_version}) |
| 4 |
|
| 5 |
find_package(${QtX} REQUIRED COMPONENTS Core) |
| 6 |
|
| 7 |
set(CMAKE_AUTOMOC ON) |
| 8 |
set(CMAKE_AUTOMOC_COMPILER_PREDEFINES OFF) |
| 9 |
|
| 10 |
# Source files are always named qt5.* for simplicity but apply to Qt5 and later |
| 11 |
add_executable(exe qt5.cxx) |
| 12 |
target_link_libraries(exe PRIVATE ${QtX}::Core) |
| 13 |
|
| 14 |
include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) |
| 15 |
generate_output_files(exe) |
| 16 |
|
| 17 |
set(moc_writes_depfiles 0) |
| 18 |
if(${QtX}Core_VERSION VERSION_GREATER_EQUAL "5.15.0") |
| 19 |
set(moc_writes_depfiles 1) |
| 20 |
endif() |
| 21 |
|
| 22 |
foreach(CONFIG IN LISTS CMAKE_CONFIGURATION_TYPES) |
| 23 |
set(config_suffix "_${CONFIG}") |
| 24 |
if (CMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG) |
| 25 |
set(autogen_files_config_suffix "${config_suffix}") |
| 26 |
endif() |
| 27 |
set(autogen_files) |
| 28 |
if(moc_writes_depfiles) |
| 29 |
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/deps${autogen_files_config_suffix}") |
| 30 |
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/timestamp${autogen_files_config_suffix}") |
| 31 |
endif() |
| 32 |
if (CMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG) |
| 33 |
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/mocs_compilation${config_suffix}.cpp") |
| 34 |
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include${config_suffix}/moc_qt5.cpp") |
| 35 |
if(moc_writes_depfiles) |
| 36 |
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include${config_suffix}/moc_qt5.cpp.d") |
| 37 |
endif() |
| 38 |
else() |
| 39 |
foreach(c IN LISTS CMAKE_CONFIGURATION_TYPES) |
| 40 |
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/mocs_compilation_${c}.cpp") |
| 41 |
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include_${c}/moc_qt5.cpp") |
| 42 |
if(moc_writes_depfiles) |
| 43 |
list(APPEND autogen_files "${CMAKE_BINARY_DIR}/exe_autogen/include_${c}/moc_qt5.cpp.d") |
| 44 |
endif() |
| 45 |
endforeach() |
| 46 |
endif() |
| 47 |
|
| 48 |
file(APPEND "${CMAKE_BINARY_DIR}/target_files.cmake" "set(AUTOGEN_FILES${config_suffix} [==[${autogen_files}]==])\n") |
| 49 |
unset(autogen_files) |
| 50 |
endforeach() |