Skip to content

Commit

Permalink
Add -isysroot if CMake has a point of view...
Browse files Browse the repository at this point in the history
  • Loading branch information
willend committed Dec 4, 2023
1 parent e3550e0 commit c25ad12
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmake/Modules/PlatformDefaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ function( detect_platform_variables resultvarname )
#C flags:
include (CheckCCompilerFlag)
set(MCCODE_CFLAGS "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
if ( DARWIN AND DEFINED CMAKE_OSX_SYSROOT AND NOT "x${CMAKE_OSX_SYSROOT}" STREQUAL "x" )
#Attempt to provide the relevant -isysroot on macOS, possibly found by cmake
set(MCCODE_CFLAGS "${MCCODE_CFLAGS} -isysroot ${CMAKE_OSX_SYSROOT}")
endif()
foreach( flag "-std=c99" "-lm" )
#NB: plethora of "unset(tmp_test_c_flag_result ...)" statements below is
#added for safety, to prevent CMake's CACHE system to give unpredictable
Expand Down

0 comments on commit c25ad12

Please sign in to comment.