CMakeLists.txt 850 B

123456789101112131415161718192021222324252627282930
  1. # create library
  2. add_library(SquareRoot STATIC SquareRoot.cxx)
  3. add_library(MathFunctions::SquareRoot ALIAS SquareRoot)
  4. # add include directories
  5. target_include_directories(SquareRoot
  6. PUBLIC
  7. "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
  8. "$<INSTALL_INTERFACE:include>"
  9. )
  10. # install the target and create export-set
  11. install(TARGETS SquareRoot
  12. EXPORT SquareRootTargets
  13. LIBRARY DESTINATION lib
  14. ARCHIVE DESTINATION lib
  15. RUNTIME DESTINATION bin
  16. INCLUDES DESTINATION include
  17. )
  18. # install header file
  19. install(FILES SquareRoot.h DESTINATION include)
  20. # generate and install export file
  21. install(EXPORT SquareRootTargets
  22. FILE MathFunctionsSquareRootTargets.cmake
  23. NAMESPACE MathFunctions::
  24. DESTINATION lib/cmake
  25. )