brbass / cmake_example

A minimal CMake example with a single CMakeLists file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Usually multiple CMakeLists files would be used, with one for each directory. For this project, only one CMakeLists file is included in the base directory for simplicity.

The directory structure is as follows:
    src: all the source files for the project but no files with the "main" function
    main: includes a file with the function "main" to be made into an executable
    test: includes one or more files with the function "main" to be made into tests

To build this example, do the following from the directory containing the CMakeLists file:
   mkdir build;
   cd build;
   cmake ..;
   make install;

To run the tests, stay in the "build" directory and run:
   ctest;

The executables and libraries will be installed into the "bin" directory. This lets you build test code multiple times but keep a working copy in the "bin" directory.

About

A minimal CMake example with a single CMakeLists file


Languages

Language:CMake 65.5%Language:C++ 34.5%