mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-24 18:00:31 -06:00
Bug 797691 - Tip of the day is not rebuilt when the source file changes
Changes to tip_of_the_day.list.c will now properly trigger a rebuild. Plus a few minor assorted fixes and changes to generating the man pages - only generate the final files in share/gnucash, not in the build directory - gnucash-cli.1 was not installed, gnucash.1 twice
This commit is contained in:
parent
fbabcd58e0
commit
5bf3bfc6b6
@ -10,5 +10,5 @@ endif()
|
||||
|
||||
set_dist_list(cmake_DIST CMakeLists.txt README_CMAKE.txt cmake_uninstall.cmake.in
|
||||
configure-appdata.cmake configure-gnucash-desktop.cmake configure-manpage.cmake
|
||||
git2version-info.cmake version-info2env.cmake
|
||||
configure-totd.cmake git2version-info.cmake version-info2env.cmake
|
||||
)
|
||||
|
@ -12,5 +12,4 @@
|
||||
|
||||
include (${SRC_DIR}/cmake/version-info2env.cmake)
|
||||
versioninfo2env (${VCS_INFO_FILE})
|
||||
configure_file(${SRC} ${DST} )
|
||||
configure_file(${DST} ${DATADIR_BUILD}/gnucash/${DST} COPYONLY)
|
||||
configure_file(${SRC} ${DATADIR_BUILD}/gnucash/${DST} )
|
||||
|
24
cmake/configure-totd.cmake
Normal file
24
cmake/configure-totd.cmake
Normal file
@ -0,0 +1,24 @@
|
||||
# Command to configure the gnucash man page
|
||||
# These commands are store in a separate cmake file as they have to be
|
||||
# rerun depending on build conditions, not depending on cmake conditions
|
||||
# (such as did the version string change or not)
|
||||
#
|
||||
# The following environment variables are used and should be properly set
|
||||
# by the calling code:
|
||||
# - SRC_DIR (source code directory containing tip_of_the_day.list.c)
|
||||
# - DST_DIR (build dir to write tip_of_the_day.list to)
|
||||
# - SRC (full path to tip_of_the_day.list.c)
|
||||
# - DST (target filename)
|
||||
# - CMAKE_C_COMPILER (path to C compiler, used to parse the input file)
|
||||
file(REMOVE ${DST_DIR}/${TOTD})
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -E -P -x c -DN_\(x\)=x -o ${TOTD}.tmp ${SRC}
|
||||
)
|
||||
|
||||
file(STRINGS ${TOTD}.tmp TIP_OF_THE_DAY_LINES)
|
||||
set(TOTD_OUTPUT "")
|
||||
foreach(line ${TIP_OF_THE_DAY_LINES})
|
||||
string(REGEX REPLACE "^ *\"" "" line2 "${line}")
|
||||
string(REGEX REPLACE "\" *$" "" line3 "${line2}")
|
||||
file(APPEND ${DST_DIR}/${TOTD} "${line3}\n")
|
||||
endforeach()
|
@ -19,40 +19,35 @@ endforeach()
|
||||
|
||||
# Generate the tip of the day file.
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -E -P -x c -DN_\(x\)=x -o ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list.tmp ${CMAKE_CURRENT_SOURCE_DIR}/tip_of_the_day.list.c
|
||||
set (totd "tip_of_the_day.list")
|
||||
add_custom_command(OUTPUT ${DATADIR_BUILD}/gnucash/${totd}
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${totd}.c
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-D SRC=${CMAKE_CURRENT_SOURCE_DIR}/${totd}.c
|
||||
-D TOTD=${totd}
|
||||
-D DST_DIR=${DATADIR_BUILD}/gnucash
|
||||
-D CMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake/configure-totd.cmake
|
||||
)
|
||||
add_custom_target(totd ALL DEPENDS ${DATADIR_BUILD}/gnucash/${totd})
|
||||
|
||||
file(STRINGS ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list.tmp TIP_OF_THE_DAY_LINES)
|
||||
install(FILES ${DATADIR_BUILD}/gnucash/tip_of_the_day.list DESTINATION ${CMAKE_INSTALL_DATADIR}/gnucash)
|
||||
|
||||
set(TOTD_OUTPUT "")
|
||||
foreach(line ${TIP_OF_THE_DAY_LINES})
|
||||
string(REGEX REPLACE "^ *\"" "" line2 "${line}")
|
||||
string(REGEX REPLACE "\" *$" "" line3 "${line2}")
|
||||
list(APPEND TOTD_OUTPUT "${line3}\n")
|
||||
endforeach()
|
||||
|
||||
string(CONCAT FINAL_TOTD ${TOTD_OUTPUT})
|
||||
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list "${FINAL_TOTD}")
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list DESTINATION ${CMAKE_INSTALL_DATADIR}/gnucash)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/tip_of_the_day.list
|
||||
DESTINATION ${DATADIR_BUILD}/gnucash)
|
||||
# Generate manpages.
|
||||
|
||||
foreach (manpage gnucash gnucash-cli)
|
||||
add_custom_command(OUTPUT ${manpage}.1
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${manpage}.1.in ${VCS_INFO_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/${manpage}.1.in
|
||||
-D DST=${manpage}.1
|
||||
-D VCS_INFO_FILE=${VCS_INFO_FILE}
|
||||
-D DATADIR_BUILD=${DATADIR_BUILD}
|
||||
-D SRC_DIR=${CMAKE_SOURCE_DIR}
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake/configure-manpage.cmake
|
||||
add_custom_command(OUTPUT ${DATADIR_BUILD}/gnucash/${manpage}.1
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${manpage}.1.in ${VCS_INFO_FILE}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-D SRC=${CMAKE_CURRENT_SOURCE_DIR}/${manpage}.1.in
|
||||
-D DST=${manpage}.1
|
||||
-D VCS_INFO_FILE=${VCS_INFO_FILE}
|
||||
-D DATADIR_BUILD=${DATADIR_BUILD}
|
||||
-D SRC_DIR=${CMAKE_SOURCE_DIR}
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake/configure-manpage.cmake
|
||||
)
|
||||
add_custom_target(${manpage}-manpage DEPENDS ${manpage}.1)
|
||||
dist_add_generated (${BUILDING_FROM_VCS} ${manpage}.1)
|
||||
add_custom_target(${manpage}-manpage ALL DEPENDS ${DATADIR_BUILD}/gnucash/${manpage}.1)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gnucash.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||
install(FILES ${DATADIR_BUILD}/gnucash/${manpage}.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||
endforeach()
|
||||
|
@ -53,8 +53,6 @@ add_executable (gnucash
|
||||
${gnucash_noinst_HEADERS}
|
||||
)
|
||||
|
||||
add_dependencies (gnucash gnucash-manpage gnucash-cli-manpage)
|
||||
|
||||
target_compile_definitions(gnucash PRIVATE -DG_LOG_DOMAIN=\"gnc.bin\")
|
||||
|
||||
target_link_libraries (gnucash
|
||||
|
Loading…
Reference in New Issue
Block a user