Ask Your Question

Revision history [back]

Hey, I think I may have figured it out. The issue seems to be that XCode has turned on the C++17 features but not the C++17 standard library in versions less than macOS 10.15. Therefore to be able to compile in Mojave and older, you will need to add the -mmacosx-version-min=10.15 flag in your CMakeLists.txt file as such:

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic -mmacosx-version-min=10.15)
endif()

Hey, I think I may have figured it out. The issue seems to be that XCode has turned on the C++17 features but not the C++17 standard library in versions less than macOS 10.15. Therefore to be able to compile in Mojave and older, you will need to add the -mmacosx-version-min=10.15 flag in your CMakeLists.txt file as such:

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic -mmacosx-version-min=10.15)
endif()

EDIT:

I do have to say that the issue with this method is that you are now targeting 10.15 instead of the version of macOS you are using. What that means is that anything you compile with this method can only be run on macOS 10.15.