CMakeLists.txt 713 B

12345678910111213141516171819202122
  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. # does this system provide the log and exp functions?
  8. include(CheckSymbolExists)
  9. set(CMAKE_REQUIRED_LIBRARIES "m")
  10. check_symbol_exists(log "math.h" HAVE_LOG)
  11. check_symbol_exists(exp "math.h" HAVE_EXP)
  12. if(HAVE_LOG AND HAVE_EXP)
  13. target_compile_definitions(MathFunctions
  14. PRIVATE "HAVE_LOG" "HAVE_EXP")
  15. endif()
  16. # install rules
  17. install(TARGETS MathFunctions DESTINATION lib)
  18. install(FILES MathFunctions.h DESTINATION include)