Use _qt_internal_path_is_prefix
Change-Id: I3eeb514c33340956328eff33409dfa2899023eb5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
0630f055b8
commit
3f31f210d5
@ -199,8 +199,8 @@ function(qt_make_output_file infile prefix suffix source_dir binary_dir result)
|
||||
get_filename_component(outfilename "${infile}" NAME_WE)
|
||||
|
||||
set(base_dir "${source_dir}")
|
||||
string(FIND "${infile}" "${binary_dir}/" in_binary)
|
||||
if (in_binary EQUAL 0)
|
||||
_qt_internal_path_is_prefix(binary_dir "${infile}" in_binary)
|
||||
if(in_binary)
|
||||
set(base_dir "${binary_dir}")
|
||||
endif()
|
||||
|
||||
|
@ -199,8 +199,9 @@ function(qt_internal_add_executable name)
|
||||
set(exclude_from_all FALSE)
|
||||
if(__qt_exclude_tool_directories)
|
||||
foreach(absolute_dir ${__qt_exclude_tool_directories})
|
||||
string(FIND "${CMAKE_CURRENT_SOURCE_DIR}" "${absolute_dir}" dir_starting_pos)
|
||||
if(dir_starting_pos EQUAL 0)
|
||||
_qt_internal_path_is_prefix(absolute_dir "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
in_current_source)
|
||||
if(in_current_source)
|
||||
set(exclude_from_all TRUE)
|
||||
set_target_properties("${name}" PROPERTIES
|
||||
EXCLUDE_FROM_ALL TRUE
|
||||
|
@ -239,8 +239,8 @@ function(qt_internal_add_headersclean_target module_target module_headers)
|
||||
|
||||
set(possible_base_dirs "${CMAKE_BINARY_DIR}" "${CMAKE_SOURCE_DIR}")
|
||||
foreach(dir IN LISTS possible_base_dirs)
|
||||
string(FIND "${input_path}" "${dir}" idx)
|
||||
if(idx EQUAL "0")
|
||||
_qt_internal_path_is_prefix(dir "${input_path}" dir_is_prefix)
|
||||
if(dir_is_prefix)
|
||||
set(input_base_dir "${dir}")
|
||||
break()
|
||||
endif()
|
||||
|
@ -1619,16 +1619,11 @@ function(qt_internal_collect_module_headers out_var target)
|
||||
|
||||
get_filename_component(file_path "${file_path}" ABSOLUTE)
|
||||
|
||||
string(FIND "${file_path}" "${source_dir}" source_dir_pos)
|
||||
if(source_dir_pos EQUAL 0)
|
||||
set(is_outside_module_source_dir FALSE)
|
||||
else()
|
||||
set(is_outside_module_source_dir TRUE)
|
||||
endif()
|
||||
_qt_internal_path_is_prefix(source_dir "${file_path}" is_inside_module_source_dir)
|
||||
|
||||
get_source_file_property(is_generated "${file_path}" GENERATED)
|
||||
# Skip all header files outside the module source directory, except the generated files.
|
||||
if(is_outside_module_source_dir AND NOT is_generated)
|
||||
if(NOT is_inside_module_source_dir AND NOT is_generated)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
@ -1640,10 +1635,10 @@ function(qt_internal_collect_module_headers out_var target)
|
||||
"\nCondition:\n ${condition_string}")
|
||||
endif()
|
||||
|
||||
if(is_outside_module_source_dir)
|
||||
set(base_dir "${binary_dir}")
|
||||
else()
|
||||
if(is_inside_module_source_dir)
|
||||
set(base_dir "${source_dir}")
|
||||
else()
|
||||
set(base_dir "${binary_dir}")
|
||||
endif()
|
||||
|
||||
file(RELATIVE_PATH file_path_rel "${base_dir}" "${file_path}")
|
||||
|
@ -771,13 +771,9 @@ function(_qt_internal_sbom_map_path_to_reproducible_relative_path out_var)
|
||||
if(IS_ABSOLUTE "${path}")
|
||||
set(path_in "${path}")
|
||||
|
||||
string(FIND "${path}" "${PROJECT_SOURCE_DIR}/" src_idx)
|
||||
string(FIND "${path}" "${PROJECT_BINARY_DIR}/" dest_idx)
|
||||
|
||||
if(src_idx EQUAL "0")
|
||||
set(is_in_source_dir TRUE)
|
||||
elseif(dest_idx EQUAL "0")
|
||||
set(is_in_build_dir TRUE)
|
||||
_qt_internal_path_is_prefix(PROJECT_SOURCE_DIR "${path}" is_in_source_dir)
|
||||
if(NOT is_in_source_dir)
|
||||
_qt_internal_path_is_prefix(PROJECT_BINARY_DIR "${path}" is_in_build_dir)
|
||||
endif()
|
||||
else()
|
||||
# We consider relative paths to be relative to the current source dir.
|
||||
|
Loading…
x
Reference in New Issue
Block a user