CMakeLists.txt 906 B

1234567891011121314151617181920212223242526272829303132
  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. endif()
  17. # add the executable
  18. add_executable(Tutorial tutorial.cxx)
  19. target_link_libraries(Tutorial PUBLIC ${EXTRA_LIBS})
  20. # add the binary tree to the search path for include files
  21. # so that we will find TutorialConfig.h
  22. target_include_directories(Tutorial PUBLIC
  23. "${PROJECT_BINARY_DIR}"
  24. )