# Linking towards an older OS version (Mac)

**URL:** <https://discourse.cmake.org/t/linking-towards-an-older-os-version-mac/1351>\
**Category:** Code\
**Tags:** os:macos, gen:ninja\
**Created:** [June 8, 2020, 5:15pm UTC](https://discourse.cmake.org/t/linking-towards-an-older-os-version-mac/1351 "2020-06-08T17:15:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gonzalo\_Garramuno](https://discourse.cmake.org/user_avatar/discourse.cmake.org/gonzalo_garramuno/32/265_2.png) [@Gonzalo\_Garramuno](https://discourse.cmake.org/u/Gonzalo_Garramuno)\
**Post date:** [June 8, 2020, 5:15pm UTC](https://discourse.cmake.org/t/linking-towards-an-older-os-version-mac/1351/1 "2020-06-08T17:15:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![smokris](https://discourse.cmake.org/user_avatar/discourse.cmake.org/smokris/32/108_2.png) [@smokris](https://discourse.cmake.org/u/smokris)\
**Post date:** [June 8, 2020, 6:29pm UTC](https://discourse.cmake.org/t/linking-towards-an-older-os-version-mac/1351/2 "2020-06-08T18:29:50Z")

</div>

Try this:

```
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.14)

```

More information here: [https://cmake.org/cmake/help/latest/variable/CMAKE\_OSX\_DEPLOYMENT\_TARGET.html](https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_DEPLOYMENT_TARGET.html)

---

<div class="post-metadata">

**Author:** ![Gonzalo\_Garramuno](https://discourse.cmake.org/user_avatar/discourse.cmake.org/gonzalo_garramuno/32/265_2.png) [@Gonzalo\_Garramuno](https://discourse.cmake.org/u/Gonzalo_Garramuno)\
**Post date:** [June 9, 2020, 8:20pm UTC](https://discourse.cmake.org/t/linking-towards-an-older-os-version-mac/1351/3 "2020-06-09T20:20:38Z")

</div>

Thanks for the tip. It worked like a charm.
