From bcffcf8aaac239e0e7955ac5c04f99f75cf1fe9c Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Wed, 29 Apr 2015 00:51:52 +0000 Subject: [PATCH] Use absolute path for Python interpreter to avoid picking up v3 Because asciidoc doesn't work with Python 3 we must not allow it to run via a shebang or Windows file association, instead we now use find_package() on Python and filter the version. This means that CMAKE_PREFIX_PATH can be used to select the correct Python installation if there are more than one and one is v3 or newer. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5321 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- doc/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 90fefd92f..30fafe4fc 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -94,6 +94,15 @@ set (UG_IMGS user_guide/images/special-mouse-commands.png ) +find_package (PythonInterp 2.4 REQUIRED) +if (PYTHON_VERSION_STRING VERSION_GREATER 2.9.9) + message (FATAL_ERROR "The asciidoc package requires a Python version less than 3 + +Use CMAKE_PREFIX_PATH to point to an earlier version or install one, +you can also skip building the documentation by switching the option +WSJT_GENERATE_DOCS to OFF.") +endif (PYTHON_VERSION_STRING VERSION_GREATER 2.9.9) + find_program (ASCIIDOC NAMES asciidoc asciidoc.py) if (NOT ASCIIDOC) message (FATAL_ERROR "Asciidoc is required to build the documentation") @@ -115,7 +124,7 @@ function (html_document) add_custom_command ( OUTPUT ${_doc_file} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${path} - COMMAND ${ASCIIDOC} ARGS ${args_ASCIIDOC_OPTIONS} --out-file=${CMAKE_CURRENT_BINARY_DIR}/${_output_name_we}.html ${args_SOURCE} + COMMAND ${PYTHON_EXECUTABLE} ARGS ${ASCIIDOC} ${args_ASCIIDOC_OPTIONS} --out-file=${CMAKE_CURRENT_BINARY_DIR}/${_output_name_we}.html ${args_SOURCE} DEPENDS ${args_DEPENDS} COMMENT "Generating ${_doc_file}" )