Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pluginlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,18 @@ install(
if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)

# NOTE this block is also defined in pluginlib-extras.cmake
# changes here need to be duplicated there
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_FLAGS MATCHES "-stdlib=libc\\+\\+")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
# Before LLVM 7.0, filesystem is part of experimental
set(FILESYSTEM_LIB c++experimental)
else()
elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
# Before LLVM 9.0 you have to manually link the fs library
set(FILESYSTEM_LIB c++fs)
else()
# Starting at LLVM 9.0 filesystem is built in
set(FILESYSTEM_LIB)
endif()
else()
set(FILESYSTEM_LIB stdc++fs)
Expand Down
5 changes: 5 additions & 0 deletions pluginlib/include/pluginlib/impl/filesystem_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ namespace fs = std::filesystem;
// MSVC deprecates <experimental/filesystem> and in favor of <filesystem>
// use this macro to acknowledge this deprecation and unblock the build break
# define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
// Clang 9.0 deprecates experimental/filesystem in favor of C++17's
// std::filesystem. Since pluginlib currently targets C++14 but needs to
// support recent clang releases this acknowledges and suppresses the
// deprecation error.
# define _LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM
# include <experimental/filesystem>

namespace pluginlib
Expand Down
7 changes: 6 additions & 1 deletion pluginlib/pluginlib-extras.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ include("${pluginlib_DIR}/pluginlib_export_plugin_description_file.cmake")

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_FLAGS MATCHES "-stdlib=libc\\+\\+")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
# Before LLVM 7.0, filesystem is part of experimental
set(FILESYSTEM_LIB c++experimental)
else()
elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)
# Before LLVM 9.0 you have to manually link the fs library
set(FILESYSTEM_LIB c++fs)
else()
# Starting at LLVM 9.0 filesystem is built in
set(FILESYSTEM_LIB)
endif()
else()
set(FILESYSTEM_LIB stdc++fs)
Expand Down