【Linux】cmake编译指定 gcc/g++

1. 编译前设置环境变量

export CC=/usr/local/bin/gcc
export CXX=/usr/local/bin/g++
cmake /path/to/your/project
make

2. 在cmake文件中设置,打开文件CMakeLists.txt

set(CMAKE_C_COMPILER "afl-gcc")
set(CMAKE_CXX_COMPILER "afl-g++")
//退出文件 cmake /path/to/your/project make

你可能感兴趣的:(linux,cmake,java,ubuntu,shell)