CMakeLists.txt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. add_library(MathFunctions mysqrt.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. # link our compiler flags interface library
  8. target_link_libraries(MathFunctions tutorial_compiler_flags)
  9. # TODO 1: Include CheckCXXSourceCompiles
  10. # TODO 2: Use check_cxx_source_compiles with simple C++ code to verify
  11. # availability of:
  12. # * std::log
  13. # * std::exp
  14. # Store the results in HAVE_LOG and HAVE_EXP respectively.
  15. # Hint: Sample C++ code which uses log:
  16. # #include <cmath>
  17. # int main() {
  18. # std::log(1.0);
  19. # return 0;
  20. # }
  21. # TODO 3: Conditionally on HAVE_LOG and HAVE_EXP, add private compile
  22. # definitions "HAVE_LOG" and "HAVE_EXP" to the MathFunctions target.
  23. #Hint: Use target_compile_definitions()
  24. # install libs
  25. set(installable_libs MathFunctions tutorial_compiler_flags)
  26. install(TARGETS ${installable_libs} DESTINATION lib)
  27. # install include headers
  28. install(FILES MathFunctions.h DESTINATION include)