Skip to content

Latest commit

 

History

History
12 lines (8 loc) · 638 Bytes

File metadata and controls

12 lines (8 loc) · 638 Bytes

CMake Specify Compiler

Back{: .button}

  • cmake -DCMAKE_C_COMPILER:FILEPATH=/path/to/gcc-11 -DCMAKE_CXX_COMPILER:FILEPATH=/path/to/g++-11 ..
  • export CC=/path/to/gcc-11
  • export CXX=/path/to/gcc-11
  • make <target>

Note: CMAKE_C_COMPILER should not be set in CMakeLists with set instead we pass it as an argument and get it checked in CMakeCache

See this question and this stackoverflow question