Let us analyze in detail the contents of the various CMakeLists.txt files in this project:
- The root CMakeLists.txt file contains the familiar header:
# define minimum cmake versioncmake_minimum_required(VERSION 3.11 FATAL_ERROR)# project name and supported languageproject(recipe-05 LANGUAGES CXX)# require C++11set(CMAKE_CXX_STANDARD 11)set(CMAKE_CXX_EXTENSIONS OFF)set(CMAKE_CXX_STANDARD_REQUIRED ON)
- In this file, we also query the Python interpreter that will be used for testing:
find_package(PythonInterp REQUIRED)
- We then include the account subdirectory:
add_subdirectory(account)
- After that, we define the unit test:
# turn on testingenable_testing()# define testadd_test( NAME python_test COMMAND ${CMAKE_COMMAND} -E ...