I am trying to compile my project on Snow Leopard using the same CMakeLists.txt file that I had on Leopard, however the compilation fails with the following error message:
Linking C executable cmTryCompileExec
"/Applications/CMake 2.6-4.app/Contents/bin/cmake" -E cmake_link_script
CMakeFiles/cmTryCompileExec.dir/link.txt --verbose=1
/Developer/usr/bin/gcc -Wl,-search_paths_first -headerpad_max_install_names
-fPIC CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -o cmTryCompileExec
ld: library not found for -lcrt1.10.5.o
collect2: ld returned 1 exit status
make[1]: *** [cmTryCompileExec] Error 1
It seems that the default behavior for cmake is to compile universal binaries on MACOSX, however Snow Leopard no longer supports universal binaries, and hence we get the above error. Is there a way to disable linking to -lcrt1.10.5.o when using cmake on a Mac to generate only Intel binaries?
Best Answer
Another temporary workaround is to pass the following to CMake:
This tells GCC to compile 32-bit binaries and doesn't require compiling ppc binaries too like the above.