CMakeLists.txt 874 B

123456789101112131415161718192021222324252627282930
  1. cmake_minimum_required(VERSION 3.23)
  2. project(Tutorial)
  3. option(TUTORIAL_BUILD_UTILITIES "Build the Tutorial executable" ON)
  4. option(TUTORIAL_USE_STD_SQRT "Use std::sqrt" OFF)
  5. option(TUTORIAL_ENABLE_IPO "Check for and use IPO support" ON)
  6. # TODO6: Add a default-ON option named BUILD_TESTING with a doc string of:
  7. # "Enable testing and build tests"
  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. endif()
  21. # TODO7: Conditional on the value of BUILD_TESTING, enable testing and add the
  22. # Tests subdirectory to the project
  23. add_subdirectory(MathFunctions)