thliebig / openEMS-Project

openEMS is a free and open electromagnetic field solver using the FDTD method.
356 stars 65 forks source link

Fix Homebrew SDK path build issue #115

Closed aWZHY0yQH81uOYvH closed 9 months ago

aWZHY0yQH81uOYvH commented 9 months ago

Homebrew installation stopped working for me around the time macOS Ventura was released. This seems to be a problem related to macOS SDK versions/paths not being properly passed to CMake. Homebrew provides (through its std_cmake_args) the top-level CMake with, for example, -DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk. This option is not passed through to the sub-projects since the passed-through arguments are manually specified in CMakeLists.txt:

ExternalProject_Add(QCSXCAD
    DEPENDS     CSXCAD
    SOURCE_DIR  ${PROJECT_SOURCE_DIR}/QCSXCAD
    CMAKE_ARGS  -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DCSXCAD_ROOT_DIR=${CMAKE_INSTALL_PREFIX} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
)

The cleanest solution seems to be to set CMAKE_OSX_SYSROOT using the SDKROOT environment variable, which will be picked up by all the sub-CMakes and should be equivalent.

This should fix the latest problem brought up in #108.

biergaizi commented 9 months ago

Please consider merging this PR as soon as possible. This SDK path problem is preventing the installation of openEMS on many macOS systems after upgrading to macOS 13.

thliebig commented 9 months ago

Sorry I seem to have missed this...