fix compilation with boost::filesystem
CMakeLists.txt: --------------------------- Until now build with boost::filesystem was completely broken, since cmake exported definitions with wrong name prefixes, and nana always defaulted to internal filesystem implementation. After fixing the boost definitions, a number of errors came up due to incompatibility of boost::filesystem with nana and std filesystems. This commit tries to fix them all. filesystem.cpp, filesystem.hpp, filebox.cpp: -------------------------------------------- boost::filesystem doesn't have a file_time_type, so declared it in the filesystem.hpp header. boost::filesystem::last_write_time has a return type std::time_t unlike the other two implementations of this function in nana and std, so added ifdef to convert the result to file_time_type. fixed build on gcc-4.9, since it doesn't have a std::put_time function, included <nana/stdc++.hpp> in that case. boost::filesystem::file_type types have different names than std::experimental::filesystem::file_type types, fixed it by creating an enum class file_type with the same type names as in std::experimental::filesystem::file_type. This fix requires static_cast from functions results to internal file_type, since boost file_type and std file_type a different enum classes. changed switch to if, bacause old gcc fails on converting enum class members to int. stdc++.hpp: ----------- added ifndef guards to prevent errors on multiple includes of this header. wvl.cpp: -------- added boost/chrono.hpp include for the cases when std::thread is not available. travis: ------- added boost system, thread, chrono libs to install, they are needed for the nana-demo to compile.
This commit is contained in:
@@ -238,7 +238,7 @@ elseif (NANA_CMAKE_STD_FILESYSTEM_FORCE)
|
||||
add_definitions(-DSTD_FILESYSTEM_FORCE)
|
||||
elseif (NANA_CMAKE_FIND_BOOST_FILESYSTEM OR NANA_CMAKE_BOOST_FILESYSTEM_FORCE)
|
||||
if (NANA_CMAKE_BOOST_FILESYSTEM_FORCE)
|
||||
add_definitions(-DNANA_BOOST_FILESYSTEM_FORCE)
|
||||
add_definitions(-DBOOST_FILESYSTEM_FORCE)
|
||||
endif(NANA_CMAKE_BOOST_FILESYSTEM_FORCE)
|
||||
# https://cmake.org/cmake/help/git-master/module/FindBoost.html
|
||||
# Implicit dependencies such as Boost::filesystem requiring Boost::system will be automatically detected and satisfied,
|
||||
@@ -246,7 +246,7 @@ elseif (NANA_CMAKE_FIND_BOOST_FILESYSTEM OR NANA_CMAKE_BOOST_FILESYSTEM_FORCE)
|
||||
# If using Boost::thread, then Thread::Thread will also be added automatically.
|
||||
find_package(Boost COMPONENTS filesystem)
|
||||
if (Boost_FOUND)
|
||||
add_definitions(-DNANA_BOOST_FILESYSTEM_AVAILABLE)
|
||||
add_definitions(-DBOOST_FILESYSTEM_AVAILABLE)
|
||||
include_directories(SYSTEM "${Boost_INCLUDE_DIR}")
|
||||
list(APPEND NANA_LINKS ${Boost_LIBRARIES}) ###### FIRST !!!!!!!!!!!!!!!!! add is not first
|
||||
endif (Boost_FOUND)
|
||||
|
||||
Reference in New Issue
Block a user