find_program(PYTHON "python3") 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("-D_BSD_SOURCE") add_definitions("-D_DEFAULT_SOURCE") add_definitions("-DRAZERCFG_BUILD") add_definitions("-D_FORTIFY_SOURCE=2") set(WARNING_COMPILE_FLAGS "-Wall -Wformat -Wformat-security -Wextra -Wno-unused-parameter -Wsuggest-attribute=noreturn -Wundef -Wpointer-arith -Wcast-qual -Wlogical-op -Wshadow") set(GENERIC_COMPILE_FLAGS "-O2 -std=c99 -fstack-protector -fstack-check ${WARNING_COMPILE_FLAGS}") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fsanitize=address") 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)