Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagecpp
linenumberstrue
cmake_minimum_required(VERSION 3.16)
project(Calculator)

set(CMAKE_CXX_STANDARD 11)

include_directories(src)
add_subdirectory(src)

enable_testing()
add_subdirectory(tst)

This is a simple setup for CMake builds, however it's important to get it right. At the beginning there are very basic lines that tell you the minimum CMake version required, the project name and the C++ standard used. Then the src directory is included and added. Next comes a very important line that enables testing and finally adds the tst directory as a subdirectory.