你如何设置CMAKE_C_COMPILER和CMAKE_CXX_COMPILER为iOS构buildAssimp?
当我尝试通过运行build_ios.sh
来构buildbuild_ios.sh
,它告诉我:
CMake Error: your C compiler: "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name. CMake Error: your CXX compiler: "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
我需要的path是:
/Applications/XCode.app/Contents/Developer/Platforms/...
我已经尝试更改DEVROOT
和IPHONE_xxxx_TOOLCHAIN.cmake
,因为这是CMAKE_C_COMPILER
等似乎生成的,但它仍然给我相同的错误。
选项1:
你可以像这样在命令行设置CMakevariables:
cmake -D CMAKE_C_COMPILER="/path/to/your/c/compiler/executable" -D CMAKE_CXX_COMPILER "/path/to/your/cpp/compiler/executable" /path/to/directory/containing/CMakeLists.txt
看到这个来学习如何创build一个CMakecaching条目。
选项2:
在您的shell脚本build_ios.sh
您可以将环境variablesCC
和CXX
分别指向您的C和C ++编译器可执行文件,例如:
export CC=/path/to/your/c/compiler/executable export CXX=/path/to/your/cpp/compiler/executable cmake /path/to/directory/containing/CMakeLists.txt
备选案文3:
编辑“Assimp”的CMakeLists.txt文件:在顶部添加这些行(必须在使用project()
或enable_language()
命令之前添加)
set(CMAKE_C_COMPILER "/path/to/your/c/compiler/executable") set(CMAKE_CXX_COMPILER "/path/to/your/cpp/compiler/executable")
看到这个来学习如何在CMake中使用set
命令。 这也是理解一些常见CMakevariables使用的有用资源。
以下是官方FAQ的相关条目: http : //www.cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F
cc和cxx位于/Applications/Xcode.app
。 这应该find正确的path
export CXX=`xcrun -find c++` export CC=`xcrun -find cc`