CMakeLists.txt 1.0 KB

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