Configuring the project build settings for the application solution in C++

To build an application solution, specify the build settings in the CMakeLists.txt file. The CMakeLists.txt file must contain the following commands:

Before building a project in Windows, define the Boost_ROOT setting.

To configure the project build settings for the application solution in C++:

  1. Navigate to the working directory.
  2. In the working directory, create the CMakeLists.txt file.
  3. Open the created file in any text editor and specify the project build settings.

    Example of the CMakeLists.txt file

    cmake_minimum_required(VERSION 3.25)

    # digits-recognition is a project name.

    project(digits-recognition)

    set(CMAKE_CXX_STANDARD 17)

    # Runs CMake in the KNP directory and adds to the build all projects from the directory.

    add_subdirectory(KNP)

    # Adds a binary file with the source code to the main.cpp application file.

    add_executable("${PROJECT_NAME}" main.cpp)

    # Connects the framework and the single-thread CPU backend library to the digits-recognition project.

    target_link_libraries("${PROJECT_NAME}" PRIVATE KNP::BaseFramework::Core KNP::Backends::CPUSingleThreaded)

    If needed, you can load the framework dynamically.

  4. Save your changes to the CMakeLists.txt file.
Page top