cellml / libcellml

Repository for libCellML development.
https://libcellml.org
Apache License 2.0
16 stars 21 forks source link

Set OSX deployment target for std::any #1108

Closed hsorby closed 1 year ago

hsorby commented 1 year ago

Not all OSX development targets support std::any, we should set the minimum target before the CMake project command to avoid compilation errors on some macOS platforms.

agarny commented 1 year ago

std::any is part of C++17 and we require C++17 to build libCellML, so why this issue?

hsorby commented 1 year ago

When building on macOS it tries to use the oldest SDK it can, it doesn't appear to take into account the C++17 setting. Old SDKs don't support std::any, which leaves you with errors like:



/workspace/srcdir/libcellml/src/annotator.cpp:412:31: error: 'any_cast<std::weak_ptr<libcellml::Component>>' is unavailable: introduced in macOS 10.14
--
  | [10:55:39]         auto component = std::any_cast<ComponentWeakPtr>(item->mPimpl->mItem).lock();

```.
agarny commented 1 year ago

What about using CMAKE_OSX_DEPLOYMENT_TARGET to specify the minimum version of macOS that we want to support (and therefore the minimum version of the C++ standard that we want to support)?

hsorby commented 1 year ago

I thought that was what I was getting at.