diff options
Diffstat (limited to 'cmake/mbgl.cmake')
-rw-r--r-- | cmake/mbgl.cmake | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cmake/mbgl.cmake b/cmake/mbgl.cmake index c833fc4a20..f67fbd3b4f 100644 --- a/cmake/mbgl.cmake +++ b/cmake/mbgl.cmake @@ -107,6 +107,25 @@ function(create_source_groups target) endforeach() endfunction() +# Creates a library target for a vendored dependency +function(add_vendor_target NAME TYPE) + add_library(${NAME} ${TYPE} cmake/empty.cpp) + set(INCLUDE_TYPE "INTERFACE") + set(SOURCE_TYPE "INTERFACE") + if (TYPE STREQUAL "STATIC" OR TYPE STREQUAL "SHARED") + set(INCLUDE_TYPE "PUBLIC") + set(SOURCE_TYPE "PRIVATE") + set_target_properties(${NAME} PROPERTIES SOURCES "") + endif() + set_target_properties(${NAME} PROPERTIES INTERFACE_SOURCES "") + file(STRINGS vendor/${NAME}/files.txt FILES) + foreach(FILE IN LISTS FILES) + target_sources(${NAME} ${SOURCE_TYPE} "${CMAKE_SOURCE_DIR}/vendor/${NAME}/${FILE}") + endforeach() + target_include_directories(${NAME} ${INCLUDE_TYPE} vendor/${NAME}/include) + create_source_groups(${NAME}) +endfunction() + # This little macro lets you set any XCode specific property macro(set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE) set_property(TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE}) |