This commit is contained in:
2022-10-08 22:23:10 +03:00
parent ac54e882b7
commit 7bb178b24d
9 changed files with 35 additions and 16 deletions

View File

@@ -2,13 +2,32 @@ include_guard(GLOBAL)
# Пропуск целей, которые создаются автоматически в `CMAKE_BINARY_DIR`
macro(myx_skip_external_target NAME)
get_target_property(__source_dir ${NAME} SOURCE_DIR)
string(FIND ${__source_dir} ${CMAKE_BINARY_DIR} __pos)
if(__pos EQUAL 0)
get_target_property(__type ${NAME} TYPE)
if(__type STREQUAL "INTERFACE_LIBRARY")
get_target_property(__sources ${NAME} INTERFACE_SOURCES)
foreach(iter ${_sources})
string(FIND ${iter} ${CMAKE_BINARY_DIR} __pos)
if(__pos EQUAL 0)
unset(__type)
unset(__pos)
unset(__sources)
return()
endif()
endforeach()
unset(__type)
unset(__pos)
unset(__sources)
else()
get_target_property(__source_dir ${NAME} SOURCE_DIR)
string(FIND ${__source_dir} ${CMAKE_BINARY_DIR} __pos)
if(__pos EQUAL 0)
unset(__type)
unset(__pos)
unset(__source_dir)
return()
endif()
unset(__pos)
unset(__source_dir)
return()
endif()
unset(__pos)
unset(__source_dir)
unset(__type)
endmacro(myx_skip_external_target NAME)