libunwind_linux.cmake 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. #
  2. # Copyright (c) Contributors to the Open 3D Engine Project.
  3. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. #
  5. # SPDX-License-Identifier: Apache-2.0 OR MIT
  6. #
  7. #
  8. # Use system default unwind library instead of maintaining an O3DE version for Linux
  9. find_package(PkgConfig REQUIRED)
  10. # ask pkg-config to find the libunwind library and prepare an imported target
  11. pkg_check_modules(libunwind IMPORTED_TARGET libunwind)
  12. if (NOT TARGET PkgConfig::libunwind)
  13. message(FATAL_ERROR "Compiling on linux requires the unwind development libraries and headers as well as pkg-config. Try using your package manager to install the libunwind-dev libraries.")
  14. else()
  15. add_library(3rdParty::unwind ALIAS PkgConfig::libunwind)
  16. set_target_properties(PkgConfig::libunwind
  17. PROPERTIES
  18. LY_SYSTEM_LIBRARY TRUE)
  19. # include Install.cmake to get access to the ly_install function
  20. include(cmake/Install.cmake)
  21. # Copies over the libunwind_linux.cmake to the same location in the SDK layout.
  22. cmake_path(RELATIVE_PATH CMAKE_CURRENT_LIST_DIR BASE_DIRECTORY ${LY_ROOT_FOLDER} OUTPUT_VARIABLE libunwind_linux_cmake_rel_directory)
  23. ly_install(FILES "${CMAKE_CURRENT_LIST_FILE}"
  24. DESTINATION "${libunwind_linux_cmake_rel_directory}"
  25. COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
  26. )
  27. endif()