myx/MyxCMake/lib/macro/SkipExternalTarget.cmake

30 lines
758 B
CMake
Raw Normal View History

2022-10-08 18:00:28 +00:00
include_guard(GLOBAL)
# Пропуск целей, которые создаются автоматически в `CMAKE_BINARY_DIR`
2022-10-19 11:39:26 +00:00
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)
2022-10-08 19:23:10 +00:00
unset(__type)
unset(__pos)
2022-10-19 11:39:26 +00:00
unset(__sources)
2022-10-08 19:23:10 +00:00
return()
endif()
2022-10-19 11:39:26 +00:00
endforeach()
unset(__iter)
2022-10-08 19:23:10 +00:00
unset(__type)
2022-10-19 11:39:26 +00:00
unset(__pos)
unset(__sources)
unset(__s2)
unset(__s1)
endmacro(myx_skip_external_target TARGET_NAME)