C++ Cmake捕获不需要的包括
在mac os升级到mavericks之后,我的项目不再使用新的编译器进行编译(Clang5.1…) 因此,我按照此链接中的说明安装了一个旧的GCC4.2C++ Cmake捕获不需要的包括,c++,macos,gcc,cmake,C++,Macos,Gcc,Cmake,在mac os升级到mavericks之后,我的项目不再使用新的编译器进行编译(Clang5.1…) 因此,我按照此链接中的说明安装了一个旧的GCC4.2 然后我修改了符号链接CC和C++,指向GCC我刚刚安装了 当我运行cmake时,它现在确实找到了GCC4.2的编译器,而不是Clang5.1。但是,它仍然希望使用新xcode中的include: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Deve
然后我修改了符号链接CC和C++,指向GCC我刚刚安装了
当我运行cmake时,它现在确实找到了GCC4.2的编译器,而不是Clang5.1。但是,它仍然希望使用新xcode中的include:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/
而不是那些发现的编译器:
/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/include/gcc/darwin/4.2/
这是我的cmake的输出
-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is GNU 4.2.1
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
在cmakcache.txt上,我有以下内容
CMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/
我怎样才能摆脱那种坏习惯
谢谢。
cmake-DCMAKE\u CXX\u COMPILER=clang
和cmake-DCMAKE\u CXX\u COMPILER=clang
不符合您的需要?抱歉,我看不出有什么意义。如果我想使用gcc,为什么我要将它们设置为clang?哦,对不起,我的意思是cmake-DCMAKE\u CXX\u COMPILER=clang
和cmake-DCMAKE\u CXX\u COMPILER=gcc
。@ruslo我该如何检查它?@ruslo,是的,但结果相同。在谷歌搜索之后,我发现苹果gcc使用这些文件是正常的,如果我尝试重命名Xcode,它会抱怨说找不到Xcode。