libzstd_linux.cmake 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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 zstd library instead of maintaining an O3DE version for Linux
  9. find_package(PkgConfig REQUIRED)
  10. # ask pkg-config to find the libzstd library and prepare an imported target
  11. pkg_check_modules(zstd IMPORTED_TARGET libzstd)
  12. if (NOT TARGET PkgConfig::zstd)
  13. message(FATAL_ERROR "Compiling on linux requires the zstd development libraries and headers as well as pkg-config. Try using your package manager to install the libzstd-dev libraries.")
  14. else()
  15. add_library(3rdParty::zstd ALIAS PkgConfig::zstd)
  16. set_target_properties(PkgConfig::zstd
  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 libzstd_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 libzstd_linux_cmake_rel_directory)
  23. ly_install(FILES "${CMAKE_CURRENT_LIST_FILE}"
  24. DESTINATION "${libzstd_linux_cmake_rel_directory}"
  25. COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
  26. )
  27. endif()