CMakeLists.txt 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
  13. else()
  14. message(WARNING "IPO is not supported ${message}")
  15. endif()
  16. endif()
  17. if(TUTORIAL_BUILD_UTILITIES)
  18. add_subdirectory(Tutorial)
  19. # TODO1: Install the Tutorial target
  20. # TODO3: Add the Tutorial target to the TutorialTargets export
  21. endif()
  22. if(BUILD_TESTING)
  23. enable_testing()
  24. add_subdirectory(Tests)
  25. endif()
  26. add_subdirectory(MathFunctions)
  27. # TODO4: Include the GNUInstallDirs module
  28. # TODO2: Install the MathFunctions, OpAdd, OpMul, OpSub, SqrtTable, and
  29. # MathLogger targets. Ensure you name their header file set so the
  30. # headers will be installed.
  31. # TODO5: Add the targets from TODO2 to the TutorialTargets export
  32. # TODO6: Install the TutorialTargets export to:
  33. # ${CMAKE_INSTALL_LIBDIR}/cmake/Tutorial
  34. # And give them a namespace of "Tutorial::"
  35. # TODO10: Include CMakePackageConfigHelpers
  36. # TODO11: Use write_basic_package_version_file to write a
  37. # TutorialConfigVersion.cmake file to the CMAKE_CURRENT_BINARY_DIR.
  38. # The version compatibility should be ExactVersion.
  39. # TODO12: Add the generated TutorialConfigVersion.cmake file to the file list
  40. # of the TODO7 install() command.
  41. # TODO7: Install the config file at cmake/TutorialConfig.cmake to the same
  42. # destination as the TutorialTargets export.