mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
cmake: Clean up functions, string operations, regular expressions, etc.
Remove the inclusion of the external module `CMakeParseArguments`. Function argument parsing became a first-class feature in CMake 3.5. Delete the function `find_symbol_prefix`. It is no longer used. Use variables instead of strings in string operations where possible. Prevent CMake from getting confused by string values that might be accidentally identical to unrelated keywords. Clean up spurious `.*` sequences in regex matching operations. Rephrase a comment.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
# genchk.cmake.in
|
||||
# Generate .chk from .out with awk (generic), based upon the automake logic.
|
||||
|
||||
# Copyright (C) 2016 Glenn Randers-Pehrson
|
||||
# Copyright (c) 2022-2023 Cosmin Truta
|
||||
# Copyright (c) 2016 Glenn Randers-Pehrson
|
||||
# Written by Roger Leigh, 2016
|
||||
|
||||
# This code is released under the libpng license.
|
||||
@@ -21,7 +22,7 @@ get_filename_component(OUTPUTBASE "${OUTPUT}" NAME_WE)
|
||||
get_filename_component(INPUTDIR "${INPUT}" PATH)
|
||||
get_filename_component(OUTPUTDIR "${OUTPUT}" PATH)
|
||||
|
||||
if("${INPUTEXT}" STREQUAL ".out" AND "${OUTPUTEXT}" STREQUAL ".chk")
|
||||
if(INPUTEXT STREQUAL ".out" AND OUTPUTEXT STREQUAL ".chk")
|
||||
# Generate .chk from .out with awk (generic)
|
||||
file(REMOVE "${OUTPUT}" "${OUTPUTDIR}/${OUTPUTBASE}.new")
|
||||
execute_process(COMMAND "${AWK}" -f "${BINDIR}/scripts/checksym.awk"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# genout.cmake.in
|
||||
# Generate .out from .c with awk (generic), based upon the automake logic.
|
||||
|
||||
# Copyright (C) 2016 Glenn Randers-Pehrson
|
||||
# Copyright (c) 2022-2023 Cosmin Truta
|
||||
# Copyright (c) 2016 Glenn Randers-Pehrson
|
||||
# Written by Roger Leigh, 2016
|
||||
|
||||
# This code is released under the libpng license.
|
||||
@@ -41,7 +42,7 @@ get_filename_component(OUTPUTBASE "${OUTPUT}" NAME_WE)
|
||||
get_filename_component(INPUTDIR "${INPUT}" PATH)
|
||||
get_filename_component(OUTPUTDIR "${OUTPUT}" PATH)
|
||||
|
||||
if ("${INPUTEXT}" STREQUAL ".c" AND "${OUTPUTEXT}" STREQUAL ".out")
|
||||
if(INPUTEXT STREQUAL ".c" AND OUTPUTEXT STREQUAL ".out")
|
||||
get_filename_component(GENDIR "${OUTPUT}" PATH)
|
||||
file(MAKE_DIRECTORY "${GENDIR}")
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# gensrc.cmake.in
|
||||
# Generate source files with awk, based upon the automake logic.
|
||||
|
||||
# Copyright (C) 2016 Glenn Randers-Pehrson
|
||||
# Copyright (c) 2022-2023 Cosmin Truta
|
||||
# Copyright (c) 2016 Glenn Randers-Pehrson
|
||||
# Written by Roger Leigh, 2016
|
||||
|
||||
# This code is released under the libpng license.
|
||||
@@ -17,7 +18,7 @@ set(DFA_XTRA "@DFA_XTRA@")
|
||||
set(PNG_PREFIX "@PNG_PREFIX@")
|
||||
set(PNGLIB_VERSION "@PNGLIB_VERSION@")
|
||||
|
||||
if("${OUTPUT}" STREQUAL "scripts/pnglibconf.c")
|
||||
if(OUTPUT STREQUAL "scripts/pnglibconf.c")
|
||||
# Generate scripts/pnglibconf.c
|
||||
|
||||
file(REMOVE "${BINDIR}/pnglibconf.tf6" "${BINDIR}/pnglibconf.tf7")
|
||||
@@ -45,7 +46,7 @@ if("${OUTPUT}" STREQUAL "scripts/pnglibconf.c")
|
||||
file(MAKE_DIRECTORY "${BINDIR}/scripts")
|
||||
file(RENAME "pnglibconf.tf7" "${BINDIR}/scripts/pnglibconf.c")
|
||||
|
||||
elseif ("${OUTPUT}" STREQUAL "pnglibconf.c")
|
||||
elseif(OUTPUT STREQUAL "pnglibconf.c")
|
||||
# Generate pnglibconf.c
|
||||
|
||||
file(REMOVE "${BINDIR}/pnglibconf.tf4" "${BINDIR}/pnglibconf.tf5")
|
||||
@@ -72,7 +73,7 @@ elseif ("${OUTPUT}" STREQUAL "pnglibconf.c")
|
||||
file(MAKE_DIRECTORY "${BINDIR}/scripts")
|
||||
file(RENAME "pnglibconf.tf5" "${BINDIR}/pnglibconf.c")
|
||||
|
||||
elseif ("${OUTPUT}" STREQUAL "pnglibconf.h")
|
||||
elseif(OUTPUT STREQUAL "pnglibconf.h")
|
||||
# Generate pnglibconf.h
|
||||
|
||||
file(REMOVE "${BINDIR}/${OUTPUT}")
|
||||
@@ -101,7 +102,7 @@ elseif ("${OUTPUT}" STREQUAL "pnglibconf.h")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
elseif ("${OUTPUT}" STREQUAL "pngprefix.h")
|
||||
elseif(OUTPUT STREQUAL "pngprefix.h")
|
||||
# Generate pngprefix.h
|
||||
|
||||
file(REMOVE "${BINDIR}/${OUTPUT}")
|
||||
@@ -123,7 +124,7 @@ elseif ("${OUTPUT}" STREQUAL "pngprefix.h")
|
||||
file(WRITE "${BINDIR}/${OUTPUT}" "/* No libpng symbol prefix configured. */")
|
||||
endif()
|
||||
|
||||
elseif("${OUTPUT}" STREQUAL "scripts/pnglibconf.h.prebuilt")
|
||||
elseif(OUTPUT STREQUAL "scripts/pnglibconf.h.prebuilt")
|
||||
# Generate scripts/pnglibconf.h.prebuilt (fails build)
|
||||
|
||||
message(STATUS "Attempting to build scripts/pnglibconf.h.prebuilt")
|
||||
|
||||
Reference in New Issue
Block a user