Solution: Creating Our Professional Project
Let's see the implementation of your professional project.
We'll cover the following...
- Task 1 Solution: Specify basic project details and add the src and test directories
- Task 2 Solution: Add code for enabling test utility usage by two target groups
- Task 3 Solution: Include code that contains all necessary operations to be performed on this target
- Task 4 Solution: Add the configuration for generating Doxygen HTML documentation
- Task 5 Solution: Add the Valgrind Memcheck configuration to generate the report
- Project
Task 1 Solution: Specify basic project details and add the src
and test
directories
cmake_minimum_required(VERSION 3.25.1)project(Calc VERSION 1.0.0 LANGUAGES CXX)list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")include(NoInSourceBuilds)add_subdirectory(src bin)add_subdirectory(test)include(Install)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
: This line appends a directory path${CMAKE_SOURCE_DIR}/cmake
to theCMAKE_MODULE_PATH
variable. It's common to use this variable to specify additional paths where CMake should look for module files used in the project.include(NoInSourceBuilds)
: This line includes theNoInSourceBuilds
module. This module likely provides functionality to prevent building the project directly in the source directory, promoting out-of-source builds. It's a good practice to build CMake projects in separate build directories to keep the source directory clean.add_subdirectory(src bin)
: This line adds thesrc
andbin
directories as subdirectories to the project. This means that CMake will search forCMakeLists.txt
files in these directories and include them in the build process.add_subdirectory(test)
: This line adds thetest
directory as a subdirectory to the project. Similarly to the previous line, it includes theCMakeLists.txt
file in thetest
directory in the build process.include(Install)
: This line includes theInstall
module, which likely contains installation-related commands and configurations. This module defines what files should be installed and where during the installation process. ...