From 739942bc376d266ef1b5f59a797f1a943d39899e Mon Sep 17 00:00:00 2001 From: Jacob Date: Tue, 20 Jul 2021 21:35:17 +0200 Subject: [PATCH 1/2] Update CMakeLists.txt Add compile defintions for filesystem header for older gcc versions --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e74164f..407a830 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,14 @@ project("clutchlog" enable_language(CXX) # C++ set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_LIBRARIES -lstdc++fs) +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -std=c++17 -lstdc++fs") + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) + link_libraries(stdc++fs) + add_compile_definitions(FSEXPERIMENTAL) + endif() +endif() + ###################################################################################### # Configurable user settings From 09d6b915e30050ff790e49432768648e6d0721fa Mon Sep 17 00:00:00 2001 From: Jacob Date: Tue, 20 Jul 2021 21:37:51 +0200 Subject: [PATCH 2/2] Update clutchlog.h Change filesystem include and include ciso646 header for windows named logical operators --- clutchlog/clutchlog.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/clutchlog/clutchlog.h b/clutchlog/clutchlog.h index 59a192c..f1469f6 100644 --- a/clutchlog/clutchlog.h +++ b/clutchlog/clutchlog.h @@ -3,8 +3,15 @@ #pragma once /** @file */ - +#include +#ifdef FSEXPERIMENTAL +#include +namespace fs = std::experimental::filesystem; +#else #include +namespace fs = std::filesystem; +#endif + #include #include #include @@ -715,7 +722,7 @@ class clutchlog do { outfile = replace(filename_template, tag, n); n++; - } while( std::filesystem::exists( outfile ) ); + } while( fs::exists( outfile ) ); } else { // Use the parameter as is.