diff options
author | Brad King <brad.king@kitware.com> | 2022-09-27 14:28:30 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-09-27 14:28:49 (GMT) |
commit | 50b668ddc833f7312cbd1140ddcca85ac46a1b2b (patch) | |
tree | 11555484691ac8b02741ba95451d6163af3128b4 /Modules/FetchContent.cmake | |
parent | 954b861dba50b4f84c2a1e58e5bdf3f05179572b (diff) | |
parent | 2eb30a7036214ec960f0666163ff44ef754f6afe (diff) | |
download | CMake-50b668ddc833f7312cbd1140ddcca85ac46a1b2b.zip CMake-50b668ddc833f7312cbd1140ddcca85ac46a1b2b.tar.gz CMake-50b668ddc833f7312cbd1140ddcca85ac46a1b2b.tar.bz2 |
Merge topic 'add_subdirectory_system'
2eb30a7036 add_subdirectory: Add SYSTEM option
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7399
Diffstat (limited to 'Modules/FetchContent.cmake')
-rw-r--r-- | Modules/FetchContent.cmake | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index 7e69dfe..ac3918c 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -111,6 +111,7 @@ Commands FetchContent_Declare( <name> <contentOptions>... + [SYSTEM] [OVERRIDE_FIND_PACKAGE | FIND_PACKAGE_ARGS args...] ) @@ -229,6 +230,16 @@ Commands to intercept any direct call to :command:`find_package`, except if that call contains the ``BYPASS_PROVIDER`` option. + .. versionadded:: 3.25 + + ``SYSTEM`` + If the ``SYSTEM`` argument is provided, targets created by + the dependency will have their :prop_tgt:`SYSTEM` property + set to true when populated by :command:`FetchContent_MakeAvailable`. + The entries in their :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` + will be treated as ``SYSTEM`` include directories when + compiling consumers. + .. command:: FetchContent_MakeAvailable .. versionadded:: 3.14 @@ -1973,13 +1984,17 @@ macro(FetchContent_MakeAvailable) if("${__cmake_contentDetails}" STREQUAL "") message(FATAL_ERROR "No details have been set for content: ${__cmake_contentName}") endif() - cmake_parse_arguments(__cmake_arg "" "SOURCE_SUBDIR" "" ${__cmake_contentDetails}) + cmake_parse_arguments(__cmake_arg "SYSTEM" "SOURCE_SUBDIR" "" ${__cmake_contentDetails}) if(NOT "${__cmake_arg_SOURCE_SUBDIR}" STREQUAL "") string(APPEND __cmake_srcdir "/${__cmake_arg_SOURCE_SUBDIR}") endif() if(EXISTS ${__cmake_srcdir}/CMakeLists.txt) - add_subdirectory(${__cmake_srcdir} ${${__cmake_contentNameLower}_BINARY_DIR}) + if (__cmake_arg_SYSTEM) + add_subdirectory(${__cmake_srcdir} ${${__cmake_contentNameLower}_BINARY_DIR} SYSTEM) + else() + add_subdirectory(${__cmake_srcdir} ${${__cmake_contentNameLower}_BINARY_DIR}) + endif() endif() unset(__cmake_srcdir) |