Tests/Assembler: Use CMAKE_OSX_SYSROOT to generate .s file

On OS X if the user-provided flags do not include -isysroot and
CMAKE_OSX_SYSROOT is defined then add the proper -isysroot flag to the C
compiler invocation we use to generate the .s file.
This commit is contained in:
Brad King 2012-09-21 10:34:10 -04:00
parent a1c032b994
commit 242f673829
1 changed files with 3 additions and 0 deletions

View File

@ -12,6 +12,9 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode" AND
if(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|Clang|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX))
set(C_FLAGS "${CMAKE_C_FLAGS}")
separate_arguments(C_FLAGS)
if(CMAKE_OSX_SYSROOT AND CMAKE_C_SYSROOT_FLAG AND NOT ";${C_FLAGS};" MATCHES ";${CMAKE_C_SYSROOT_FLAG};")
list(APPEND C_FLAGS ${CMAKE_C_SYSROOT_FLAG} ${CMAKE_OSX_SYSROOT})
endif()
set(SRCS main.s)
add_custom_command(
OUTPUT main.s