This example shows a C program compilation and run using a CMake.
You should have a compiler installed. Ubuntu Linux:
sudo apt-get install cmake
Open a terminal and type:
sh run.sh
A typical output should look like this one.
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/javier/03-code/parallel-code-examples/01-compiling/04-cmake/build
Scanning dependencies of target application
[100%] Building C object CMakeFiles/application.dir/main.c.o
Linking C executable application
[100%] Built target application
Hello there !
The oficial documentation for CMake.