summaryrefslogtreecommitdiffstats
path: root/scripts/cmake.global
blob: 40b9f1b006d6ed2c71d7000a1ab3de246ff7a214 (plain)
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
include(TestBigEndian)

test_big_endian(BIGENDIAN)
if (BIGENDIAN)
	add_definitions(-DBIG_ENDIAN_HOST)
else (BIGENDIAN)
	add_definitions(-DLITTLE_ENDIAN_HOST)
endif (BIGENDIAN)

add_definitions("-D_GNU_SOURCE")
add_definitions("-DRAZERCFG_BUILD")
add_definitions("-D_FORTIFY_SOURCE=2")

set(GENERIC_COMPILE_FLAGS "-O2 -std=gnu99 -Wall -Wformat -Wformat-security -fstack-protector")

set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")

find_path(LIBUSB_INCLUDE_PATH
	NAMES libusb.h
	PATHS "/usr/include/libusb" "/usr/include/libusb-1.0"
)
include_directories(AFTER ${LIBUSB_INCLUDE_PATH})
set(CMAKE_REQUIRED_INCLUDES "${LIBUSB_INCLUDE_PATH};${CMAKE_REQUIRED_INCLUDES}")

macro(INSTALL_EXEC_CMD _COMMAND _FAILMSG)
	install(CODE "
		execute_process(COMMAND ${_COMMAND} RESULT_VARIABLE install_exec_res)
		if (NOT \"\${install_exec_res}\" STREQUAL \"0\")
			message(WARNING \"WARNING: ${_COMMAND} failed: \${install_exec_res}\n${_FAILMSG}\n\")
		else (NOT \"\${install_exec_res}\" STREQUAL \"0\")
			message(STATUS \"${_COMMAND}: \${install_exec_res}\")
		endif (NOT \"\${install_exec_res}\" STREQUAL \"0\")
	")
endmacro(INSTALL_EXEC_CMD)
bues.ch cgit interface