cmake -DCMAKE_TOOLCHAIN_FILE

cmake交叉编译时提示如下错误

 cc: Can‘t specify -P, -C, -E, -c or -S with -o and have multiple files

主要是QNX需要指定-Wp,MD xxx;没有-Wp会提示如上错误。

分析可能是环境所致,可考虑使用xxx.cmake声明编译环境,然后生成makefile;cmake可以通过参数CMAKE_TOOLCHAIN_FILE指定关联对应的环境文件;

比如执行cmake -DCMAKE_TOOLCHAIN_FILE=../qnx.cmake ..

qnx.cmake

# This is required. target system name
SET(CMAKE_SYSTEM_NAME QNX)

# this one not so much
SET(CMAKE_SYSTEM_VERSION 7)

# specify the cross compiler
#SET(CMAKE_C_COMPILER $ENV{TOOLCHAIN_ROOT}/aarch64-unknown-nto-qnx7.0.0-gcc-5.4.0)
#SET(CMAKE_CXX_COMPILER $ENV{TOOLCHAIN_ROOT}/aarch64-unknown-nto-qnx7.0.0-g++-5.4.0)
SET(CMAKE_C_COMPILER $ENV{QNX_HOST}/usr/bin/qcc)
SET(CMAKE_CXX_COMPILER $ENV{QNX_HOST}/usr/bin/qcc)
set(CMAKE_C_COMPILER_TARGET gcc_ntoaarch64le)
set(CMAKE_CXX_COMPILER_TARGET gcc_ntoaarch64le)

# where is the target environment
#SET(CMAKE_FIND_ROOT_PATH /work/ipu03/svs-qnx-nda/qnx700/target/qnx7/)

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

# configure Boost and Qt
#SET(QT_QMAKE_EXECUTABLE /opt/qt-embedded/qmake)
#SET(BOOST_ROOT /opt/boost_arm)

# OPENSSL_FOUND OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES
#SET(OPENSSL_ROOT_DIR /work/usr/openssl)
#SET(OPENSSL_USE_STATIC_LIBS TRUE)

 

cmake -DCMAKE_TOOLCHAIN_FILE

上一篇:根据**查询,查不出来东西的解决思路


下一篇:gitignore使用