File: FindWindres.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 (58 lines) | stat: -rwxr-xr-x 1,509 bytes parent folder | download
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# This file is part of the Spring engine (GPL v2 or later), see LICENSE.html

# - Find windres executable
# manipulate Windows resources
#
#  WINDRES_BIN    - will be set to the windres executable (eg. windres.exe)
#  WINDRES_FOUND  - TRUE if windres was found

IF    (MINGW)
	# Already in cache, be silent
	IF    (WINDRES_BIN)
		SET(Windres_FIND_QUIETLY TRUE)
	ENDIF (WINDRES_BIN)

	FIND_PROGRAM(WINDRES_BIN
		NAMES
			windres
			i586-mingw32msvc-windres
			i586-pc-mingw32-windres
			i686-pc-mingw32-windres
			i686-mingw32-windres
		DOC "path to mingw's windres executable"
		)

	INCLUDE(FindPackageHandleStandardArgs)

	# handle the QUIETLY and REQUIRED arguments and set WINDRES_FOUND to TRUE if
	# all listed variables are TRUE
	FIND_PACKAGE_HANDLE_STANDARD_ARGS(Windres DEFAULT_MSG WINDRES_BIN)

	MARK_AS_ADVANCED(WINDRES_BIN)


	MACRO    (CreateResourceCompileCommand out_var dirIn fileIn fileOut)
		IF    (WINDRES_FOUND)
			ADD_CUSTOM_COMMAND(
				OUTPUT
					"${fileOut}"
				DEPENDS
					"${fileIn}" 
				COMMAND
					"${WINDRES_BIN}"
						"-I${dirIn}"
						"-i${fileIn}" 
						"-o" "${fileOut}"
						"-v"
				)
			SET_SOURCE_FILES_PROPERTIES(${fileOut} PROPERTIES
				GENERATED      TRUE
				OBJECT_DEPENDS ${fileIn}
				)
			SET(${out_var} "${fileOut}")
		ELSE  (WINDRES_FOUND)
			SET(${out_var} "")
			MESSAGE(WARNING "Could not find windres, not compiling resource \"${fileIn}\".")
		ENDIF (WINDRES_FOUND)
	ENDMACRO (CreateResourceCompileCommand out_var dirIn fileIn fileOut)
ENDIF (MINGW)