AddLibBacktrace.cmake 1.2 KB

123456789101112131415161718192021222324252627282930
  1. # Creates a target LibBacktrace that you can link to
  2. # and adds this project as an external one.
  3. # It will install to:
  4. # ${PROJECT_SOURCE_DIR}/external/LibBackTrace/install
  5. if (KS_PLAT_WIN)
  6. message(FATAL "LibBackTrace is only available on Gnu platforms")
  7. endif()
  8. include(ExternalProject)
  9. find_package(Git REQUIRED)
  10. ExternalProject_Add(
  11. Project_LibBacktrace
  12. PREFIX ${PROJECT_SOURCE_DIR}/external/LibBacktrace
  13. GIT_REPOSITORY https://github.com/ianlancetaylor/libbacktrace
  14. TIMEOUT 10
  15. UPDATE_COMMAND ""
  16. CONFIGURE_COMMAND ${PROJECT_SOURCE_DIR}/external/LibBacktrace/src/Project_LibBacktrace/configure --enable-host-shared --prefix=${PROJECT_SOURCE_DIR}/external/LibBacktrace/install --enable-shared=no --enable-static=yes
  17. BUILD_COMMAND make
  18. INSTALL_COMMAND make install
  19. BUILD_IN_SOURCE 1
  20. )
  21. # Not done yet we have to make a target that is depndent on this so we can use it easily
  22. add_library(LibBacktrace STATIC IMPORTED GLOBAL)
  23. set_target_properties(LibBacktrace PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/external/LibBacktrace/install/lib/libbacktrace.a")
  24. set_target_properties(LibBacktrace PROPERTIES INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/external/LibBacktrace/install/include")
  25. add_dependencies(LibBacktrace Project_LibBacktrace)