File: SpringLobbyMacros.cmake

package info (click to toggle)
springlobby 0.274-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,960 kB
  • sloc: cpp: 76,749; ansic: 62,823; python: 468; sh: 289; xml: 52; makefile: 40; sed: 16
file content (57 lines) | stat: -rw-r--r-- 1,609 bytes parent folder | download | duplicates (2)
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
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

macro(CreateResourceCompileCommand out_var dirIn fileIn fileOut)
# 	set( fileIn "${dirIn}/${fileIn}" )
	set( fileOut "${CMAKE_CURRENT_BINARY_DIR}/${fileOut}" )
	add_custom_command(
		OUTPUT
			"${fileOut}"
		DEPENDS
			"${fileIn}"
		COMMAND
			"${CMAKE_RC_COMPILER}"
				"-I${dirIn}"
				"-I${wxWidgets_RC_DIR}"
				"-i${CMAKE_CURRENT_SOURCE_DIR}/${fileIn}"
				"-o" "${fileOut}"
				"-v")
	set_source_files_properties(${fileOut} PROPERTIES
		GENERATED      TRUE
		OBJECT_DEPENDS ${fileIn})
	set(${out_var} "${fileOut}")
endmacro()

macro(mylink var)
	foreach(lib ${var})
		link_directories( ${lib} )
	endforeach()
endmacro()

function(TO_LIST_SPACES _LIST_NAME OUTPUT_VAR)
  set(NEW_LIST_SPACE)
  foreach(ITEM ${${_LIST_NAME}})
    set(NEW_LIST_SPACE ${NEW_LIST_SPACE} ${ITEM})
  endforeach()
#   string(STRIP ${NEW_LIST_SPACE} NEW_LIST_SPACE)
  set(${OUTPUT_VAR} "${NEW_LIST_SPACE}" PARENT_SCOPE)
endfunction()

macro(add_analyze)
    find_program(ANALYZER NAMES clang-check)
    to_list_spaces(${ARGN} _sources)
    if(EXISTS ${ANALYZER})
        add_custom_target("analyze" ${ANALYZER} -fixit -p=${CMAKE_CURRENT_BINARY_DIR} -analyze ${ARGN})
    else()
        message(STATUS "not adding analyze target because clang-check is missing")
    endif()
endmacro()

macro(add_format)
    find_program(CLANGFORMAT NAMES clang-format clang-format-3.4)
    if(CLANGFORMAT-NOTFOUND)
        message(WARNING "not adding format target because clang-format is missing")
    else()
        add_custom_target("format" ${CLANGFORMAT} -i -style=file ${ARGN})
    endif()
endmacro()