Created
May 25, 2025 19:12
-
-
Save matlabbe/abd0242305c29495bbba26065269daf2 to your computer and use it in GitHub Desktop.
lz4-ios
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required(VERSION 3.5) | |
| project(lz4) | |
| IF(${CMAKE_GENERATOR} MATCHES ".*Makefiles") | |
| IF("${CMAKE_BUILD_TYPE}" STREQUAL "") | |
| set(CMAKE_BUILD_TYPE Release) | |
| ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") | |
| ENDIF(${CMAKE_GENERATOR} MATCHES ".*Makefiles") | |
| OPTION( BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON ) | |
| include(CheckCXXCompilerFlag) | |
| CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17) | |
| IF(COMPILER_SUPPORTS_CXX17) | |
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") | |
| set(CMAKE_CXX_STANDARD 17) | |
| ELSE() | |
| message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support.") | |
| ENDIF() | |
| include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib) | |
| file(GLOB lib_srcs ${CMAKE_CURRENT_SOURCE_DIR}/lib/*.c) | |
| add_library(lz4 ${lib_srcs}) | |
| set(LZ4_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include) | |
| if(${BUILD_SHARED_LIBS}) | |
| set(LZ4_LIBRARIES ${CMAKE_INSTALL_PREFIX}/lib/liblz4.so) | |
| else() | |
| set(LZ4_LIBRARIES ${CMAKE_INSTALL_PREFIX}/lib/liblz4.a) | |
| endif() | |
| configure_file(${CMAKE_SOURCE_DIR}/LZ4Config.cmake.in | |
| ${CMAKE_BINARY_DIR}/LZ4Config.cmake @ONLY) | |
| file(GLOB lib_headers ${CMAKE_CURRENT_SOURCE_DIR}/lib/*.h) | |
| install(FILES ${lib_headers} DESTINATION include) | |
| install( | |
| FILES | |
| "${CMAKE_CURRENT_BINARY_DIR}/LZ4Config.cmake" | |
| DESTINATION | |
| lib/${PROJECT_NAME} | |
| ) | |
| install(TARGETS lz4 | |
| RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" | |
| LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" | |
| ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set(LZ4_INCLUDE_DIRS @LZ4_INCLUDE_DIRS@) | |
| set(LZ4_LIBRARIES @LZ4_LIBRARIES@) | |
| set(LZ4_LINK_LIBRARIES @LZ4_LIBRARIES@) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment