From da2a7c9cb7b9f067a502f1726ab60a8069a53eed Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Tue, 9 Jan 2024 16:22:23 -0800 Subject: [PATCH 01/13] Revamp blt_convert_to_system_includes --- .gitignore | 1 + cmake/BLTInstallableMacros.cmake | 79 ++++++++++++++++++++++++-------- docs/api/utility.rst | 9 ++-- 3 files changed, 68 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 4d67604d7..6c90c85b9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.code-workspace +*.swp diff --git a/cmake/BLTInstallableMacros.cmake b/cmake/BLTInstallableMacros.cmake index 52bfc727a..6aeeb7e0d 100644 --- a/cmake/BLTInstallableMacros.cmake +++ b/cmake/BLTInstallableMacros.cmake @@ -428,37 +428,80 @@ endmacro(blt_add_target_compile_flags) ##------------------------------------------------------------------------------ -## blt_convert_to_system_includes(TARGET ) +## blt_convert_to_system_includes(TARGETS [...] +## [QUIET] +## [INTRANSITIVE]) ## ## Converts existing interface includes to system interface includes. ##------------------------------------------------------------------------------ -macro(blt_convert_to_system_includes) - set(options) +function(blt_convert_to_system_includes) + set(options INTRANSITIVE QUIET) set(singleValuedArgs TARGET) - set(multiValuedArgs) + set(multiValuedArgs TARGETS) ## parse the arguments to the macro cmake_parse_arguments(arg - "${options}" "${singleValuedArgs}" "${multiValuedArgs}" ${ARGN}) + "${options}" "${singleValuedArgs}" "${multiValuedArgs}" ${ARGN}) + + if(DEFINED arg_TARGETS) + message(WARNING "TARGET is a deprecated parameter for the blt_convert_to_system_includes macro.") + list(APPEND arg_TARGETS ${arg_TARGET}) + endif() - if(NOT DEFINED arg_TARGET) - message(FATAL_ERROR "TARGET is a required parameter for the blt_convert_to_system_includes macro.") + if(NOT DEFINED arg_TARGETS) + message(FATAL_ERROR "TARGETS is a required parameter for the blt_convert_to_system_includes macro.") + endif() + + if(NOT ${arg_QUIET}) + foreach(_target ${arg_TARGETS}) + if(NOT TARGET ${_target}) + message(WARNING "${_target} does not exist!") + endif() + endforeach() endif() # PGI does not support -isystem if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI") - get_target_property(_include_dirs ${arg_TARGET} INTERFACE_INCLUDE_DIRECTORIES) - # Don't copy if the target had no include directories - if(_include_dirs) - # Clear previous value in INTERFACE_INCLUDE_DIRECTORIES so it is not doubled - # by target_include_directories - set_property(TARGET ${arg_TARGET} PROPERTY INTERFACE_INCLUDE_DIRECTORIES) - target_include_directories(${arg_TARGET} SYSTEM INTERFACE ${_include_dirs}) - endif() - endif() + foreach(_target ${arg_TARGETS}) + if(TARGET ${_target}) + if(NOT ${arg_INTRANSITIVE}) + get_target_property(_interface_link_libs + ${_target} + INTERFACE_LINK_LIBRARIES) - unset(_include_dirs) -endmacro() + + # Don't recurse if the target had no interface link libraries + if(_interface_link_libs) + # TODO: Warn if interface link library is not a target? + blt_convert_to_system_includes(TARGETS ${_interface_link_libs}) + endif() + + unset(_interface_link_libs) + endif() + + get_target_property(_interface_include_dirs + ${_target} + INTERFACE_INCLUDE_DIRECTORIES) + + # Don't update properties if the target had no interface include directories + if(_interface_include_dirs) + # Clear previous value in INTERFACE_INCLUDE_DIRECTORIES + # so it is not doubled by target_include_directories + set_target_properties(${_target} + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES) + + target_include_directories(${_target} + SYSTEM + INTERFACE + ${_interface_include_dirs}) + endif() + + unset(_interface_include_dirs) + endif() + endforeach() + endif() +endfunction(blt_convert_to_system_includes) ##------------------------------------------------------------------------------ diff --git a/docs/api/utility.rst b/docs/api/utility.rst index 134e26dd3..bb54c6693 100644 --- a/docs/api/utility.rst +++ b/docs/api/utility.rst @@ -222,14 +222,17 @@ blt_convert_to_system_includes .. code-block:: cmake - blt_convert_to_system_includes(TARGET ) + blt_convert_to_system_includes(TARGETS [...] + [QUIET] + [INTRANSITIVE]) Converts existing interface includes to system interface includes. +Warns if a target does not exist unless ``QUIET`` is specified. +Recurses through interface link libraries unless ``INTRANSITIVE`` is specified. .. code-block:: cmake :caption: **Example** :linenos: - ## convert to system includes for the foo target - blt_convert_to_system_includes(TARGET foo) + blt_convert_to_system_includes(TARGETS foo) From 80716682ef0aefe0d66c9e20df8279c6c2485b4c Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Wed, 10 Jan 2024 08:45:22 -0800 Subject: [PATCH 02/13] Replace INTRANSITIVE with CHILDREN --- cmake/BLTInstallableMacros.cmake | 14 +++++++++----- docs/api/utility.rst | 6 +++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cmake/BLTInstallableMacros.cmake b/cmake/BLTInstallableMacros.cmake index 6aeeb7e0d..f49d80166 100644 --- a/cmake/BLTInstallableMacros.cmake +++ b/cmake/BLTInstallableMacros.cmake @@ -429,14 +429,14 @@ endmacro(blt_add_target_compile_flags) ##------------------------------------------------------------------------------ ## blt_convert_to_system_includes(TARGETS [...] -## [QUIET] -## [INTRANSITIVE]) +## CHILDREN [TRUE|FALSE] +## [QUIET]) ## ## Converts existing interface includes to system interface includes. ##------------------------------------------------------------------------------ function(blt_convert_to_system_includes) - set(options INTRANSITIVE QUIET) - set(singleValuedArgs TARGET) + set(options QUIET) + set(singleValuedArgs CHILDREN TARGET) set(multiValuedArgs TARGETS) ## parse the arguments to the macro @@ -452,6 +452,10 @@ function(blt_convert_to_system_includes) message(FATAL_ERROR "TARGETS is a required parameter for the blt_convert_to_system_includes macro.") endif() + if(NOT DEFINED arg_CHILDREN) + set(arg_CHILDREN TRUE) + endif() + if(NOT ${arg_QUIET}) foreach(_target ${arg_TARGETS}) if(NOT TARGET ${_target}) @@ -464,7 +468,7 @@ function(blt_convert_to_system_includes) if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI") foreach(_target ${arg_TARGETS}) if(TARGET ${_target}) - if(NOT ${arg_INTRANSITIVE}) + if(${arg_CHILDREN}) get_target_property(_interface_link_libs ${_target} INTERFACE_LINK_LIBRARIES) diff --git a/docs/api/utility.rst b/docs/api/utility.rst index bb54c6693..5d2739ce8 100644 --- a/docs/api/utility.rst +++ b/docs/api/utility.rst @@ -223,12 +223,12 @@ blt_convert_to_system_includes .. code-block:: cmake blt_convert_to_system_includes(TARGETS [...] - [QUIET] - [INTRANSITIVE]) + CHILDREN [TRUE (default) | FALSE ] + [QUIET]) Converts existing interface includes to system interface includes. Warns if a target does not exist unless ``QUIET`` is specified. -Recurses through interface link libraries unless ``INTRANSITIVE`` is specified. +Recurses through interface link libraries unless ``CHILDREN FALSE`` is specified. .. code-block:: cmake :caption: **Example** From 5f50f73f84b0b7b9bd665fc684b6af00e78aab7a Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Fri, 19 Jan 2024 14:15:33 -0800 Subject: [PATCH 03/13] Use blt_find_target_dependencies --- cmake/BLTInstallableMacros.cmake | 75 +++++++++++++++----------------- 1 file changed, 35 insertions(+), 40 deletions(-) diff --git a/cmake/BLTInstallableMacros.cmake b/cmake/BLTInstallableMacros.cmake index f49d80166..ae2d78ab8 100644 --- a/cmake/BLTInstallableMacros.cmake +++ b/cmake/BLTInstallableMacros.cmake @@ -443,7 +443,7 @@ function(blt_convert_to_system_includes) cmake_parse_arguments(arg "${options}" "${singleValuedArgs}" "${multiValuedArgs}" ${ARGN}) - if(DEFINED arg_TARGETS) + if(DEFINED arg_TARGET) message(WARNING "TARGET is a deprecated parameter for the blt_convert_to_system_includes macro.") list(APPEND arg_TARGETS ${arg_TARGET}) endif() @@ -456,55 +456,50 @@ function(blt_convert_to_system_includes) set(arg_CHILDREN TRUE) endif() - if(NOT ${arg_QUIET}) - foreach(_target ${arg_TARGETS}) - if(NOT TARGET ${_target}) - message(WARNING "${_target} does not exist!") - endif() - endforeach() - endif() - # PGI does not support -isystem if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI") + set(_target_list) + foreach(_target ${arg_TARGETS}) if(TARGET ${_target}) if(${arg_CHILDREN}) - get_target_property(_interface_link_libs - ${_target} - INTERFACE_LINK_LIBRARIES) - - - # Don't recurse if the target had no interface link libraries - if(_interface_link_libs) - # TODO: Warn if interface link library is not a target? - blt_convert_to_system_includes(TARGETS ${_interface_link_libs}) - endif() - - unset(_interface_link_libs) + blt_find_target_dependencies(TARGET ${_target} TLIST _target_list) endif() - get_target_property(_interface_include_dirs - ${_target} - INTERFACE_INCLUDE_DIRECTORIES) - - # Don't update properties if the target had no interface include directories - if(_interface_include_dirs) - # Clear previous value in INTERFACE_INCLUDE_DIRECTORIES - # so it is not doubled by target_include_directories - set_target_properties(${_target} - PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES) - - target_include_directories(${_target} - SYSTEM - INTERFACE - ${_interface_include_dirs}) - endif() + list(APPEND _target_list ${_target}) + elseif(NOT ${arg_QUIET) + message(WARNING "${_target} does not exist!") + endif() + endforeach() - unset(_interface_include_dirs) + blt_list_remove_duplicates(TO _target_list) + + foreach(_target ${_target_list}) + get_target_property(_interface_include_dirs + ${_target} + INTERFACE_INCLUDE_DIRECTORIES) + + # Don't update properties if the target had no interface include directories + if(_interface_include_dirs) + # Clear previous value in INTERFACE_INCLUDE_DIRECTORIES + # so it is not doubled by target_include_directories + set_target_properties(${_target} + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES) + + target_include_directories(${_target} + SYSTEM + INTERFACE + ${_interface_include_dirs}) endif() + + unset(_interface_include_dirs) endforeach() - endif() + + unset(_target_list) + elseif(NOT ${arg_QUIET}) + message(WARNING "PGI compiler does not support system includes") + endif() endfunction(blt_convert_to_system_includes) From deff1b54e2f5c84ac3ab1b84c3e17d6482c10d7f Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Mon, 22 Jan 2024 09:25:02 -0800 Subject: [PATCH 04/13] Move blt_find_target_dependencies to installable macros file --- cmake/BLTInstallableMacros.cmake | 61 +++++++++++++++++++++++++++++++ cmake/BLTPrivateMacros.cmake | 62 -------------------------------- 2 files changed, 61 insertions(+), 62 deletions(-) diff --git a/cmake/BLTInstallableMacros.cmake b/cmake/BLTInstallableMacros.cmake index 47b59c33d..dd2da3472 100644 --- a/cmake/BLTInstallableMacros.cmake +++ b/cmake/BLTInstallableMacros.cmake @@ -427,6 +427,67 @@ macro(blt_add_target_compile_flags) endmacro(blt_add_target_compile_flags) +##------------------------------------------------------------------------------ +## blt_find_target_dependencies(TARGET TLIST ) +## +## Store all target's dependencies (link libraries and interface link libraries) +## recursively in the variable name TLIST holds. +##------------------------------------------------------------------------------ +macro(blt_find_target_dependencies) + set(options) + set(singleValuedArgs TARGET TLIST) + set(multiValuedArgs) + + # parse the arguments to the macro + cmake_parse_arguments(arg + "${options}" "${singleValuedArgs}" "${multiValuedArgs}" ${ARGN}) + + # check for required arguments + if(NOT DEFINED arg_TARGET) + message(FATAL_ERROR "TARGET is a required parameter for the blt_find_target_dependencies macro") + endif() + + if(NOT DEFINED arg_TLIST OR NOT DEFINED ${arg_TLIST}) + message(FATAL_ERROR "TLIST is a required parameter for the blt_find_target_dependencies macro") + endif() + + set(_depends_on "") + + # Get dependencies if BLT registered library + string(TOUPPER ${arg_TARGET} _target_upper) + if(_BLT_${_target_upper}_IS_REGISTERED_LIBRARY) + list(APPEND _depends_on "${_BLT_${_target_upper}_DEPENDS_ON}") + endif() + + # Get dependencies if CMake target + if(TARGET ${arg_TARGET}) + get_property(_target_type TARGET ${arg_TARGET} PROPERTY TYPE) + if(NOT "${_target_type}" STREQUAL "INTERFACE_LIBRARY") + get_target_property(_propval ${arg_TARGET} LINK_LIBRARIES) + if(_propval) + list(APPEND _depends_on ${_propval}) + endif() + endif() + + # get interface link libraries + get_target_property(_propval ${arg_TARGET} INTERFACE_LINK_LIBRARIES) + if (_propval) + list(APPEND _depends_on ${_propval}) + endif() + endif() + + blt_list_remove_duplicates(TO _depends_on) + foreach(t ${_depends_on}) + if (NOT "${t}" IN_LIST ${arg_TLIST}) + list(APPEND ${arg_TLIST} ${t}) + blt_find_target_dependencies(TARGET ${t} TLIST ${arg_TLIST}) + endif() + endforeach() + + unset(_depends_on) +endmacro(blt_find_target_dependencies) + + ##------------------------------------------------------------------------------ ## blt_convert_to_system_includes(TARGETS [...] ## CHILDREN [TRUE|FALSE] diff --git a/cmake/BLTPrivateMacros.cmake b/cmake/BLTPrivateMacros.cmake index e0b408754..baf9b3367 100644 --- a/cmake/BLTPrivateMacros.cmake +++ b/cmake/BLTPrivateMacros.cmake @@ -755,65 +755,3 @@ macro(blt_print_target_properties_private) unset(_is_blt_registered_target) unset(_is_cmake_target) endmacro(blt_print_target_properties_private) - -##------------------------------------------------------------------------------ -## blt_find_target_dependencies(TARGET TLIST ) -## -## Store all target's dependencies (link libraries and interface link libraries) -## recursively in the variable name TLIST holds. -##------------------------------------------------------------------------------ -macro(blt_find_target_dependencies) - - set(options) - set(singleValuedArgs TARGET TLIST) - set(multiValuedArgs) - - # parse the arguments to the macro - cmake_parse_arguments(arg - "${options}" "${singleValuedArgs}" "${multiValuedArgs}" ${ARGN}) - - # check for required arguments - if(NOT DEFINED arg_TARGET) - message(FATAL_ERROR "TARGET is a required parameter for the blt_find_target_dependencies macro") - endif() - - if(NOT DEFINED arg_TLIST OR NOT DEFINED ${arg_TLIST}) - message(FATAL_ERROR "TLIST is a required parameter for the blt_find_target_dependencies macro") - endif() - - set(_depends_on "") - - # Get dependencies if BLT registered library - string(TOUPPER ${arg_TARGET} _target_upper) - if(_BLT_${_target_upper}_IS_REGISTERED_LIBRARY) - list(APPEND _depends_on "${_BLT_${_target_upper}_DEPENDS_ON}") - endif() - - # Get dependencies if CMake target - if(TARGET ${arg_TARGET}) - get_property(_target_type TARGET ${arg_TARGET} PROPERTY TYPE) - if(NOT "${_target_type}" STREQUAL "INTERFACE_LIBRARY") - get_target_property(_propval ${arg_TARGET} LINK_LIBRARIES) - if(_propval) - list(APPEND _depends_on ${_propval}) - endif() - endif() - - # get interface link libraries - get_target_property(_propval ${arg_TARGET} INTERFACE_LINK_LIBRARIES) - if (_propval) - list(APPEND _depends_on ${_propval}) - endif() - endif() - - blt_list_remove_duplicates(TO _depends_on) - foreach(t ${_depends_on}) - if (NOT "${t}" IN_LIST ${arg_TLIST}) - list(APPEND ${arg_TLIST} ${t}) - blt_find_target_dependencies(TARGET ${t} TLIST ${arg_TLIST}) - endif() - endforeach() - - unset(_depends_on) - -endmacro(blt_find_target_dependencies) From cd7afa8c4f9b0af3a76a55337f1a89644428204c Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Mon, 22 Jan 2024 10:05:53 -0800 Subject: [PATCH 05/13] Fix warning and error --- cmake/BLTInstallableMacros.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/BLTInstallableMacros.cmake b/cmake/BLTInstallableMacros.cmake index dd2da3472..ab650e04c 100644 --- a/cmake/BLTInstallableMacros.cmake +++ b/cmake/BLTInstallableMacros.cmake @@ -519,7 +519,7 @@ function(blt_convert_to_system_includes) # PGI does not support -isystem if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI") - set(_target_list) + set(_target_list "") foreach(_target ${arg_TARGETS}) if(TARGET ${_target}) @@ -644,7 +644,7 @@ macro(blt_patch_target) endif() if(${arg_TREAT_INCLUDES_AS_SYSTEM}) - blt_convert_to_system_includes(TARGET ${arg_NAME}) + blt_convert_to_system_includes(TARGETS ${arg_NAME}) endif() # FIXME: Is this all that's needed? From 4214e3b42e122ec500913432f44f4fbdb3051190 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Mon, 22 Jan 2024 10:30:52 -0800 Subject: [PATCH 06/13] Add more checking --- cmake/BLTInstallableMacros.cmake | 39 +++++++++++++++++--------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/cmake/BLTInstallableMacros.cmake b/cmake/BLTInstallableMacros.cmake index ab650e04c..a1c65e2e6 100644 --- a/cmake/BLTInstallableMacros.cmake +++ b/cmake/BLTInstallableMacros.cmake @@ -536,25 +536,28 @@ function(blt_convert_to_system_includes) blt_list_remove_duplicates(TO _target_list) foreach(_target ${_target_list}) - get_target_property(_interface_include_dirs - ${_target} - INTERFACE_INCLUDE_DIRECTORIES) - - # Don't update properties if the target had no interface include directories - if(_interface_include_dirs) - # Clear previous value in INTERFACE_INCLUDE_DIRECTORIES - # so it is not doubled by target_include_directories - set_target_properties(${_target} - PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES) - - target_include_directories(${_target} - SYSTEM - INTERFACE - ${_interface_include_dirs}) - endif() + # Ignore entries that are not actual CMake targets + if(TARGET ${_target}) + get_target_property(_interface_include_dirs + ${_target} + INTERFACE_INCLUDE_DIRECTORIES) + + # Don't update properties if the target had no interface include directories + if(_interface_include_dirs) + # Clear previous value in INTERFACE_INCLUDE_DIRECTORIES + # so it is not doubled by target_include_directories + set_target_properties(${_target} + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES) + + target_include_directories(${_target} + SYSTEM + INTERFACE + ${_interface_include_dirs}) + endif() - unset(_interface_include_dirs) + unset(_interface_include_dirs) + endif() endforeach() unset(_target_list) From e94a3682d9626b1b8581c6fa5429abecb1bec6c8 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Mon, 22 Jan 2024 10:42:07 -0800 Subject: [PATCH 07/13] Pass empty string --- cmake/BLTInstallableMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTInstallableMacros.cmake b/cmake/BLTInstallableMacros.cmake index a1c65e2e6..25251e5ca 100644 --- a/cmake/BLTInstallableMacros.cmake +++ b/cmake/BLTInstallableMacros.cmake @@ -548,7 +548,7 @@ function(blt_convert_to_system_includes) # so it is not doubled by target_include_directories set_target_properties(${_target} PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES) + INTERFACE_INCLUDE_DIRECTORIES "") target_include_directories(${_target} SYSTEM From 55861907bc46c8c6c84b2b0316fd3965870f4b7d Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Mon, 22 Jan 2024 15:57:32 -0800 Subject: [PATCH 08/13] Handle BLT registered targets --- cmake/BLTInstallableMacros.cmake | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cmake/BLTInstallableMacros.cmake b/cmake/BLTInstallableMacros.cmake index 25251e5ca..86cf7cdd4 100644 --- a/cmake/BLTInstallableMacros.cmake +++ b/cmake/BLTInstallableMacros.cmake @@ -458,6 +458,7 @@ macro(blt_find_target_dependencies) if(_BLT_${_target_upper}_IS_REGISTERED_LIBRARY) list(APPEND _depends_on "${_BLT_${_target_upper}_DEPENDS_ON}") endif() + unset(_target_upper) # Get dependencies if CMake target if(TARGET ${arg_TARGET}) @@ -522,7 +523,9 @@ function(blt_convert_to_system_includes) set(_target_list "") foreach(_target ${arg_TARGETS}) - if(TARGET ${_target}) + string(TOUPPER ${_target} _target_upper) + + if(TARGET ${_target} OR ${_BLT_${_target_upper}_IS_REGISTERED_LIBRARY}) if(${arg_CHILDREN}) blt_find_target_dependencies(TARGET ${_target} TLIST _target_list) endif() @@ -531,13 +534,15 @@ function(blt_convert_to_system_includes) elseif(NOT ${arg_QUIET) message(WARNING "${_target} does not exist!") endif() + + unset(_target_upper) endforeach() blt_list_remove_duplicates(TO _target_list) foreach(_target ${_target_list}) - # Ignore entries that are not actual CMake targets if(TARGET ${_target}) + # Handle CMake target get_target_property(_interface_include_dirs ${_target} INTERFACE_INCLUDE_DIRECTORIES) @@ -557,6 +562,15 @@ function(blt_convert_to_system_includes) endif() unset(_interface_include_dirs) + else() + string(TOUPPER ${_target} _target_upper) + + if(${_BLT_${_target_upper}_IS_REGISTERED_LIBRARY}) + # Handle BLT registered target + set(_BLT_${_target_upper}_TREAT_INCLUDES_AS_SYSTEM TRUE) + endif() + + unset(_target_upper) endif() endforeach() From ff41fba3d65e02760e14e3b724f551cbd3b5a4d0 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Mon, 22 Jan 2024 16:05:37 -0800 Subject: [PATCH 09/13] Document blt_find_target_dependencies --- docs/api/utility.rst | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/api/utility.rst b/docs/api/utility.rst index e8c283919..27b9240dd 100644 --- a/docs/api/utility.rst +++ b/docs/api/utility.rst @@ -215,6 +215,19 @@ command but doesn't throw an error if the list is empty or not defined. set(mylist A B A) blt_list_remove_duplicates( TO mylist ) +.. _blt_find_target_dependencies: + +blt_find_target_dependencies +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: cmake + + set(_target_list "") + blt_find_target_dependencies(TARGET TLIST _target_list) + +Recursively adds all link libraries and interface link libraries of the given +target to the given list. Handles CMake targets and BLT registered libraries. + .. _blt_convert_to_system_includes: blt_convert_to_system_includes @@ -228,7 +241,8 @@ blt_convert_to_system_includes Converts existing interface includes to system interface includes. Warns if a target does not exist unless ``QUIET`` is specified. -Recurses through interface link libraries unless ``CHILDREN FALSE`` is specified. +Recurses through link libraries and interface link libraries unless +``CHILDREN FALSE`` is specified. .. code-block:: cmake :caption: **Example** From 4e85473c015a1be294ddcfa039a6db14430d465a Mon Sep 17 00:00:00 2001 From: Alan Dayton <6393677+adayton1@users.noreply.github.com> Date: Mon, 22 Jan 2024 16:43:13 -0800 Subject: [PATCH 10/13] Update cmake/BLTInstallableMacros.cmake Co-authored-by: Chris White --- cmake/BLTInstallableMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTInstallableMacros.cmake b/cmake/BLTInstallableMacros.cmake index 86cf7cdd4..aba83c1e2 100644 --- a/cmake/BLTInstallableMacros.cmake +++ b/cmake/BLTInstallableMacros.cmake @@ -525,7 +525,7 @@ function(blt_convert_to_system_includes) foreach(_target ${arg_TARGETS}) string(TOUPPER ${_target} _target_upper) - if(TARGET ${_target} OR ${_BLT_${_target_upper}_IS_REGISTERED_LIBRARY}) + if(TARGET ${_target} OR _BLT_${_target_upper}_IS_REGISTERED_LIBRARY) if(${arg_CHILDREN}) blt_find_target_dependencies(TARGET ${_target} TLIST _target_list) endif() From b944ad26c10fd15a8b32f14255ace8816b8bba22 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Tue, 23 Jan 2024 17:57:00 -0800 Subject: [PATCH 11/13] Add entry to release notes --- RELEASE-NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 0b2929146..25dabdcd7 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -11,6 +11,7 @@ The project release numbers follow [Semantic Versioning](http://semver.org/spec/ ### Fixed - Turned off GoogleTest finding Python +- Modified `blt_convert_to_system_includes` to handle multiple targets and recursively update includes for dependencies ## [Version 0.6.0] - Release date 2024-01-18 From f6e95eecd9bd087f2ce27bf8dfe100e144e90e06 Mon Sep 17 00:00:00 2001 From: Alan Dayton <6393677+adayton1@users.noreply.github.com> Date: Tue, 23 Jan 2024 17:57:41 -0800 Subject: [PATCH 12/13] Update cmake/BLTInstallableMacros.cmake Co-authored-by: Chris White --- cmake/BLTInstallableMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/BLTInstallableMacros.cmake b/cmake/BLTInstallableMacros.cmake index aba83c1e2..ff9cb067b 100644 --- a/cmake/BLTInstallableMacros.cmake +++ b/cmake/BLTInstallableMacros.cmake @@ -565,7 +565,7 @@ function(blt_convert_to_system_includes) else() string(TOUPPER ${_target} _target_upper) - if(${_BLT_${_target_upper}_IS_REGISTERED_LIBRARY}) + if(_BLT_${_target_upper}_IS_REGISTERED_LIBRARY) # Handle BLT registered target set(_BLT_${_target_upper}_TREAT_INCLUDES_AS_SYSTEM TRUE) endif() From 2944bbb1979add6f690a9afb415d6f18f7777288 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Tue, 30 Jan 2024 09:08:39 -0800 Subject: [PATCH 13/13] Make default CHILDREN argument false --- cmake/BLTInstallableMacros.cmake | 2 +- docs/api/utility.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/BLTInstallableMacros.cmake b/cmake/BLTInstallableMacros.cmake index ff9cb067b..95689b85e 100644 --- a/cmake/BLTInstallableMacros.cmake +++ b/cmake/BLTInstallableMacros.cmake @@ -515,7 +515,7 @@ function(blt_convert_to_system_includes) endif() if(NOT DEFINED arg_CHILDREN) - set(arg_CHILDREN TRUE) + set(arg_CHILDREN FALSE) endif() # PGI does not support -isystem diff --git a/docs/api/utility.rst b/docs/api/utility.rst index 27b9240dd..367bc917a 100644 --- a/docs/api/utility.rst +++ b/docs/api/utility.rst @@ -236,7 +236,7 @@ blt_convert_to_system_includes .. code-block:: cmake blt_convert_to_system_includes(TARGETS [...] - CHILDREN [TRUE (default) | FALSE ] + CHILDREN [TRUE | FALSE (default)] [QUIET]) Converts existing interface includes to system interface includes.