Cmake模板,动态链接,lib64v0p7_xthead

正常情况下编译的程序不能直接运行,还得手动ln一些库,而且ln的库,这多多少少会可能出问题,还是用正确的cmake方法吧。

make.sh

TEMP_PATH=/home/kilo/Downloads/duo-buildroot-sdk/host-tools/gcc/riscv64-linux-musl-x86_64/bin
TEMP_TOOL=${TEMP_PATH}/riscv64-unknown-linux-musl-

export CC=${TEMP_TOOL}gcc
export CXX=${TEMP_TOOL}g++
echo $CC
cd build
cmake ..
make

CMakeLists.txt

cmake_minimum_required(VERSION 3.1.3)
#RV64IMA[F][D]C[V]
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=rv64imafdc_v0p7_zfh_zvamo0p7_zvlsseg0p7_xtheadc -mabi=lp64d -mcmodel=medany")
project(helloworld 
VERSION 0.1 
LANGUAGES CXX)
add_executable(helloworld main.cpp sub.cpp add.cpp)
1 Like