FPchecker - CMakeLists.txt
Code
cmake_minimum_required(VERSION 3.11)
set(CMAKE_CXX_COMPILER "/home/xinyi/llvm/llvm10/bin/clang++")
set(CMAKE_C_COMPILER "/home/xinyi/llvm/llvm10/bin/clang")
project(fpchecker VERSION 0.2.0 DESCRIPTION "FPChecker" LANGUAGES CXX C)
execute_process(COMMAND /home/xinyi/llvm/llvm10/bin/llvm-config --ldflags
OUTPUT_VARIABLE CMAKE_SHARED_LINKER_FLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND /home/xinyi/llvm/llvm10/bin/llvm-config --cxxflags
OUTPUT_VARIABLE CMAKE_CXX_FLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND /home/xinyi/llvm/llvm10/bin/llvm-config --cppflags
OUTPUT_VARIABLE CMAKE_CPP_FLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
...
Reason
Since we used the llvm installed in our home directory (LLVM - installation), we need to specify the compiler and the path for this llvm.
A better way is to use export as Cmake > Specify compiler shows. However, here we modify the CMakeLists.txt
.
Issue
Use absolute path
When specify the path for compiler and llvm-config, we need to use absolute path /home/xinyi..
, or it cannot find the path. The reason see CMake -- path.