CMakeLists.txt 1.1 KB

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