Skip to content

Commit

Permalink
APPLE mkdtemp(), MacOS target >=10.15 #30
Browse files Browse the repository at this point in the history
  • Loading branch information
glebbelov committed Feb 25, 2024
1 parent 723d6cc commit a8b147e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
5 changes: 5 additions & 0 deletions nl-writer2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
5 changes: 2 additions & 3 deletions nl-writer2/src/nl-solver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

#if defined(_WIN32) || defined(_WIN64)
#include <io.h> // _mktemp[_s]
#elif __APPLE__
#include <unistd.h> // mkdtemp
#else
#include <cstdlib> // mkdtemp
#endif
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit a8b147e

Please sign in to comment.