[libpng16] Updated CMakeLists.txt, added supporting scripts/gen*.cmake.in

and test.cmake.in
This commit is contained in:
Roger Leigh
2016-01-28 15:58:45 -06:00
committed by Glenn Randers-Pehrson
parent 98c6fa2495
commit 74e481c743
7 changed files with 771 additions and 82 deletions

29
scripts/genchk.cmake.in Normal file
View File

@@ -0,0 +1,29 @@
# Generate .chk from .out with awk (generic), based upon the automake logic.
# Variables substituted from CMakeLists.txt
set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@")
set(AWK "@AWK@")
get_filename_component(INPUTEXT "${INPUT}" EXT)
get_filename_component(OUTPUTEXT "${OUTPUT}" EXT)
get_filename_component(INPUTBASE "${INPUT}" NAME_WE)
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")
# Generate .chk from .out with awk (generic)
file(REMOVE "${OUTPUT}" "${OUTPUTDIR}/${OUTPUTBASE}.new")
execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/checksym.awk"
"${SRCDIR}/scripts/${INPUTBASE}.def"
"of=${OUTPUTDIR}/${OUTPUTBASE}.new"
"${INPUT}"
RESULT_VARIABLE AWK_FAIL)
if(AWK_FAIL)
message(FATAL_ERROR "Failed to generate ${OUTPUTDIR}/${OUTPUTBASE}.new")
endif()
file(RENAME "${OUTPUTDIR}/${OUTPUTBASE}.new" "${OUTPUT}")
else()
message(FATAL_ERROR "Unsupported conversion: ${INPUTEXT} to ${OUTPUTEXT}")
endif()