Replace boost::filesystem by std::experimental::filesystem when the later is available

This commit is contained in:
Carles Fernandez 2019-06-13 15:33:01 +02:00
parent 8d424a13b6
commit e285da5899
3 changed files with 32 additions and 18 deletions

View File

@ -752,11 +752,27 @@ endif()
################################################################################
# Log4cpp - http://log4cpp.sourceforge.net/
################################################################################
find_package(LOG4CPP)
set_package_properties(LOG4CPP PROPERTIES
URL "http://log4cpp.sourceforge.net/"
DESCRIPTION "Library of C++ classes for flexible logging to files"
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
if(NOT LOG4CPP_FOUND)
message(FATAL_ERROR "*** Log4cpp is required to build gnss-sdr")
endif()
################################################################################
# Dectect availability of std::filesystem
################################################################################
set(FILESYSTEM_FOUND FALSE)
if(NOT (GNURADIO_VERSION VERSION_LESS 3.8))
if(NOT (GNURADIO_VERSION VERSION_LESS 3.8) AND LOG4CPP_READY_FOR_CXX17)
# Check if we have std::filesystem
if(NOT (CMAKE_VERSION VERSION_LESS 3.8))
if(POLICY CMP0057)
@ -910,22 +926,6 @@ endif()
################################################################################
# Log4cpp - http://log4cpp.sourceforge.net/
################################################################################
find_package(LOG4CPP)
set_package_properties(LOG4CPP PROPERTIES
URL "http://log4cpp.sourceforge.net/"
DESCRIPTION "Library of C++ classes for flexible logging to files"
PURPOSE "Required by GNU Radio."
TYPE REQUIRED
)
if(NOT LOG4CPP_FOUND)
message(FATAL_ERROR "*** Log4cpp is required to build gnss-sdr")
endif()
################################################################################
# volk_gnsssdr module - GNSS-SDR's own VOLK library
################################################################################

View File

@ -39,6 +39,20 @@ find_path(LOG4CPP_INCLUDE_DIR log4cpp/Category.hh
$ENV{LOG4CPP_ROOT}/include
)
if(LOG4CPP_INCLUDE_DIR)
file(STRINGS ${LOG4CPP_INCLUDE_DIR}/log4cpp/Priority.hh _log4cpp_Priority)
set(_log4cpp_cxx17 TRUE)
foreach(_loop_var IN LISTS _log4cpp_Priority)
string(STRIP "${_loop_var}" _file_line)
if("throw(std::invalid_argument);" STREQUAL "${_file_line}")
set(_log4cpp_cxx17 FALSE)
endif()
endforeach()
if(${_log4cpp_cxx17})
set(LOG4CPP_READY_FOR_CXX17 TRUE)
endif()
endif()
set(LOG4CPP_NAMES log4cpp)
find_library(LOG4CPP_LIBRARY
NAMES ${LOG4CPP_NAMES}

View File

@ -43,7 +43,7 @@ namespace fs = std::experimental::filesystem;
namespace fs = std::filesystem;
#endif
#else
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp> // for exists
namespace fs = boost::filesystem;
#endif