CMakeLists.txt 982 B

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