From: Matthias Maier Date: Tue, 23 May 2023 12:17:50 +0000 (-0500) Subject: CMake: try to filter generator expression in copy_target_properties() X-Git-Tag: v9.5.0-rc1~200^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2a6a0a1f4eb173ea0093d546dcd8f93f9a60765;p=dealii.git CMake: try to filter generator expression in copy_target_properties() As long as the generator expressions are not too complicated we can simply remove them. If any of the upstream project starts to use more complex generator expressions we will at some point have to abandon our approach of copying target properties. --- diff --git a/cmake/macros/macro_copy_target_properties.cmake b/cmake/macros/macro_copy_target_properties.cmake index 0e589df1d3..c9b62b21b2 100644 --- a/cmake/macros/macro_copy_target_properties.cmake +++ b/cmake/macros/macro_copy_target_properties.cmake @@ -75,6 +75,7 @@ function(copy_target_properties _destination_target) endif() foreach(_lib ${_location} ${_values}) + strip_known_generator_expressions(_lib) if(TARGET ${_lib}) list(APPEND _source_targets ${_lib}) else() diff --git a/cmake/macros/macro_strip_known_generator_expressions.cmake b/cmake/macros/macro_strip_known_generator_expressions.cmake new file mode 100644 index 0000000000..25ccef8d5f --- /dev/null +++ b/cmake/macros/macro_strip_known_generator_expressions.cmake @@ -0,0 +1,26 @@ +## --------------------------------------------------------------------- +## +## Copyright (C) 2023 - 2023 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE.md at +## the top level directory of deal.II. +## +## --------------------------------------------------------------------- + +# +# strip_known_generator_expressions() +# +# Strip an enclosing generator expression from the variable. This macro is +# primarily used in copy_target_properties +# + +macro(strip_known_generator_expressions _variable) + string(REGEX REPLACE "^\\$$" "\\1" ${_variable} "${${_variable}}") +endmacro() +