CMakeLists.txt 1012 B

12345678910111213141516171819202122232425262728293031323334
  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. # add the MathFunctions library?
  13. if(USE_MYMATH)
  14. add_subdirectory(MathFunctions)
  15. list(APPEND EXTRA_LIBS MathFunctions)
  16. list(APPEND EXTRA_INCLUDES "${PROJECT_SOURCE_DIR}/MathFunctions")
  17. endif()
  18. # add the executable
  19. add_executable(Tutorial tutorial.cxx)
  20. target_link_libraries(Tutorial ${EXTRA_LIBS})
  21. # add the binary tree to the search path for include files
  22. # so that we will find TutorialConfig.h
  23. target_include_directories(Tutorial PUBLIC
  24. "${PROJECT_BINARY_DIR}"
  25. ${EXTRA_INCLUDES}
  26. )