1# Find DocBook to LaTeX Publishing (http://dblatex.sourceforge.net/) 2# 3# The module defines the following variables: 4# 5# DBLATEX_EXECUTABLE - path to the dblatex executable 6# DBLATEX_FOUND - true if dblatex was found 7# DBLATEX_VERSION - the version of dblatex found 8 9#============================================================================= 10# Copyright (C) 2011 Daniel Pfeifer <daniel@pfeifer-mail.de> 11# 12# Distributed under the Boost Software License, Version 1.0. 13# See accompanying file LICENSE_1_0.txt or copy at 14# http://www.boost.org/LICENSE_1_0.txt 15#============================================================================= 16 17#if(DBLATEX_EXECUTABLE) 18# return() 19#endif() 20 21if(CMAKE_HOST_WIN32) 22 find_package(PythonInterp QUIET) 23 find_file(dblatex_py dblatex 24 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath]/Scripts 25 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]/Scripts 26 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]/Scripts 27 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]/Scripts 28 ) 29 if(PYTHONINTERP_FOUND AND dblatex_py) 30 set(DBLATEX_EXECUTABLE ${PYTHON_EXECUTABLE} ${dblatex_py} 31 CACHE FILEPATH "dblatex executable" 32 ) 33 endif() 34 unset(dblatex_py CACHE) 35else() 36 find_program(DBLATEX_EXECUTABLE dblatex) 37endif() 38 39if(DBLATEX_EXECUTABLE) 40 execute_process(COMMAND ${DBLATEX_EXECUTABLE} --version 41 OUTPUT_VARIABLE DBLATEX_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) 42 string(REGEX REPLACE "^dblatex version (.+)$" "\\1" 43 DBLATEX_VERSION "${DBLATEX_VERSION}") 44endif() 45 46include(FindPackageHandleStandardArgs) 47find_package_handle_standard_args(DBLATEX 48 REQUIRED_VARS DBLATEX_EXECUTABLE 49 VERSION_VAR DBLATEX_VERSION 50 ) 51 52mark_as_advanced(DBLATEX_EXECUTABLE) 53