CMakeLists.txt 922 B

1234567891011121314151617181920212223242526
  1. # create the MathFunctions library
  2. add_library(MathFunctions MathFunctions.cxx)
  3. # state that anybody linking to us needs to include the current source dir
  4. # to find MathFunctions.h, while we don't.
  5. target_include_directories(MathFunctions
  6. INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
  7. )
  8. # should we use our own math functions
  9. option(USE_MYMATH "Use tutorial provided math implementation" ON)
  10. if (USE_MYMATH)
  11. target_compile_definitions(MathFunctions PRIVATE "USE_MYMATH")
  12. # library that just does sqrt
  13. add_library(SqrtLibrary STATIC
  14. mysqrt.cxx
  15. )
  16. # link our compiler flags interface library
  17. target_link_libraries(SqrtLibrary PUBLIC tutorial_compiler_flags)
  18. target_link_libraries(MathFunctions PUBLIC SqrtLibrary)
  19. endif()
  20. # link our compiler flags interface library
  21. target_link_libraries(MathFunctions PUBLIC tutorial_compiler_flags)