From: Jonas Hahnfeld Date: Tue, 2 Jan 2018 17:53:08 +0000 (+0000) Subject: [opt-viewer] Check for pygments.lexer.c_cpp X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b24a45d2e9f4fc10c3f9e16172104910b38637f2;p=llvm [opt-viewer] Check for pygments.lexer.c_cpp Some systems still don't have this module which was introduced in version 2.0 (CentOS 7, sigh). Differential Revision: https://reviews.llvm.org/D41611 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321659 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index c6be957b0e4..aaf22ff474b 100644 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -640,7 +640,8 @@ endif() string(REPLACE " " ";" LLVM_BINDINGS_LIST "${LLVM_BINDINGS}") function(find_python_module module) - string(TOUPPER ${module} module_upper) + string(REPLACE "." "_" module_name ${module}) + string(TOUPPER ${module_name} module_upper) set(FOUND_VAR PY_${module_upper}_FOUND) execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import ${module}" @@ -658,13 +659,16 @@ endfunction() set (PYTHON_MODULES pygments + # Some systems still don't have pygments.lexers.c_cpp which was introduced in + # version 2.0 in 2014... + pygments.lexers.c_cpp yaml ) foreach(module ${PYTHON_MODULES}) find_python_module(${module}) endforeach() -if(PY_PYGMENTS_FOUND AND PY_YAML_FOUND) +if(PY_PYGMENTS_FOUND AND PY_PYGMENTS_LEXERS_C_CPP_FOUND AND PY_YAML_FOUND) set (LLVM_HAVE_OPT_VIEWER_MODULES 1) else() set (LLVM_HAVE_OPT_VIEWER_MODULES 0)