mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 05:01:49 +00:00
Cmake build: Added check for pythons polib module
Idea stolen from http://public.kitware.com/pipermail/cmake/2011-January/041666.html
This commit is contained in:
parent
6743c6fa87
commit
fa85bf9b59
@ -379,3 +379,25 @@ macro(lyx_target_link_libraries _target)
|
|||||||
endforeach()
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
# Check if python module exists
|
||||||
|
# Idea stolen from http://public.kitware.com/pipermail/cmake/2011-January/041666.html
|
||||||
|
function(find_python_module module)
|
||||||
|
string(TOUPPER ${module} module_upper)
|
||||||
|
if(NOT LYX_PY_${module_upper})
|
||||||
|
if(ARGC GREATER 1 AND ARGV1 STREQUAL "REQUIRED")
|
||||||
|
set(LYX_PY_${module}_FIND_REQUIRED TRUE)
|
||||||
|
endif()
|
||||||
|
# A module's location is usually a directory, but for binary modules
|
||||||
|
# it's a .so file.
|
||||||
|
execute_process(COMMAND "${LYX_PYTHON_EXECUTABLE}" "-c"
|
||||||
|
"import re, ${module}; print(re.compile('/__init__.py.*').sub('',${module}.__file__))"
|
||||||
|
RESULT_VARIABLE _${module}_status
|
||||||
|
OUTPUT_VARIABLE _${module}_location
|
||||||
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
if(NOT _${module}_status)
|
||||||
|
set(LYX_PY_${module_upper} ${_${module}_location} CACHE STRING
|
||||||
|
"Location of Python module ${module}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
find_package_handle_standard_args(LYX_PY_${module} DEFAULT_MSG LYX_PY_${module_upper})
|
||||||
|
endfunction(find_python_module)
|
||||||
|
@ -11,6 +11,9 @@ include_directories(${TOP_SRC_DIR}/po)
|
|||||||
|
|
||||||
SET(_lyxname ${PACKAGE})
|
SET(_lyxname ${PACKAGE})
|
||||||
SET(_py_sources)
|
SET(_py_sources)
|
||||||
|
|
||||||
|
# Idea stolen from http://public.kitware.com/pipermail/cmake/2011-January/041666.html
|
||||||
|
|
||||||
macro(add_gettext_python _par _dir)
|
macro(add_gettext_python _par _dir)
|
||||||
set(_sources)
|
set(_sources)
|
||||||
foreach(_arg ${ARGN})
|
foreach(_arg ${ARGN})
|
||||||
@ -40,6 +43,9 @@ macro(add_gettext_python _par _dir)
|
|||||||
DEPENDS ${_tmp_src_files}
|
DEPENDS ${_tmp_src_files}
|
||||||
)
|
)
|
||||||
if (${_par} MATCHES "layouttranslations")
|
if (${_par} MATCHES "layouttranslations")
|
||||||
|
# lyx_pot.py requires the module "polib" if using target layouttranslations1,
|
||||||
|
# so we have to check for it
|
||||||
|
find_python_module("polib" REQUIRED)
|
||||||
ADD_CUSTOM_COMMAND(
|
ADD_CUSTOM_COMMAND(
|
||||||
OUTPUT "${_dst}"
|
OUTPUT "${_dst}"
|
||||||
PRE_BUILD
|
PRE_BUILD
|
||||||
|
Loading…
Reference in New Issue
Block a user