Merge pull request #1 from jacobdenobel/master

Windows and gcc < 9.0 fixes
This commit is contained in:
Johann Dreo 2021-07-21 08:43:27 +02:00 committed by GitHub
commit 6123490af6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View file

@ -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

View file

@ -3,8 +3,15 @@
#pragma once
/** @file */
#include <ciso646>
#ifdef FSEXPERIMENTAL
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#else
#include <filesystem>
namespace fs = std::filesystem;
#endif
#include <iostream>
#include <sstream>
#include <fstream>
@ -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.