From bb280a2815e13d86a5f9b0c7013ce0cc8d2bdca7 Mon Sep 17 00:00:00 2001 From: Hummeltech <6109326+hummeltech@users.noreply.github.com> Date: Sun, 19 Mar 2023 13:39:20 -0700 Subject: [PATCH] Fixing issues with USE_BOOST_FILESYSTEM definition --- CMakeLists.txt | 8 ++++---- include/mapnik/filesystem.hpp | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe1243f03..3a5bee6b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ mapnik_option(USE_PROJ "adds proj support" ON) mapnik_option(USE_GRID_RENDERER "adds grid renderer" ON) mapnik_option(USE_SVG_RENDERER "adds svg renderer" ON) mapnik_option(USE_BIGINT "uses 64 bit instead of 32" ON) -mapnik_option(USE_BOOST_FILESYSTEM "use boost::filesytem even if `std::filesystem` is avaible (since c++17)" OFF) +mapnik_option(USE_BOOST_FILESYSTEM "use boost::filesytem even if `std::filesystem` is available (since c++17)" OFF) mapnik_option(USE_MEMORY_MAPPED_FILE "uses file cache" ON) mapnik_option(USE_MULTITHREADED "enables the multithreaded features (threadsafe)" ON) mapnik_option(USE_NO_ATEXIT "disable atexit" OFF) @@ -156,11 +156,11 @@ mapnik_find_threads() mapnik_find_package(ICU REQUIRED COMPONENTS uc i18n data) mapnik_find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS regex) -if(CMAKE_CXX_STANDARD LESS 17) - set(USE_BOOST_FILESYSTEM ON) +if(CMAKE_CXX_STANDARD VERSION_LESS 17) + set(USE_BOOST_FILESYSTEM ON CACHE BOOL "Use boost::filesystem" FORCE) endif() if(USE_BOOST_FILESYSTEM) -mapnik_find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS filesystem system) + mapnik_find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS filesystem system) endif() list(APPEND MAPNIK_COMPILE_DEFS BOOST_REGEX_HAS_ICU) diff --git a/include/mapnik/filesystem.hpp b/include/mapnik/filesystem.hpp index ff4b41a22..98ec5f8e2 100644 --- a/include/mapnik/filesystem.hpp +++ b/include/mapnik/filesystem.hpp @@ -23,20 +23,20 @@ #ifndef MAPNIK_FILESYSTEM_HPP #define MAPNIK_FILESYSTEM_HPP -#if !defined(USE_BOOST_FILESYSTEM) -#include -#else +#ifdef USE_BOOST_FILESYSTEM #include // for absolute, exists, etc #include // for path, operator/ +#else +#include #endif namespace mapnik { -#if !defined(USE_BOOST_FILESYSTEM) -namespace fs = std::filesystem; -using error_code = std::error_code; -#else +#ifdef USE_BOOST_FILESYSTEM namespace fs = boost::filesystem; using error_code = boost::system::error_code; +#else +namespace fs = std::filesystem; +using error_code = std::error_code; #endif } // namespace mapnik