This MR tries to resolve #2256 (closed), which itself is caused by a design decision by the CMAKE devs to always unwrap /usr/bin/cc
to <SYSROOT>/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
(https://gitlab.kitware.com/cmake/cmake/-/commit/1f085e11e40a20f8e8702da7920e950e47deb27c), the effect of this is that the SYSROOT path is lost, and must now be manually specified with -sysroot ...
. This rational behind this was due to a lacking convention with XCode in both install location and which tools needed to have the SYSROOT specified (additionally, there was some concern about XCode upgrades as well, which could break existing configured projects). As of MacOS Catalina (XCode 11ish) this issue is solved, CC/C++ always set the current SYSROOT of the activated XCode. In future releases of CMAKE it is possible that they will do away with this de-wrapping, see https://gitlab.kitware.com/cmake/cmake/-/issues/19180.
In short, when building on MacOS/Darwin-based system, we default to using /usr/bin/cc
//usr/bin/c++
when build sac2c. This can be override as standard by setting ENV CC and CXX, or CMAKE's -DCMAKE_<LANG>_COMPILER
flag. We also no longer store any SYSROOT in the sac2crc file.
With this a packaged version of the compiler should now run on any MacOS system, regardless of XCode version/location.
Additionally this MR does:
- re-did documentation in
utils/str.c
and updated the unit-tests a bit; addSTRstrip
function to remove space chars from front and back of string.