This commit is contained in:
2022-10-19 14:39:26 +03:00
parent 490b7a82d0
commit c32b2a85cc
15 changed files with 437 additions and 329 deletions

View File

@@ -1,33 +1,29 @@
include_guard(GLOBAL)
# Пропуск целей, которые создаются автоматически в `CMAKE_BINARY_DIR`
macro(myx_skip_external_target NAME)
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 GREATER -1)
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)
macro(myx_skip_external_target TARGET_NAME)
get_target_property(__s1 ${TARGET_NAME} INTERFACE_SOURCES)
if(__s1)
list(APPEND __sources ${__s1})
endif()
get_target_property(__s2 ${TARGET_NAME} SOURCES)
if(__s2)
list(APPEND __sources ${__s2})
endif()
foreach(__iter ${__sources})
string(FIND ${__iter} ${CMAKE_BINARY_DIR} __pos)
if(__pos GREATER -1)
unset(__type)
unset(__pos)
unset(__source_dir)
unset(__sources)
return()
endif()
unset(__pos)
unset(__source_dir)
endif()
endforeach()
unset(__iter)
unset(__type)
endmacro(myx_skip_external_target NAME)
unset(__pos)
unset(__sources)
unset(__s2)
unset(__s1)
endmacro(myx_skip_external_target TARGET_NAME)