From ec49377fcd20748ae4490cd18afc9abefa11e7be Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 3 Jan 2018 13:52:01 -1000 Subject: [PATCH] Better toolchain include discovery on macOS --- atdna/CMakeLists.txt | 9 ++++++--- atdna/atdnaConfig.cmake.in | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/atdna/CMakeLists.txt b/atdna/CMakeLists.txt index 72c8f56..217c7f2 100644 --- a/atdna/CMakeLists.txt +++ b/atdna/CMakeLists.txt @@ -202,12 +202,15 @@ macro(atdna out) # OSX Extra elseif(APPLE) + get_filename_component(COMPILER_DIR "${CMAKE_CXX_COMPILER}" DIRECTORY) if (NOT EXISTS "${CMAKE_OSX_SYSROOT}") message(FATAL_ERROR "CMAKE_OSX_SYSROOT not set") endif() - list(APPEND extraargs -isysroot ${CMAKE_OSX_SYSROOT} -isysroot ${CMAKE_OSX_SYSROOT}/usr/include - -I ${CMAKE_OSX_SYSROOT}/../../../../../Toolchains/XcodeDefault.xctoolchain - -I ${CMAKE_OSX_SYSROOT}/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1) + list(APPEND extraargs + -isysroot ${CMAKE_OSX_SYSROOT} + -isysroot ${CMAKE_OSX_SYSROOT}/usr/include + -I ${COMPILER_DIR}/../.. + -I ${COMPILER_DIR}/../include/c++/v1) endif() # Make target diff --git a/atdna/atdnaConfig.cmake.in b/atdna/atdnaConfig.cmake.in index 537fa0f..23434cf 100644 --- a/atdna/atdnaConfig.cmake.in +++ b/atdna/atdnaConfig.cmake.in @@ -52,12 +52,15 @@ macro(atdna out) # OSX Extra elseif(APPLE) + get_filename_component(COMPILER_DIR "${CMAKE_CXX_COMPILER}" DIRECTORY) if (NOT EXISTS "${CMAKE_OSX_SYSROOT}") message(FATAL_ERROR "CMAKE_OSX_SYSROOT not set") endif() - list(APPEND extraargs -isysroot ${CMAKE_OSX_SYSROOT} -isysroot ${CMAKE_OSX_SYSROOT}/usr/include - -I ${CMAKE_OSX_SYSROOT}/../../../../../Toolchains/XcodeDefault.xctoolchain - -I ${CMAKE_OSX_SYSROOT}/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1) + list(APPEND extraargs + -isysroot ${CMAKE_OSX_SYSROOT} + -isysroot ${CMAKE_OSX_SYSROOT}/usr/include + -I ${COMPILER_DIR}/../.. + -I ${COMPILER_DIR}/../include/c++/v1) endif() # Make target