mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] style: Add a cmake-format config file and satisfy cmake-lint
Introduce CMake file linting, based on the cmakelang project by Josh Bialkowski (@cheshirekow). Fix various style issues in the CMake files: * Add the missing copyright header to PNGConfig.cmake. * Resolve a "missing docstring" warning raised by cmake-lint. * Rewrite all docstrings in the style of CMake's own documentation. * Fix whitespace inconsistencies. References: * https://pypi.org/project/cmakelang * https://github.com/cheshirekow/cmake_format This is a cherry-pick of commit c317fe31114d92d05d44bf98c9b559edf4656b9c from branch 'libpng18'.
This commit is contained in:
@@ -1,15 +1,28 @@
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
find_dependency(ZLIB REQUIRED)
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/PNGTargets.cmake")
|
||||
|
||||
if(NOT TARGET PNG::PNG)
|
||||
if(TARGET PNG::png_shared)
|
||||
add_library(PNG::PNG INTERFACE IMPORTED)
|
||||
target_link_libraries(PNG::PNG INTERFACE PNG::png_shared)
|
||||
elseif(TARGET PNG::png_static)
|
||||
add_library(PNG::PNG INTERFACE IMPORTED)
|
||||
target_link_libraries(PNG::PNG INTERFACE PNG::png_static)
|
||||
endif()
|
||||
endif()
|
||||
# PNGConfig.cmake
|
||||
# CMake config file compatible with the FindPNG module.
|
||||
|
||||
# Copyright (c) 2024 Cosmin Truta
|
||||
# Written by Benjamin Buch, 2024
|
||||
#
|
||||
# Use, modification and distribution are subject to
|
||||
# the same licensing terms and conditions as libpng.
|
||||
# Please see the copyright notice in png.h or visit
|
||||
# http://libpng.org/pub/png/src/libpng-LICENSE.txt
|
||||
#
|
||||
# SPDX-License-Identifier: libpng-2.0
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
find_dependency(ZLIB REQUIRED)
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/PNGTargets.cmake")
|
||||
|
||||
if(NOT TARGET PNG::PNG)
|
||||
if(TARGET PNG::png_shared)
|
||||
add_library(PNG::PNG INTERFACE IMPORTED)
|
||||
target_link_libraries(PNG::PNG INTERFACE PNG::png_shared)
|
||||
elseif(TARGET PNG::png_static)
|
||||
add_library(PNG::PNG INTERFACE IMPORTED)
|
||||
target_link_libraries(PNG::PNG INTERFACE PNG::png_static)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user