From 3ea67f49f5e4b6b8869618ef26f93d76f8f4e0b2 Mon Sep 17 00:00:00 2001 From: Marcus Hudritsch Date: Mon, 22 Jan 2024 14:30:01 +0100 Subject: [PATCH] Enabled C++ 17 and std::filesystem on MacOS --- CMakeLists.txt | 2 +- cmake/CompileOptions.cmake | 2 +- modules/utils/source/Utils.cpp | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f03e78da..8a00eba4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.15 FATAL_ERROR) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) if (APPLE) diff --git a/cmake/CompileOptions.cmake b/cmake/CompileOptions.cmake index 5c6d0bd6..9ce6f890 100644 --- a/cmake/CompileOptions.cmake +++ b/cmake/CompileOptions.cmake @@ -17,7 +17,7 @@ set(CMAKE_BUILD_PARALLEL_LEVEL 16) set(DEFAULT_PROJECT_OPTIONS DEBUG_POSTFIX "-debug" RELEASE_POSTFIX "-release" - CXX_STANDARD 14 + CXX_STANDARD 17 LINKER_LANGUAGE "CXX" POSITION_INDEPENDENT_CODE ON CXX_VISIBILITY_PRESET "hidden" diff --git a/modules/utils/source/Utils.cpp b/modules/utils/source/Utils.cpp index a87bbacd..d2fae675 100644 --- a/modules/utils/source/Utils.cpp +++ b/modules/utils/source/Utils.cpp @@ -39,10 +39,14 @@ namespace fs = std::experimental::filesystem; #elif defined(__APPLE__) # if defined(TARGET_OS_IOS) && (TARGET_OS_IOS == 1) # include "Utils_iOS.h" +# include //dirent +# include //dirent +# include //getcwd +# else +# include +# define USE_STD_FILESYSTEM +namespace fs = std::filesystem; # endif -# include -# include //dirent -# include //getcwd #elif defined(ANDROID) || defined(ANDROID_NDK) # include # include