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

(cherry picked from commit 336f94d12f)
This commit is contained in:
Kornel Benko 2017-10-05 20:16:52 +02:00
parent c194f60d55
commit 88cba7dee3

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)
foreach(_rel_doc ${_rel_lyx_docs})
if ("${_rel_doc}" MATCHES "/" )
string(REGEX REPLACE "/[^/]*$" "" _rel_dir_part ${_rel_doc})
else("${_rel_doc}" MATCHES "/")
set(_rel_dir_part ".")
endif("${_rel_doc}" MATCHES "/")
set(_created_doc "${CMAKE_CURRENT_BINARY_DIR}/${_rel_doc}")
get_filename_component(_doc_dir ${_created_doc} PATH)
file(MAKE_DIRECTORY ${_doc_dir})
#message("found relative file " ${_rel_doc})
#message("input ${TOP_SRC_DIR}/lib/doc/${_rel_doc}")
#message("output ${_created_doc}")
#message("rel_dir_part ${_rel_dir_part}")
SET_SOURCE_FILES_PROPERTIES(${_created_doc} GENERATED)
add_custom_command(
OUTPUT "${_created_doc}"
COMMAND ${LYX_PYTHON_EXECUTABLE} "${TOP_CMAKE_PATH}/doc/ReplaceValues.py"
"LYX_USERDIR_VER=${LYX_USERDIR_VER}"
"LYX_DIR_VER=${LYX_DIR_VER}"
"\\origin\ unavailable=\\origin\ /systemlyxdir/doc/${_rel_dir_part}"
"${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}")
if (NOT "${_rel_doc}" MATCHES "#" )
if ("${_rel_doc}" MATCHES "/" )
string(REGEX REPLACE "/[^/]*$" "" _rel_dir_part ${_rel_doc})
else("${_rel_doc}" MATCHES "/")
set(_rel_dir_part ".")
endif("${_rel_doc}" MATCHES "/")
set(_created_doc "${CMAKE_CURRENT_BINARY_DIR}/${_rel_doc}")
get_filename_component(_doc_dir ${_created_doc} PATH)
file(MAKE_DIRECTORY ${_doc_dir})
#message(STATUS "found relative file " ${_rel_doc})
#message(STATUS "input ${TOP_SRC_DIR}/lib/doc/${_rel_doc}")
#message(STATUS "output ${_created_doc}")
#message(STATUS "rel_dir_part ${_rel_dir_part}")
SET_SOURCE_FILES_PROPERTIES(${_created_doc} GENERATED)
add_custom_command(
OUTPUT "${_created_doc}"
COMMAND ${LYX_PYTHON_EXECUTABLE} "${TOP_CMAKE_PATH}/doc/ReplaceValues.py"
"LYX_USERDIR_VER=${LYX_USERDIR_VER}"
"LYX_DIR_VER=${LYX_DIR_VER}"
"\\origin\ unavailable=\\origin\ /systemlyxdir/doc/${_rel_dir_part}"
"${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}")
endif()
endforeach(_rel_doc)
# Special commands to create and install LFUNs.lyx