Linking towards an older OS version (Mac)

I have my executable working on MacOSX Catalina. However, since I am not using any of the features of it, I would like to target the earliest version os the OS I can, like, say, Mojave.
I would like to know what flags/variables would I need to set so that I can do so as I am working mostly command line. I looked at the xcode project that cmake generates, and it seems I should be able to set a link flag and perhaps, in addition, use a different sdk to accomplish what I want.
Any help is much appreciated.

Try this:

set(CMAKE_OSX_DEPLOYMENT_TARGET 10.14)

More information here: https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_DEPLOYMENT_TARGET.html

Thanks for the tip. It worked like a charm.

1 Like