[cmake-developers] cmake fails to identify C and CXX compiler when building universal

Ryan Schmidt cmake-2015 at ryandesign.com
Tue Sep 29 17:13:08 EDT 2015


On Sep 29, 2015, at 1:54 AM, Nils Gladitz wrote:

> Is it possible that beyond setting CMAKE_OSX_ARCHITECTURES the project also tries to manually add -arch flags to CFLAGS/CXXFLAGS?
> 
> The test binary produced for compiler identification with just CMAKE_OSX_ARCHITECTURES set is not a fat binary for me and identification is successful (CMake 3.3.2).
> 
> Manually adding "-arch x86_64 -arch i386" to the compiler flags breaks this since now the test binary itself is also fat.

You are correct: in addition to giving cmake the -DCMAKE_OSX_ARCHITECTURES="x86_64;i386" argument, MacPorts includes "-arch x86_64 -arch i386" in the CFLAGS, CXXFLAGS, and LDFLAGS environment variables. I am not certain, but I think the only reason why we are doing this for cmake-using ports is that we do this for all ports, and no code was ever added to override this for cmake-using ports. Perhaps this didn't cause problems before, or we never noticed it caused problems before. I will work adding code to MacPorts to remove these flags for cmake-using ports. Thanks for the suggestion.



More information about the cmake-developers mailing list