Skip to content

Commit

Permalink
Fix for cmake-conan issue conan-io#225 - Compile error on configurati…
Browse files Browse the repository at this point in the history
…on on MacOS

The sysroot option is not set when using `/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++`, needs to be added explicitly.
  • Loading branch information
dforsten committed Apr 26, 2020
1 parent 36100b4 commit b89bf34
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion conan.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,13 @@ function(conan_cmake_detect_unix_libcxx result)
endif()
endforeach()

if(APPLE)
set(xcode_sysroot_option "--sysroot=${CMAKE_OSX_SYSROOT}")
endif()

execute_process(
COMMAND ${CMAKE_COMMAND} -E echo "#include <string>"
COMMAND ${CMAKE_CXX_COMPILER} -x c++ ${compile_options} -E -dM -
COMMAND ${CMAKE_CXX_COMPILER} -x c++ ${xcode_sysroot_option} ${compile_options} -E -dM -
OUTPUT_VARIABLE string_defines
)

Expand Down

0 comments on commit b89bf34

Please sign in to comment.