1
0

CMakeLists.txt 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. cmake_minimum_required(VERSION 3.23)
  2. # TODO9: Add a VERSION parameter to the project() command for version 1.0.0
  3. project(Tutorial)
  4. option(TUTORIAL_BUILD_UTILITIES "Build the Tutorial executable" ON)
  5. option(TUTORIAL_USE_STD_SQRT "Use std::sqrt" OFF)
  6. option(TUTORIAL_ENABLE_IPO "Check for and use IPO support" ON)
  7. option(BUILD_TESTING "Enable testing and build tests" ON)
  8. if(TUTORIAL_ENABLE_IPO)
  9. include(CheckIPOSupported)
  10. check_ipo_supported(RESULT result OUTPUT output)
  11. if(result)
  12. message("IPO is supported, enabling IPO")
  13. set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
  14. else()
  15. message(WARNING "IPO is not supported: ${output}")
  16. endif()
  17. endif()
  18. if(TUTORIAL_BUILD_UTILITIES)
  19. add_subdirectory(Tutorial)
  20. # TODO1: Install the Tutorial target
  21. # TODO3: Add the Tutorial target to the TutorialTargets export
  22. endif()
  23. if(BUILD_TESTING)
  24. enable_testing()
  25. add_subdirectory(Tests)
  26. endif()
  27. add_subdirectory(MathFunctions)
  28. # TODO4: Include the GNUInstallDirs module
  29. # TODO2: Install the MathFunctions, OpAdd, OpMul, OpSub, SqrtTable, and
  30. # MathLogger targets. Ensure you name their header file set so the
  31. # headers will be installed.
  32. # TODO5: Add the targets from TODO2 to the TutorialTargets export
  33. # TODO6: Install the TutorialTargets export to:
  34. # ${CMAKE_INSTALL_LIBDIR}/cmake/Tutorial
  35. # And give them a namespace of "Tutorial::"
  36. # TODO10: Include CMakePackageConfigHelpers
  37. # TODO11: Use write_basic_package_version_file to write a
  38. # TutorialConfigVersion.cmake file to the CMAKE_CURRENT_BINARY_DIR.
  39. # The version compatibility should be ExactVersion.
  40. # TODO12: Add the generated TutorialConfigVersion.cmake file to the file list
  41. # of the TODO7 install() command.
  42. # TODO7: Install the config file at cmake/TutorialConfig.cmake to the same
  43. # destination as the TutorialTargets export.