mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-18 17:57:49 +08:00
727bdba9a3
* [ports/inih/{portfile.cmake,vcpkg.json}] Upgrade from r51 to r56 * [ports/inih] Upgrade to latest vcpkg recommendations * [ports/inih/CMakeLists.txt] Export targets (following `ports/openctm/CMakeLists.txt` template) * Thomas1664's nitpicks agreed on by BillyONeal. * Fix vcpkg_cmake_config_fixup call and add usage. * Hook up with_INIReader * Version DB oops Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
57 lines
1.8 KiB
CMake
57 lines
1.8 KiB
CMake
cmake_minimum_required(VERSION 3.19)
|
|
project(
|
|
inih
|
|
VERSION 56
|
|
LANGUAGES C CXX)
|
|
|
|
set(Header_Files "ini.h")
|
|
set(Source_Files "ini.c")
|
|
|
|
# TODO: Put this as vcpkg-feature before `project(` so can do `LANGUAGES C` if false
|
|
option(with_INIReader "build the C++ library" OFF)
|
|
if (with_INIReader)
|
|
list(APPEND Header_Files "cpp/INIReader.h")
|
|
list(APPEND Source_Files "cpp/INIReader.cpp")
|
|
endif (with_INIReader)
|
|
|
|
add_library("${PROJECT_NAME}" "${Header_Files}" "${Source_Files}")
|
|
|
|
include(GNUInstallDirs)
|
|
target_include_directories(
|
|
"${PROJECT_NAME}"
|
|
PUBLIC
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
|
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
|
)
|
|
target_compile_features("${PROJECT_NAME}" PRIVATE c_std_90)
|
|
set_target_properties("${PROJECT_NAME}" PROPERTIES C_VISIBILITY_PRESET hidden
|
|
PUBLIC_HEADER "${Header_Files}")
|
|
|
|
install(
|
|
TARGETS "${PROJECT_NAME}"
|
|
EXPORT "unofficial-${PROJECT_NAME}Config"
|
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
|
)
|
|
|
|
include(CMakePackageConfigHelpers)
|
|
set(VERSION_FILE_PATH "${CMAKE_CURRENT_BINARY_DIR}/unofficial-${PROJECT_NAME}ConfigVersion.cmake")
|
|
write_basic_package_version_file(
|
|
"${VERSION_FILE_PATH}"
|
|
VERSION "${PROJECT_VERSION}"
|
|
COMPATIBILITY SameMajorVersion
|
|
)
|
|
install(FILES "${VERSION_FILE_PATH}" DESTINATION "share/unofficial-${PROJECT_NAME}")
|
|
|
|
install(FILES ${Header_Files} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
|
|
|
install(
|
|
EXPORT "unofficial-${PROJECT_NAME}Config"
|
|
FILE "unofficial-${PROJECT_NAME}Config.cmake"
|
|
NAMESPACE "unofficial::${PROJECT_NAME}::"
|
|
DESTINATION "share/unofficial-${PROJECT_NAME}")
|
|
|
|
export(PACKAGE "${PROJECT_NAME}")
|