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
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake"): This line appends a directory path${CMAKE_SOURCE_DIR}/cmaketo theCMAKE_MODULE_PATHvariable. 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 theNoInSourceBuildsmodule. 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 thesrcandbindirectories as subdirectories to the project. This means that CMake will search forCMakeLists.txtfiles in these directories and include them in the build process.add_subdirectory(test): This line adds thetestdirectory as a subdirectory to the project. Similarly to the previous line, it includes theCMakeLists.txtfile in thetestdirectory in the build process.include(Install): This line includes theInstallmodule, which likely contains installation-related commands and configurations. This module defines what files should be installed and where during the installation process.
Task 2 Solution: Add code for enabling test utility usage by two target groups
add_subdirectory(calc): This line adds thecalcdirectory as a subdirectory to ...