Apple-Clang.cmake 1.7 KB

1234567891011121314151617181920212223242526272829303132
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. # This module is shared by multiple languages; use include blocker.
  4. include_guard()
  5. macro(__apple_compiler_clang lang)
  6. set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output
  7. set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
  8. set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
  9. set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot")
  10. set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=")
  11. if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.2)
  12. set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
  13. endif()
  14. if(_CMAKE_OSX_SYSROOT_PATH MATCHES "/iPhoneOS")
  15. set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-miphoneos-version-min=")
  16. elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/iPhoneSimulator")
  17. set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mios-simulator-version-min=")
  18. elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/AppleTVOS")
  19. set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtvos-version-min=")
  20. elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/AppleTVSimulator")
  21. set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mtvos-simulator-version-min=")
  22. elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/WatchOS")
  23. set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mwatchos-version-min=")
  24. elseif(_CMAKE_OSX_SYSROOT_PATH MATCHES "/WatchSimulator")
  25. set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mwatchos-simulator-version-min=")
  26. else()
  27. set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=")
  28. endif()
  29. endmacro()