vcpkg/ports/lz4/CMakeLists.txt
Stefano Sinigardi 69e86fd201 [lz4, flann] port patches from #5169 (#6294)
* [lz4, flann] port patches from #5169

* [lz4] use vcpkg_fixup_cmake_targets

* [flann] improve target handling

* [lz4] remove unnecessary debug message

* [openmvg] many many fixes to build it on windows

* [pcl] use official FLANN cmake config file instead of custom module

* [pcl] fix patch for flann targets

* [pcl] Bump CONTROL version
2019-05-18 22:58:03 -07:00

49 lines
1.6 KiB
CMake

cmake_minimum_required(VERSION 3.0)
project(lz4 C)
if(BUILD_SHARED_LIBS)
add_definitions(-DLZ4_DLL_EXPORT)
endif()
add_definitions(-DXXH_NAMESPACE=LZ4_)
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "Install prefix")
set(INSTALL_BIN_DIR "bin" CACHE PATH "Path where exe and dll will be installed")
set(INSTALL_LIB_DIR "lib" CACHE PATH "Path where lib will be installed")
set(INSTALL_INCLUDE_DIR "include" CACHE PATH "Path where headers will be installed")
set(INSTALL_CMAKE_DIR "share/lz4" CACHE PATH "Path where cmake configs will be installed")
file(GLOB LZ4_HEADERS lib/*.h)
add_library(lz4
${LZ4_HEADERS}
lib/lz4.c
lib/lz4frame.c
lib/lz4hc.c
lib/xxhash.c
)
target_include_directories(lz4 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/lib> $<INSTALL_INTERFACE:include>)
set_target_properties(lz4 PROPERTIES PUBLIC_HEADER ${LZ4_HEADERS})
install(TARGETS lz4
EXPORT lz4Config
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}"
PRIVATE_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}"
COMPONENT dev
)
FILE(GLOB lz4h "${CMAKE_CURRENT_LIST_DIR}/lib/*.h")
INSTALL(FILES ${lz4h} DESTINATION "${INSTALL_INCLUDE_DIR}")
install(EXPORT lz4Config
FILE lz4Config.cmake
NAMESPACE lz4::
DESTINATION "${INSTALL_CMAKE_DIR}"
)
# Export the package for use from the build-tree (this registers the build-tree with a global CMake-registry)
export(PACKAGE lz4)