myx/MyxCMake/lib/macro/SkipExternalTarget.cmake
2022-10-19 14:39:26 +03:00

30 lines
758 B
CMake

include_guard(GLOBAL)
# Пропуск целей, которые создаются автоматически в `CMAKE_BINARY_DIR`
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(__sources)
return()
endif()
endforeach()
unset(__iter)
unset(__type)
unset(__pos)
unset(__sources)
unset(__s2)
unset(__s1)
endmacro(myx_skip_external_target TARGET_NAME)