22

I use QtCreator and CMake for c++ development on a Mac, after updating to Xcode 7.0, CMake seems broken, after running CMake I got this warning:

CMake Warning at /usr/local/Cellar/cmake/HEAD/share/cmake/Modules/Platform/Darwin-Initialize.cmake:128 (message): Ignoring CMAKE_OSX_SYSROOT value:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk

because the directory does not exist. Call Stack (most recent call first): /usr/local/Cellar/cmake/HEAD/share/cmake/Modules/CMakeSystemSpecificInitialize.cmake:18 (include) CMakeLists.txt:3 (project)

and build, I got this error:

*** No rule to make target `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Accelerate.framework'

I know that Xcode 7.0 has removed MacOSX10.10.sdk and added MacOSX10.11.sdk, so I thought it might be my cmake is too old, I updated my cmake to 3.3.2 with homebrew but still doesn't work, does anyone know how to fix this? Thanks!

Community
  • 1
  • 1
Carl Yuheng Ren
  • 861
  • 6
  • 6
  • 2
    Does this happen in a clean repository that you just setup, or are you working in a dirty repository that predates the upgrade? It's possible that your `CMakeCache.txt` was configured before the upgrade and contains a reference to the old directory. If so, you can try deleting your `CMakeCache.txt` and reconfiguring. – alexgolec Sep 22 '15 at 15:31
  • hmm, thank @Alex, it was indeed the CMakeCache.txt issue, but not in my current project folder, my current project folder was a clean repo, but one of the dependency had a old CMakeCache.txt – Carl Yuheng Ren Sep 22 '15 at 15:55
  • 1
    Sounds good. I see you added your own answer, go ahead and accept it so that future visitors can see it. – alexgolec Sep 22 '15 at 15:56
  • I had to change/update the `CMAKE_OSX_SYSROOT` path. – wcochran Dec 08 '16 at 20:07

3 Answers3

62

delete any old CMakeCache.txt in current project and dependencies and rebuild solves the problem.

Carl Yuheng Ren
  • 861
  • 6
  • 6
18

If someone is using Clion you can try

Tools > CMake > Reset cache and reload project

Rishabh Deep Singh
  • 807
  • 1
  • 12
  • 24
  • 1
    Invalidating cache won't worked for me. I have to manually delete cmake output files(`cmake-build-release`, etc..) and reloaded the cmake project. – 김선달 Jan 20 '21 at 01:24
  • 1
    Invalidating caches works to solve issues with paths to compiler components, although some garbage still remain in cmake-build-* folders cached and manual deletion and re-running CMake eliminates all issues completely – Alfishe Apr 28 '21 at 14:00
6

The default value for CMAKE_OSX_SYSROOT appears to be baked into the cmake executable, and automatically added to newly-created CMakeCache.txt cache files.

So I needed to both upgrade cmake and then delete all my CMakeCache.txt files to get CMake working again.

qris
  • 7,900
  • 3
  • 44
  • 47