CMake: Correct & add comments

Change-Id: Ic04901f0ee88bd6077348a0751fb05b11d23ea9c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Orkun Tokdemir 2024-08-06 16:48:15 +02:00
parent 90db9a4156
commit 6ce14b1428

View File

@ -98,7 +98,7 @@ function(qt6_add_ui target)
set(${out_generated_dash_path} "${additional_path}" PARENT_SCOPE) set(${out_generated_dash_path} "${additional_path}" PARENT_SCOPE)
endfunction() endfunction()
# NOTE: If previous folders are less than ../ folder count in # Note: If previous folders are less than ../ folder count in
# ${raw_include_prefix}, relative path calculation will miscalculate, # ${raw_include_prefix}, relative path calculation will miscalculate,
# so we need to add dummy folders to calculate the relative path # so we need to add dummy folders to calculate the relative path
# correctly # correctly
@ -113,7 +113,7 @@ function(qt6_add_ui target)
set(dummy_path_for_relative_calculation "/") set(dummy_path_for_relative_calculation "/")
set(raw_include_prefix_to_compare "/${raw_include_prefix}") set(raw_include_prefix_to_compare "/${raw_include_prefix}")
endif() endif()
# NOTE: This relative path calculation could be done just by using the # Note: This relative path calculation could be done just by using the
# below code # below code
# cmake_path(RELATIVE_PATH normalized_include_prefix "${CMAKE_CURRENT_SOURCE_DIR}" # cmake_path(RELATIVE_PATH normalized_include_prefix "${CMAKE_CURRENT_SOURCE_DIR}"
# but due to the backward compatibility, we need to use # but due to the backward compatibility, we need to use
@ -206,7 +206,7 @@ function(qt6_add_ui target)
endmacro() endmacro()
set(outfile "${output_directory}/ui_${outfile}.h") set(outfile "${output_directory}/ui_${outfile}.h")
# Before CMake 3.27, there is a bug for using $<CONFIG> in a generated # Before CMake 3.27, there was a bug when using $<CONFIG> in a generated
# file with Ninja Multi-Config generator. To avoid this issue, we need # file with Ninja Multi-Config generator. To avoid this issue, we need
# to add the generated file for each configuration. # to add the generated file for each configuration.
# Explicitly set the output file properties for each configuration # Explicitly set the output file properties for each configuration
@ -233,7 +233,7 @@ function(qt6_add_ui target)
string(REGEX REPLACE "//" "/" outfile "${outfile}") string(REGEX REPLACE "//" "/" outfile "${outfile}")
# Note: If INCLUDE_PREFIX is changed without changing the corresponding # Note: If INCLUDE_PREFIX is changed without changing the corresponding
# include path in the source file and Ninja generator is used, this # include path in the source file and the Ninja generator is used, this
# casues the double build issue. To avoid this issue, we need to # casues the double build issue. To avoid this issue, we need to
# remove the output file in configure step if the include_prefix is # remove the output file in configure step if the include_prefix is
# changed. # changed.
@ -272,7 +272,9 @@ function(qt6_add_ui target)
MAIN_DEPENDENCY ${infile} VERBATIM) MAIN_DEPENDENCY ${infile} VERBATIM)
endforeach() endforeach()
# We define a dummy target to check in the build time whether AUTOUIC is
# enabled after qt_add_ui is called. If AUTOUIC is enabled, we show an
# error message to the user.
get_target_property(is_guard_on ${target} _qt_ui_property_check_guard) get_target_property(is_guard_on ${target} _qt_ui_property_check_guard)
if(NOT is_guard_on) if(NOT is_guard_on)
# Ninja fails when a newline is used. That's why message is # Ninja fails when a newline is used. That's why message is