From b89bf34fa1e6185239be4cceea4c1a4bc1983e42 Mon Sep 17 00:00:00 2001 From: davidf Date: Sun, 26 Apr 2020 19:59:39 +0200 Subject: [PATCH] Fix for cmake-conan issue #225 - Compile error on configuration 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. --- conan.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/conan.cmake b/conan.cmake index 6425a9fd..4abecf88 100644 --- a/conan.cmake +++ b/conan.cmake @@ -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 " - 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 )