mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-26 16:49:03 +08:00
e03ee9cace
* [ceres, zziplib] fixes for building on non-windows systems * [jxrlib, zziplib] other fixes for non-windows systems * [zziplib] fix CMakeLists.txt for non win32 platforms, there were missing exported headers * [ceres] Fix targets path * [ceres] Fix typo * [ceres] trigger CI build * [ceres] use proper glog/gflags targets
95 lines
2.6 KiB
CMake
95 lines
2.6 KiB
CMake
cmake_minimum_required(VERSION 3.0)
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
project(zziplib C)
|
|
|
|
find_package(zlib)
|
|
|
|
include_directories(${ZLIB_INCLUDE_DIRS})
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
if(MSVC)
|
|
set(CMAKE_DEBUG_POSTFIX "d")
|
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
|
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
|
endif()
|
|
|
|
if(UNIX)
|
|
message(STATUS "Running ${SHELL_EXECUTABLE} ./configure --prefix=${CMAKE_CURRENT_SOURCE_DIR}/")
|
|
add_custom_target(
|
|
zziplib_autotools
|
|
${SHELL_EXECUTABLE} ./configure --prefix=${CMAKE_CURRENT_SOURCE_DIR}/
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
)
|
|
message(STATUS "Autotools should have finished their job")
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/x86_64-pc-linux-gnu/zzip)
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/x86_64-pc-linux-gnu)
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/x86_64-apple-darwin18.2.0/zzip)
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/x86_64-apple-darwin18.2.0)
|
|
endif()
|
|
|
|
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
|
|
|
# List the header files
|
|
set(HEADERS zzip/__debug.h
|
|
zzip/__dirent.h
|
|
zzip/__fnmatch.h
|
|
zzip/__hints.h
|
|
zzip/__mmap.h
|
|
zzip/_msvc.h
|
|
zzip/autoconf.h
|
|
zzip/conf.h
|
|
zzip/fetch.h
|
|
zzip/file.h
|
|
zzip/format.h
|
|
zzip/fseeko.h
|
|
zzip/info.h
|
|
zzip/lib.h
|
|
zzip/memdisk.h
|
|
zzip/mmapped.h
|
|
zzip/plugin.h
|
|
zzip/stdint.h
|
|
zzip/types.h
|
|
zzip/write.h
|
|
zzip/zzip.h
|
|
)
|
|
if(UNIX)
|
|
file(GLOB OTHER_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/x86_64-pc-linux-gnu/zzip/*.h)
|
|
list(APPEND HEADERS ${OTHER_HEADERS})
|
|
file(GLOB OTHER_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/x86_64-apple-darwin18.2.0/zzip/*.h)
|
|
list(APPEND HEADERS ${OTHER_HEADERS})
|
|
else()
|
|
list(APPEND HEADERS zzip/_msvc.h)
|
|
endif()
|
|
|
|
# List the source files
|
|
set(SRCS zzip/dir.c
|
|
zzip/err.c
|
|
zzip/fetch.c
|
|
zzip/file.c
|
|
zzip/info.c
|
|
zzip/plugin.c
|
|
zzip/stat.c
|
|
zzip/zip.c
|
|
)
|
|
|
|
add_library(zziplib ${SRCS} ${HEADERS})
|
|
if(UNIX)
|
|
add_dependencies(zziplib zziplib_autotools)
|
|
endif()
|
|
|
|
if(BUILD_SHARED_LIBS)
|
|
target_compile_definitions(zziplib PRIVATE -DZZIPLIB_EXPORTS)
|
|
endif()
|
|
|
|
target_link_libraries(zziplib ${ZLIB_LIBRARIES})
|
|
|
|
install(TARGETS zziplib
|
|
COMPONENT runtime
|
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
|
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
|
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib)
|
|
|
|
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/zzip)
|