2016-09-27 22:01:08 +03:00
|
|
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
2009-12-02 23:09:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
# This module is shared by multiple languages; use include blocker.
|
|
|
|
if(__DARWIN_COMPILER_GNU)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
set(__DARWIN_COMPILER_GNU 1)
|
|
|
|
|
|
|
|
macro(__darwin_compiler_gnu lang)
|
2012-12-05 20:49:13 +04:00
|
|
|
set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output
|
2009-12-02 23:09:03 +03:00
|
|
|
# GNU does not have -shared on OS X
|
2010-12-23 00:28:54 +03:00
|
|
|
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
|
|
|
|
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
|
2014-05-05 14:39:55 +04:00
|
|
|
|
|
|
|
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.3)
|
|
|
|
set(CMAKE_${lang}_SYSTEM_FRAMEWORK_SEARCH_FLAG "-iframework ")
|
|
|
|
endif()
|
2009-12-02 23:09:03 +03:00
|
|
|
endmacro()
|
|
|
|
|
2012-09-21 16:53:42 +04:00
|
|
|
macro(cmake_gnu_set_sysroot_flag lang)
|
|
|
|
if(NOT DEFINED CMAKE_${lang}_SYSROOT_FLAG)
|
2009-09-19 18:14:31 +04:00
|
|
|
set(_doc "${lang} compiler has -isysroot")
|
|
|
|
message(STATUS "Checking whether ${_doc}")
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_${lang}_COMPILER} "-v" "--help"
|
|
|
|
OUTPUT_VARIABLE _gcc_help
|
|
|
|
ERROR_VARIABLE _gcc_help
|
|
|
|
)
|
|
|
|
if("${_gcc_help}" MATCHES "isysroot")
|
|
|
|
message(STATUS "Checking whether ${_doc} - yes")
|
2012-09-21 16:53:42 +04:00
|
|
|
set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot")
|
2009-09-19 18:14:31 +04:00
|
|
|
else()
|
|
|
|
message(STATUS "Checking whether ${_doc} - no")
|
2012-09-21 16:53:42 +04:00
|
|
|
set(CMAKE_${lang}_SYSROOT_FLAG "")
|
2009-09-19 18:14:31 +04:00
|
|
|
endif()
|
2012-09-21 16:53:42 +04:00
|
|
|
set(CMAKE_${lang}_SYSROOT_FLAG_CODE "set(CMAKE_${lang}_SYSROOT_FLAG \"${CMAKE_${lang}_SYSROOT_FLAG}\")")
|
2009-09-19 18:14:31 +04:00
|
|
|
endif()
|
|
|
|
endmacro()
|
2010-01-29 19:56:35 +03:00
|
|
|
|
|
|
|
macro(cmake_gnu_set_osx_deployment_target_flag lang)
|
|
|
|
if(NOT DEFINED CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG)
|
|
|
|
set(_doc "${lang} compiler supports OSX deployment target flag")
|
|
|
|
message(STATUS "Checking whether ${_doc}")
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_${lang}_COMPILER} "-v" "--help"
|
|
|
|
OUTPUT_VARIABLE _gcc_help
|
|
|
|
ERROR_VARIABLE _gcc_help
|
|
|
|
)
|
|
|
|
if("${_gcc_help}" MATCHES "macosx-version-min")
|
|
|
|
message(STATUS "Checking whether ${_doc} - yes")
|
|
|
|
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=")
|
|
|
|
else()
|
|
|
|
message(STATUS "Checking whether ${_doc} - no")
|
|
|
|
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "")
|
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG_CODE "set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG \"${CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG}\")")
|
2010-01-29 19:56:35 +03:00
|
|
|
endif()
|
|
|
|
endmacro()
|