1 # This file is part of LyX, the document processor.
2 # Licence details can be found in the file COPYING.
4 # Copyright (c) 2008, 2009 Peter Kümmel, <syntheticpp@gmx.net>
5 # Copyright (c) 2008, 2009 Kornel Benko, <Kornel.Benko@berlin.de>
10 include(FindPythonInterp)
12 file(GLOB _lyx2lyx_py_files ${TOP_SRC_DIR}/lib/lyx2lyx/*.py)
14 set(py_compile ${TOP_SRC_DIR}/config/py-compile)
17 set(ENV{PYTHON} ${PYTHON_EXECUTABLE})
19 foreach(_orig_py ${_lyx2lyx_py_files})
20 get_filename_component(_base_we_py ${_orig_py} NAME_WE)
21 set(_compiled_py_ "${CMAKE_CURRENT_BINARY_DIR}/${_base_we_py}.pyc" "${CMAKE_CURRENT_BINARY_DIR}/${_base_we_py}.pyo")
22 set(_copied_py "${CMAKE_CURRENT_BINARY_DIR}/${_base_we_py}.py")
23 # we need that file really local first, due to the "py_compile"-script
24 # because the creation will be in the directory of .py-file
28 COMMAND ${CMAKE_COMMAND} -E copy "${_orig_py}" ${_copied_py}
32 OUTPUT ${_compiled_py_}
34 COMMAND ${py_compile} ${_copied_py}
37 SET_SOURCE_FILES_PROPERTIES(${_copied_py} ${_created_py_} GENERATED)
38 install(FILES ${_compiled_py_} DESTINATION lyx2lyx)
39 LIST(APPEND _generated ${_compiled_py_})
42 ADD_CUSTOM_TARGET(lyx2lyx ALL DEPENDS ${_generated})