2012-07-21 26 views
12

Khi tôi cố gắng xây dựng Assimp bằng cách chạy build_ios.sh, nó nói với tôi:Làm thế nào để bạn đặt CMAKE_C_COMPILER và CMAKE_CXX_COMPILER để xây dựng Assimp cho iOS?

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. 

Những gì tôi cần đường dẫn đến được là:

/Applications/XCode.app/Contents/Developer/Platforms/... 

tôi đã cố gắng thay đổi DEVROOT trong build_ios.shIPHONE_xxxx_TOOLCHAIN.cmake, bởi vì đó là những gì CMAKE_C_COMPILER vv dường như được tạo ra từ, nhưng nó vẫn mang lại cho tôi những lỗi tương tự.

+1

bạn có tìm thấy giải pháp không? – MatterGoal

Trả lời

31

Lựa chọn 1:

Bạn có thể thiết lập các biến CMake tại dòng lệnh như thế này:

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 

Xem this để biết cách tạo một mục nhập bộ nhớ cache CMake.


Phương án 2:

Trong shell script của bạn build_ios.sh bạn có thể thiết lập các biến môi trường CCCXX để trỏ đến C và C++ biên dịch thực thi tương ứng, ví dụ:

export CC=/path/to/your/c/compiler/executable 
export CXX=/path/to/your/cpp/compiler/executable 
cmake /path/to/directory/containing/CMakeLists.txt 

Tùy chọn 3:

Chỉnh sửa các tập tin CMakeLists.txt của "Assimp": Thêm những dòng này ở phía trên (phải được bổ sung trước khi bạn sử dụng project() hoặc enable_language() lệnh)

set(CMAKE_C_COMPILER "/path/to/your/c/compiler/executable") 
set(CMAKE_CXX_COMPILER "/path/to/your/cpp/compiler/executable") 

Xem this để học cách sử dụng lệnh trong set CMake. Ngoài ra this là một tài nguyên hữu ích để hiểu việc sử dụng một số biến CMake phổ biến.


Đây là mục có liên quan từ FAQ chính thức: http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F

6

Các cc và cxx nằm bên /Applications/Xcode.app. Điều này sẽ tìm đúng đường dẫn

export CXX=`xcrun -find c++` 
export CC=`xcrun -find cc` 
Các vấn đề liên quan