File: FindMarkdown.cmake

package info (click to toggle)
spring 88.0%2Bdfsg1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 41,524 kB
  • sloc: cpp: 343,114; ansic: 38,414; python: 12,257; java: 12,203; awk: 5,748; sh: 1,204; xml: 997; perl: 405; objc: 192; makefile: 181; php: 134; sed: 2
file content (43 lines) | stat: -rwxr-xr-x 1,489 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# This file is part of the Spring engine (GPL v2 or later), see LICENSE.html

# - Find Markdown
# Find the native _markdown_ binary, which may be used to convert _*.markdown_
# files to _*.html_.
# http://daringfireball.net/projects/markdown/
#
# See Pandoc (FindPandoc.cmake), for a more powerful utility.
#
#  MARKDOWN_BIN      - will be set to the Markdown executable (eg. markdown.exe)
#  MARKDOWN_FOUND    - TRUE if Markdown was found
#  Markdown_MdToHtml - creates a string that may be executed on the cmd-line
#                      for converting a markdown file to HTML

Include(FindPackageHandleStandardArgs)

If    (MARKDOWN_BIN)
	# Already in cache, be silent
	Set(Markdown_FIND_QUIETLY TRUE)
EndIf (MARKDOWN_BIN)

find_program(MARKDOWN_BIN
		NAMES markdown markdown_py
		HINTS "${MINGWDIR}" "${CMAKE_SOURCE_DIR}/installer"
		PATH_SUFFIXES bin
		DOC "Markdown executable"
	)

# handle the QUIETLY and REQUIRED arguments and set MARKDOWN_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Markdown DEFAULT_MSG MARKDOWN_BIN)

MARK_AS_ADVANCED(MARKDOWN_BIN)

If    (MARKDOWN_FOUND)
	Macro    (Markdown_MdToHtml var_command fileSrc fileDst)
		# There are at least two compleetly different versions of markdown.
		# The one on gentoo suports a lot of cmd-line switches,
		# the one on Ubuntu not. This should work with both:
		Set("${var_command}"
				${MARKDOWN_BIN} "${fileSrc}" > "${fileDst}")
	EndMacro (Markdown_MdToHtml)
EndIf (MARKDOWN_FOUND)