CMakeLists.txt 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. cmake_minimum_required(VERSION 3.10)
  2. # set the project name and version
  3. project(Tutorial VERSION 1.0)
  4. # TODO 4: Replace the following code by:
  5. # * Creating an interface library called tutorial_compiler_flags
  6. # Hint: use add_library() with the INTERFACE signature
  7. # * Add compiler feature cxx_std_11 to tutorial_compiler_flags
  8. # Hint: Use target_compile_features()
  9. # specify the C++ standard
  10. set(CMAKE_CXX_STANDARD 11)
  11. set(CMAKE_CXX_STANDARD_REQUIRED True)
  12. # configure a header file to pass some of the CMake settings
  13. # to the source code
  14. configure_file(TutorialConfig.h.in TutorialConfig.h)
  15. # TODO 2: Remove EXTRA_INCLUDES list
  16. # add the MathFunctions library
  17. add_subdirectory(MathFunctions)
  18. list(APPEND EXTRA_INCLUDES "${PROJECT_SOURCE_DIR}/MathFunctions")
  19. # add the executable
  20. add_executable(Tutorial tutorial.cxx)
  21. # TODO 5: Link Tutorial to tutorial_compiler_flags
  22. target_link_libraries(Tutorial PUBLIC MathFunctions)
  23. # TODO 3: Remove use of EXTRA_INCLUDES
  24. # add the binary tree to the search path for include files
  25. # so that we will find TutorialConfig.h
  26. target_include_directories(Tutorial PUBLIC
  27. "${PROJECT_BINARY_DIR}"
  28. ${EXTRA_INCLUDES}
  29. )