1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
4 # Copyright (c) 2008-2011 Peter Kümmel, <syntheticpp@gmx.net>
5 # Copyright (c) 2008-2011 Kornel Benko, <Kornel.Benko@berlin.de>
10 #TODO: replace perl script with python, see scons:
11 # http://www.lyx.org/trac/browser/lyx-devel/trunk/development/scons/scons_utils.py
14 file(GLOB_RECURSE _rel_lyx_docs RELATIVE "${TOP_SRC_DIR}/lib/doc" "${TOP_SRC_DIR}/lib/doc/*.lyx" "${TOP_SRC_DIR}/lib/doc/*.txt")
16 foreach(_rel_doc ${_rel_lyx_docs})
17 if ("${_rel_doc}" MATCHES "/" )
18 string(REGEX REPLACE "/[^/]*$" "" _rel_dir_part ${_rel_doc})
19 else("${_rel_doc}" MATCHES "/")
20 set(_rel_dir_part ".")
21 endif("${_rel_doc}" MATCHES "/")
22 set(_created_doc "${CMAKE_CURRENT_BINARY_DIR}/${_rel_doc}")
23 get_filename_component(_doc_dir ${_created_doc} PATH)
24 file(MAKE_DIRECTORY ${_doc_dir})
25 #message("found relative file " ${_rel_doc})
26 #message("input ${TOP_SRC_DIR}/lib/doc/${_rel_doc}")
27 #message("output ${_created_doc}")
28 #message("rel_dir_part ${_rel_dir_part}")
29 SET_SOURCE_FILES_PROPERTIES(${_created_doc} GENERATED)
31 OUTPUT "${_created_doc}"
32 COMMAND ${LYX_PYTHON_EXECUTABLE} "${TOP_SRC_DIR}/development/cmake/doc/ReplaceValues.py" "LYX_USERDIR_VER=${LYX_USERDIR_VER}" "LYX_DIR_VER=${LYX_DIR_VER}" "${TOP_SRC_DIR}/lib/doc/${_rel_doc}" > "${_created_doc}"
33 DEPENDS "${TOP_SRC_DIR}/lib/doc/${_rel_doc}" "${TOP_SRC_DIR}/development/cmake/doc/ReplaceValues.py"
35 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${_rel_doc}" DESTINATION "${LYX_DATA_SUBDIR}doc/${_rel_dir_part}")
36 LIST(APPEND _docs "${_created_doc}")
39 ADD_CUSTOM_TARGET(doc ALL DEPENDS ${_docs})