如何设置CMAKE_C_COMPILER和CMAKE_CXX_COMPILER来构建Assimp for iOS? [英] How do you set CMAKE_C_COMPILER and CMAKE_CXX_COMPILER for building Assimp for iOS?
问题描述
当我尝试通过运行 build_ios.sh
来创建Assimp时,它告诉我:
CMake错误:您的C编译器:/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc未找到。请将CMAKE_C_COMPILER设置为有效的编译器路径或名称。
CMake错误:您的CXX编译器:找不到/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++。请将CMAKE_CXX_COMPILER设置为有效的编译器路径或名称。
我需要的路径是:
/Applications/XCode.app/Contents/Developer/Platforms / ...
我已尝试更改 build_ios.sh
和中的
,因为这是 DEVROOT
IPHONE_xxxx_TOOLCHAIN.cmake CMAKE_C_COMPILER
等似乎生成的,但它仍然给我相同的错误。
选项1:
命令行如下:
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
请参阅此学习如何创建CMake缓存条目。
选项2:
$ b
您可以在您的shell脚本 build_ios.sh
中设置环境变量 CC
code> 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 / code>或
enable_language()
命令)
(CMAKE_C_COMPILER/ path / to / your / c / compiler / executable)
set(CMAKE_CXX_COMPILER/ path / to / your / cpp / compiler / executable)
请参阅 this ,了解如何在CMake中使用 set
命令。此外,此是了解一些常见CMake变量的有用资源。
这是官方FAQ中的相关条目: http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F
When I try to build Assimp by running build_ios.sh
, it tells me:
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.
What I need the path to be is:
/Applications/XCode.app/Contents/Developer/Platforms/...
I've tried changing DEVROOT
in build_ios.sh
and IPHONE_xxxx_TOOLCHAIN.cmake
, because that's what CMAKE_C_COMPILER
etc seem to get generated from, but it still gives me the same errors.
Option 1:
You can set CMake variables at command line like this:
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
See this to learn how to create a CMake cache entry.
Option 2:
In your shell script build_ios.sh
you can set environment variables CC
and CXX
to point to your C and C++ compiler executable respectively, example:
export CC=/path/to/your/c/compiler/executable
export CXX=/path/to/your/cpp/compiler/executable
cmake /path/to/directory/containing/CMakeLists.txt
Option 3:
Edit the CMakeLists.txt file of "Assimp": Add these lines at the top (must be added before you use project()
or enable_language()
command)
set(CMAKE_C_COMPILER "/path/to/your/c/compiler/executable")
set(CMAKE_CXX_COMPILER "/path/to/your/cpp/compiler/executable")
See this to learn how to use set
command in CMake. Also this is a useful resource for understanding use of some of the common CMake variables.
Here is the relevant entry from the official FAQ: http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F
这篇关于如何设置CMAKE_C_COMPILER和CMAKE_CXX_COMPILER来构建Assimp for iOS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!