Cmake settings on snow leopard

I am trying to compile my project on Snow Leopard using the same CMakeLists.txt file I had on Leopard, however compilation failed 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 like the default behavior for cmake is to compile generic binaries on MACOSX, however Snow Leopard no longer supports generic binaries and hence we get the above error. Is there a way to disable binding to -lcrt1.10.5.o when using cmake on Mac to generate only Intel binaries?

+2


source to share


2 answers


Another temporary workaround is to pass the following to CMake:

-DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32

      



This tells GCC to compile 32-bit binaries and does not require compiling the ppc binaries as described above.

+2


source


It appears to be a bug with the cmake compilation compiling the x86_64 binaries, even though CMAKE_OSX_ARCHITECTURES is set to i386.

http://public.kitware.com/Bug/view.php?id=9466



As a temporary workaround, I use

CMAKE_OSX_ARCHITECTURES = i386; ppc

+2


source







All Articles