CMAKE实现C和C++交叉编译,编译器路径没法更新问题
作者:互联网
cmakelists里通过set配置CMAKE_C_COMPILER,CMAKE_CXX_COMPILER编译器可生成cmake里CXX就是调用了默认的路径,没有更新过来
set(CMAKE_C_COMPILER /usr/local/arm-2014.05/bin/arm-none-linux-gnueabi-gcc)
set(CMAKE_CXX_COMPILER /usr/local/arm-2014.05/bin/arm-none-linux-gnueabi-g++)
CMAKE_C_COMPILER= /usr/local/arm-2014.05/bin/arm-none-linux-gnueabi-gcc-4.8.3
[cmake]
[cmake] -- The CXX compiler identification is GNU 7.5.0
[cmake] -- The C compiler identification is GNU 4.8.3
[cmake] -- Check for working CXX compiler: /usr/bin/c++
[cmake] -- Check for working CXX compiler: /usr/bin/c++ - works
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Check for working C compiler: /usr/local/arm-2014.05/bin/arm-none-linux-gnueabi-gcc-4.8.3
[cmake] -- Check for working C compiler: /usr/local/arm-2014.05/bin/arm-none-linux-gnueabi-gcc-4.8.3 - works
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
看网上介绍CMAKE前采用强制转换
export CC=/usr/local/arm-2014.05/bin/arm-none-linux-gnueabi-gcc
export CXX=/usr/local/arm-2014.05/bin/arm-none-linux-gnueabi-g++
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=/usr/local/arm-2014.05/bin/arm-none-linux-gnueabi-g++ ..
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/local/arm-2014.05/bin/arm-none-linux-gnueabi-gcc ..
make -j8
总算更新过来
-- The CXX compiler identification is GNU 4.8.3
-- The C compiler identification is GNU 4.8.3
-- Check for working CXX compiler: /usr/local/arm-2014.05/bin/arm-none-linux-gnueabi-g++
-- Check for working CXX compiler: /usr/local/arm-2014.05/bin/arm-none-linux-gnueabi-g++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/local/arm-2014.05/bin/arm-none-linux-gnueabi-gcc
-- Check for working C compiler: /usr/local/arm-2014.05/bin/arm-none-linux-gnueabi-gcc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
编译成功
[ 98%] Building CXX object CMakeFiles/tapp.dir/zmkzlibdata/Semaphore.cpp.o
[100%] Linking CXX executable tapp
[100%] Built target tapp
标签:CMAKE,--,C++,CXX,编译器,cmake,Detecting,arm,compiler 来源: https://www.cnblogs.com/azan777/p/15767094.html