diff --git a/CMakeLists.txt b/CMakeLists.txt index e61256f03..2c24e7921 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,9 @@ if (CMAKE_MAJOR_VERSION LESS 3) "MP: CMake version 3.0 or newer is required to install all targets") endif () +# Minimum MacOS target to enable C++17 std::filesystem +set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15) + # Set the path to CMake modules. set(MP_CMAKE_MODULE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/support/cmake) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${MP_CMAKE_MODULE_DIR}) diff --git a/nl-writer2/CMakeLists.txt b/nl-writer2/CMakeLists.txt index b9132960a..bd837bbd3 100644 --- a/nl-writer2/CMakeLists.txt +++ b/nl-writer2/CMakeLists.txt @@ -1,5 +1,10 @@ cmake_minimum_required(VERSION 3.10) + +# Minimum MacOS target to enable C++17 std::filesystem +set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15) + + project(NLWriter2) diff --git a/nl-writer2/src/nl-solver.cc b/nl-writer2/src/nl-solver.cc index e188b349b..bacdcc0d8 100644 --- a/nl-writer2/src/nl-solver.cc +++ b/nl-writer2/src/nl-solver.cc @@ -30,6 +30,8 @@ #if defined(_WIN32) || defined(_WIN64) #include // _mktemp[_s] +#elif __APPLE__ + #include // mkdtemp #else #include // mkdtemp #endif @@ -554,9 +556,6 @@ void NLSolver::InitAutoStub() { if (!std::filesystem::create_directory(pathstr_)) Utils().myexit("Could not create temp dir '" + pathstr_ + "'"); -#elif __APPLE__ - if (!std::filesystem::create_directory(pathstr_)) - Utils().myexit("Could not create temp dir '" + pathstr_ + "'"); #else if (!mkdtemp((char*)pathstr_.c_str())) Utils().myexit("Could not create a temp dir\n"