mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-14 23:07:58 +08:00
[casclib] Added CMake targets (#7522)
* Added CMake targets * Windows build failure fix * [casclib] Improve CMake find_package() integration * [casclib] Remove unused lines
This commit is contained in:
parent
883766c4cb
commit
63dd3a30fc
@ -1,22 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
project(CascLib)
|
||||
|
||||
set(HEADER_FILES
|
||||
src/CascCommon.h
|
||||
src/CascLib.h
|
||||
src/CascLib.def
|
||||
src/CascPort.h
|
||||
src/common/Array.h
|
||||
src/common/Common.h
|
||||
src/common/Csv.h
|
||||
src/common/FileStream.h
|
||||
src/common/FileTree.h
|
||||
src/common/ListFile.h
|
||||
src/common/Map.h
|
||||
src/jenkins/lookup.h
|
||||
)
|
||||
project(casclib)
|
||||
set(PROJECT_VERSION_MAJOR 1)
|
||||
set(PROJECT_VERSION_MINOR 50)
|
||||
|
||||
option(INSTALL_HEADERS "Install header files" ON)
|
||||
|
||||
set(SRC_FILES
|
||||
src/CascLib.def
|
||||
src/CascCommon.cpp
|
||||
src/CascDecompress.cpp
|
||||
src/CascDecrypt.cpp
|
||||
@ -57,18 +48,36 @@ set(ZLIB_FILES
|
||||
src/zlib/zutil.c
|
||||
)
|
||||
|
||||
add_library(casclib ${SRC_FILES} ${ZLIB_FILES} ${MD5_FILES})
|
||||
target_include_directories(casclib
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
||||
$<INSTALL_INTERFACE:include/casclib>)
|
||||
if(WIN32)
|
||||
add_definitions(-DUNICODE -D_UNICODE)
|
||||
target_compile_definitions(casclib PRIVATE UNICODE _UNICODE)
|
||||
endif()
|
||||
|
||||
add_library(CascLib ${SRC_FILES} ${HEADER_FILES} ${TOMCRYPT_FILES} ${ZLIB_FILES} ${MD5_FILES})
|
||||
install(TARGETS casclib
|
||||
EXPORT casclibTargets
|
||||
RUNTIME DESTINATION bin
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
)
|
||||
|
||||
set_target_properties(CascLib PROPERTIES PUBLIC_HEADER "src/CascLib.h;src/CascPort.h")
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
install(TARGETS CascLib
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
FRAMEWORK DESTINATION /Library/Frameworks
|
||||
PUBLIC_HEADER DESTINATION include
|
||||
INCLUDES DESTINATION include)
|
||||
set(VERSION_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/temp/casclibConfigVersion.cmake")
|
||||
set(PROJECT_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/temp/casclibConfig.cmake")
|
||||
set(INSTALL_DIR "share/casclib")
|
||||
|
||||
write_basic_package_version_file("${VERSION_CONFIG}" VERSION 1.50 COMPATIBILITY SameMajorVersion)
|
||||
configure_package_config_file("Config.cmake.in"
|
||||
"${PROJECT_CONFIG}"
|
||||
INSTALL_DESTINATION "${INSTALL_DIR}")
|
||||
|
||||
install(FILES "${PROJECT_CONFIG}" "${VERSION_CONFIG}" DESTINATION "${INSTALL_DIR}")
|
||||
install(EXPORT casclibTargets DESTINATION "${INSTALL_DIR}")
|
||||
|
||||
if(INSTALL_HEADERS)
|
||||
install(FILES "src/CascLib.h" "src/CascPort.h" DESTINATION include/casclib)
|
||||
endif()
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: casclib
|
||||
Version: 1.50
|
||||
Version: 1.50-1
|
||||
Build-Depends: zlib
|
||||
Description: An open-source implementation of library for reading CASC storage from Blizzard games since 2014
|
||||
Description: An open-source implementation of library for reading CASC storage from Blizzard games since 2014
|
||||
|
7
ports/casclib/Config.cmake.in
Normal file
7
ports/casclib/Config.cmake.in
Normal file
@ -0,0 +1,7 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(ZLIB REQUIRED)
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
|
||||
check_required_components("@PROJECT_NAME@")
|
@ -10,14 +10,24 @@ vcpkg_from_github(
|
||||
ctype_for_mac.patch
|
||||
)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
file(COPY
|
||||
${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in
|
||||
DESTINATION
|
||||
${SOURCE_PATH}
|
||||
)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS_DEBUG
|
||||
-DINSTALL_HEADERS=OFF
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/casclib RENAME copyright)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
vcpkg_fixup_cmake_targets()
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE
|
||||
DESTINATION ${CURRENT_PACKAGES_DIR}/share/casclib
|
||||
RENAME copyright)
|
||||
|
Loading…
x
Reference in New Issue
Block a user