diff --git a/ament_cmake_libraries/ament_cmake_libraries-extras.cmake b/ament_cmake_libraries/ament_cmake_libraries-extras.cmake index dcea0c68..1983b174 100644 --- a/ament_cmake_libraries/ament_cmake_libraries-extras.cmake +++ b/ament_cmake_libraries/ament_cmake_libraries-extras.cmake @@ -17,5 +17,3 @@ set(AMENT_BUILD_CONFIGURATION_KEYWORD_SEPARATOR ":") include("${ament_cmake_libraries_DIR}/ament_libraries_deduplicate.cmake") -include("${ament_cmake_libraries_DIR}/ament_libraries_pack_build_configuration.cmake") -include("${ament_cmake_libraries_DIR}/ament_libraries_unpack_build_configuration.cmake") diff --git a/ament_cmake_libraries/cmake/ament_libraries_deduplicate.cmake b/ament_cmake_libraries/cmake/ament_libraries_deduplicate.cmake index ff3f8ef1..15c3368a 100644 --- a/ament_cmake_libraries/cmake/ament_libraries_deduplicate.cmake +++ b/ament_cmake_libraries/cmake/ament_libraries_deduplicate.cmake @@ -26,13 +26,9 @@ # @public # macro(ament_libraries_deduplicate VAR) - ament_libraries_pack_build_configuration(_packed ${ARGN}) - set(_unique "") - foreach(_lib ${_packed}) - # remove existing value if it exists - list(REMOVE_ITEM _unique ${_lib}) - # append value to the end - list(APPEND _unique ${_lib}) - endforeach() - ament_libraries_unpack_build_configuration(${VAR} ${_unique}) + string(REGEX REPLACE "(^|;)(debug|optimized|general);(.+)" "\\2${AMENT_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}\\3" _packed "${ARGN}") + list(REVERSE _packed) + list(REMOVE_DUPLICATES _packed) + list(REVERSE _packed) + string(REGEX REPLACE "(^|;)(debug|optimized|general)${AMENT_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}(.+)" "\\2;\\3" ${VAR} "${_packed}") endmacro() diff --git a/ament_cmake_libraries/cmake/ament_libraries_pack_build_configuration.cmake b/ament_cmake_libraries/cmake/ament_libraries_pack_build_configuration.cmake deleted file mode 100644 index 1593ec78..00000000 --- a/ament_cmake_libraries/cmake/ament_libraries_pack_build_configuration.cmake +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2014 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# -# Pack a list of libraries with optional build configuration keywords. -# -# Each keyword is joined with its library using a separator. -# A packed library list can be deduplicated easily. -# -# :param VAR: the output variable name -# :type VAR: string -# :param ARGN: a list of libraries -# :type ARGN: list of strings -# -macro(ament_libraries_pack_build_configuration VAR) - set(${VAR} "") - set(_argn ${ARGN}) - list(LENGTH _argn _count) - set(_index 0) - while(${_index} LESS ${_count}) - list(GET _argn ${_index} _lib) - if("${_lib}" MATCHES "^(debug|optimized|general)$") - math(EXPR _index "${_index} + 1") - if(${_index} EQUAL ${_count}) - message(FATAL_ERROR - "ament_libraries_pack_build_configuration() the list of libraries '${_argn}' ends with '${_lib}' " - "which is a build configuration keyword and must be followed by a library") - endif() - list(GET _argn ${_index} library) - list(APPEND ${VAR} "${_lib}${AMENT_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}${library}") - else() - list(APPEND ${VAR} "${_lib}") - endif() - math(EXPR _index "${_index} + 1") - endwhile() -endmacro() diff --git a/ament_cmake_libraries/cmake/ament_libraries_unpack_build_configuration.cmake b/ament_cmake_libraries/cmake/ament_libraries_unpack_build_configuration.cmake deleted file mode 100644 index 4dfc7503..00000000 --- a/ament_cmake_libraries/cmake/ament_libraries_unpack_build_configuration.cmake +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2014 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# -# Unpack a list of libraries with optional build configuration keyword prefixes. -# -# Libraries prefixed with a keyword are split into the keyword and the library. -# -# :param VAR: the output variable name -# :type VAR: string -# :param ARGN: a list of libraries -# :type ARGN: list of strings -# -macro(ament_libraries_unpack_build_configuration VAR) - set(${VAR} "") - foreach(_lib ${ARGN}) - string(REGEX REPLACE "^(debug|optimized|general)${AMENT_BUILD_CONFIGURATION_KEYWORD_SEPARATOR}(.+)$" "\\1;\\2" _lib "${_lib}") - list(APPEND ${VAR} "${_lib}") - endforeach() -endmacro()