11
votes

When using CMake, I noticed the output messages:

-- The C compiler identification is GNU

-- The CXX compiler identification is GNU

-- Check for working C compiler: /usr/bin/gcc

-- Check for working C compiler: /usr/bin/gcc -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Check for working CXX compiler: /usr/bin/c++

-- Check for working CXX compiler: /usr/bin/c++ -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

I am just curious about how CMake checks if the compiler works and the ABI information.

1
Probably the same as autoconf does: it starts by running many commands, in particular C compilation with some given sample input. And cmake is free software, so get its source code and study it !Basile Starynkevitch

1 Answers

9
votes

You can easily see for yourself. The code is located in CMake modules CMakeDetermineCCompiler.cmake, CMakeDetermineCompilerABI.cmake etc.

You can find these modules in your_cmake_install/share/cmake-2.8/Modules.