CMakeLists.txt 944 B

1234567891011121314151617181920212223242526272829303132333435
  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. endif(USE_MYMATH)
  20. # add the executable
  21. add_executable(Tutorial tutorial.cxx)
  22. target_link_libraries(Tutorial PUBLIC ${EXTRA_LIBS})
  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. )