Cmake build: Don't use temporary doc-files as source for installation

This commit is contained in:
Kornel Benko 2017-10-05 20:16:52 +02:00
parent 55cdd62916
commit 336f94d12f

View File

@ -15,30 +15,32 @@ file(GLOB_RECURSE _rel_lyx_docs RELATIVE "${TOP_SRC_DIR}/lib/doc"
list(REMOVE_ITEM _rel_lyx_docs LFUNs.lyx) list(REMOVE_ITEM _rel_lyx_docs LFUNs.lyx)
foreach(_rel_doc ${_rel_lyx_docs}) foreach(_rel_doc ${_rel_lyx_docs})
if ("${_rel_doc}" MATCHES "/" ) if (NOT "${_rel_doc}" MATCHES "#" )
string(REGEX REPLACE "/[^/]*$" "" _rel_dir_part ${_rel_doc}) if ("${_rel_doc}" MATCHES "/" )
else("${_rel_doc}" MATCHES "/") string(REGEX REPLACE "/[^/]*$" "" _rel_dir_part ${_rel_doc})
set(_rel_dir_part ".") else("${_rel_doc}" MATCHES "/")
endif("${_rel_doc}" MATCHES "/") set(_rel_dir_part ".")
set(_created_doc "${CMAKE_CURRENT_BINARY_DIR}/${_rel_doc}") endif("${_rel_doc}" MATCHES "/")
get_filename_component(_doc_dir ${_created_doc} PATH) set(_created_doc "${CMAKE_CURRENT_BINARY_DIR}/${_rel_doc}")
file(MAKE_DIRECTORY ${_doc_dir}) get_filename_component(_doc_dir ${_created_doc} PATH)
#message("found relative file " ${_rel_doc}) file(MAKE_DIRECTORY ${_doc_dir})
#message("input ${TOP_SRC_DIR}/lib/doc/${_rel_doc}") #message(STATUS "found relative file " ${_rel_doc})
#message("output ${_created_doc}") #message(STATUS "input ${TOP_SRC_DIR}/lib/doc/${_rel_doc}")
#message("rel_dir_part ${_rel_dir_part}") #message(STATUS "output ${_created_doc}")
SET_SOURCE_FILES_PROPERTIES(${_created_doc} GENERATED) #message(STATUS "rel_dir_part ${_rel_dir_part}")
add_custom_command( SET_SOURCE_FILES_PROPERTIES(${_created_doc} GENERATED)
OUTPUT "${_created_doc}" add_custom_command(
COMMAND ${LYX_PYTHON_EXECUTABLE} "${TOP_CMAKE_PATH}/doc/ReplaceValues.py" OUTPUT "${_created_doc}"
"LYX_USERDIR_VER=${LYX_USERDIR_VER}" COMMAND ${LYX_PYTHON_EXECUTABLE} "${TOP_CMAKE_PATH}/doc/ReplaceValues.py"
"LYX_DIR_VER=${LYX_DIR_VER}" "LYX_USERDIR_VER=${LYX_USERDIR_VER}"
"\\origin\ unavailable=\\origin\ /systemlyxdir/doc/${_rel_dir_part}" "LYX_DIR_VER=${LYX_DIR_VER}"
"${TOP_SRC_DIR}/lib/doc/${_rel_doc}" > "${_created_doc}" "\\origin\ unavailable=\\origin\ /systemlyxdir/doc/${_rel_dir_part}"
DEPENDS "${TOP_SRC_DIR}/lib/doc/${_rel_doc}" "${TOP_CMAKE_PATH}/doc/ReplaceValues.py" "${TOP_SRC_DIR}/lib/doc/${_rel_doc}" > "${_created_doc}"
) DEPENDS "${TOP_SRC_DIR}/lib/doc/${_rel_doc}" "${TOP_CMAKE_PATH}/doc/ReplaceValues.py"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${_rel_doc}" DESTINATION "${LYX_DATA_SUBDIR}doc/${_rel_dir_part}") )
LIST(APPEND _docs "${_created_doc}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${_rel_doc}" DESTINATION "${LYX_DATA_SUBDIR}doc/${_rel_dir_part}")
LIST(APPEND _docs "${_created_doc}")
endif()
endforeach(_rel_doc) endforeach(_rel_doc)
# Special commands to create and install LFUNs.lyx # Special commands to create and install LFUNs.lyx