CMakeLists.txt 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. add_library(MathFunctions MathFunctions.cxx)
  2. # state that anybody linking to us needs to include the current source dir
  3. # to find MathFunctions.h, while we don't.
  4. target_include_directories(MathFunctions
  5. INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
  6. )
  7. # should we use our own math functions
  8. option(USE_MYMATH "Use tutorial provided math implementation" ON)
  9. if (USE_MYMATH)
  10. target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH")
  11. # library that just does sqrt
  12. add_library(SqrtLibrary STATIC
  13. mysqrt.cxx
  14. )
  15. # link SqrtLibrary to tutorial_compiler_flags
  16. target_link_libraries(SqrtLibrary PUBLIC tutorial_compiler_flags)
  17. target_link_libraries(MathFunctions PRIVATE SqrtLibrary)
  18. endif()
  19. # link MathFunctions to tutorial_compiler_flags
  20. target_link_libraries(MathFunctions PUBLIC tutorial_compiler_flags)
  21. # TODO 1: Create a variable called installable_libs that is a list of all
  22. # libraries we want to install (e.g. MathFunctions and tutorial_compiler_flags)
  23. # Then install the installable libraries to the lib folder.
  24. # Hint: Use the TARGETS and DESTINATION parameters
  25. # TODO 2: Install the library headers to the include folder.
  26. # Hint: Use the FILES and DESTINATION parameters