CMakeLists.txt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. cmake_minimum_required(VERSION 3.10)
  2. # set the project name and version
  3. project(Tutorial VERSION 1.0)
  4. # specify the C++ standard
  5. set(CMAKE_CXX_STANDARD 11)
  6. set(CMAKE_CXX_STANDARD_REQUIRED True)
  7. # should we use our own math functions
  8. option(USE_MYMATH "Use tutorial provided math implementation" ON)
  9. # configure a header file to pass some of the CMake settings
  10. # to the source code
  11. configure_file(TutorialConfig.h.in TutorialConfig.h)
  12. # TODO 2: Remove EXTRA_INCLUDES list
  13. # add the MathFunctions library
  14. if(USE_MYMATH)
  15. add_subdirectory(MathFunctions)
  16. list(APPEND EXTRA_LIBS MathFunctions)
  17. list(APPEND EXTRA_INCLUDES "${PROJECT_SOURCE_DIR}/MathFunctions")
  18. endif()
  19. # add the executable
  20. add_executable(Tutorial tutorial.cxx)
  21. target_link_libraries(Tutorial PUBLIC ${EXTRA_LIBS})
  22. # TODO 3: Remove use of EXTRA_INCLUDES
  23. # add the binary tree to the search path for include files
  24. # so that we will find TutorialConfig.h
  25. target_include_directories(Tutorial PUBLIC
  26. "${PROJECT_BINARY_DIR}"
  27. ${EXTRA_INCLUDES}
  28. )