Аргумент INCLUDE_DIRECTORIES для myx_target_setup

This commit is contained in:
Andrei Astafev 2023-12-14 14:00:20 +03:00
parent 846e02c1e7
commit 3bc467fa13

View File

@ -3,7 +3,8 @@ include_guard(GLOBAL)
function(myx_target_setup TARGET_NAME)
set(options)
set(oneValueArgs PCH)
set(multiValueArgs COMPILE_DEFINITIONS PACKAGES LINK_LIBRARIES
set(multiValueArgs PACKAGES
COMPILE_DEFINITIONS INCLUDE_DIRECTORIES LINK_LIBRARIES
CPP PUBLIC_HEADERS PRIVATE_HEADERS)
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
@ -78,6 +79,7 @@ function(myx_target_setup TARGET_NAME)
target_sources(${TARGET_NAME} PRIVATE ${ARG_CPP} ${ARG_PCH} ${ARG_PRIVATE_HEADERS})
target_sources(${TARGET_NAME} PUBLIC $<BUILD_INTERFACE:${ARG_INTERFACE_HEADERS}>)
target_compile_definitions(${TARGET_NAME} PRIVATE ${ARG_COMPILE_DEFINITIONS})
target_include_directories(${TARGET_NAME} PRIVATE ${ARG_INCLUDE_DIRECTORIES})
# CMake до версии 3.12 не умеет извлекать из целей типа `OBJECT_LIBRARY`
# информацию о заголовочных файлах. Это обход.