From bc28606f01f57d84f86a06108f5a74cd95d55449 Mon Sep 17 00:00:00 2001 From: Nils Andresen Date: Tue, 30 Aug 2011 20:24:28 +0200 Subject: [PATCH] client/X11: Do not break compilation, if xmlto is not available --- client/X11/CMakeLists.txt | 19 ++++++++++++------- cmake/FindXmlto.cmake | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 cmake/FindXmlto.cmake diff --git a/client/X11/CMakeLists.txt b/client/X11/CMakeLists.txt index 1854f3327..73f61c2cb 100644 --- a/client/X11/CMakeLists.txt +++ b/client/X11/CMakeLists.txt @@ -17,6 +17,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +include(FindXmlto) include_directories(${X11_INCLUDE_DIRS}) add_executable(xfreerdp @@ -34,15 +35,19 @@ add_executable(xfreerdp xfreerdp.h) if(WITH_MANPAGES) - add_custom_command(OUTPUT xfreerdp.1 - COMMAND xmlto man ${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp.1.xml - DEPENDS xfreerdp.1.xml) + if(XMLTO_FOUND) + add_custom_command(OUTPUT xfreerdp.1 + COMMAND ${XMLTO_EXECUTABLE} man ${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp.1.xml + DEPENDS xfreerdp.1.xml) - add_custom_target(xfreerdp.manpage ALL - DEPENDS xfreerdp.1) + add_custom_target(xfreerdp.manpage ALL + DEPENDS xfreerdp.1) - install(FILES xfreerdp.1 DESTINATION share/man/man1) -endif() + install(FILES xfreerdp.1 DESTINATION share/man/man1) + else(XMLTO_FOUND) + message(WARNING "WITH_MANPAGES was set, but xmlto was not found. man-pages will not be installed") + endif(XMLTO_FOUND) +endif(WITH_MANPAGES) find_package(Xinerama) if(XINERAMA_FOUND) diff --git a/cmake/FindXmlto.cmake b/cmake/FindXmlto.cmake new file mode 100644 index 000000000..7d2107bab --- /dev/null +++ b/cmake/FindXmlto.cmake @@ -0,0 +1,35 @@ +# - Find xmlto +# Find the xmlto docbook xslt frontend +# +# This module defines the following variables: +# XMLTO_FOUND - True if xmlto was found +# XMLTO_EXECUTABLE - Path to xmlto, if xmlto was found +# + +#============================================================================= +# Copyright 2011 Nils Andresen +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#============================================================================= +set(XMLTO_FOUND false) + +find_program(XMLTO_EXECUTABLE + NAMES xmlto + DOC "docbook xslt frontend") + +if(XMLTO_EXECUTABLE) + set(XMLTO_FOUND true) + message(STATUS "Found XMLTO: ${XMLTO_EXECUTABLE}") +endif() + +mark_as_advanced(XMLTO_EXECUTABLE)