include(AMXConfig)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})

set_property(DIRECTORY ${CMAKE_SOURCE_DIR} APPEND PROPERTY INCLUDE_DIRECTORIES
	${CMAKE_CURRENT_SOURCE_DIR}
	${CMAKE_CURRENT_SOURCE_DIR}/..
)

if(MSVC)
	add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()

add_library(amx STATIC
	amx.h
	amxaux.c
	amxaux.h
	amxdbg.c
	amxdbg.h
	getch.h
	osdefs.h
	sclinux.h
)

include(AMXConfig)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})

set_property(DIRECTORY ${CMAKE_SOURCE_DIR} APPEND PROPERTY INCLUDE_DIRECTORIES
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}/..
)

if(MSVC)
  add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()

add_library(amx STATIC
  amx.h
  amxaux.c
  amxaux.h
  amxdbg.c
  amxdbg.h
  getch.h
  osdefs.h
  sclinux.h
)

if(CMAKE_COMPILER_IS_GNUCC)
  set_property(TARGET amx APPEND_STRING PROPERTY COMPILE_FLAGS
               " -Wno-unused-result")
endif()

Disable unused result warning for amx
Disable unused result warning for amx

Suppress "ignoring return value of X" warnings when compiling with GCC:

[ 17%] Building C object src/amx/CMakeFiles/amx.dir/amxaux.c.o
/samp/plugins/profiler/src/amx/amxaux.c: In function ‘aux_ProgramSize’:
/samp/plugins/profiler/src/amx/amxaux.c:32: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result
/samp/plugins/profiler/src/amx/amxaux.c: In function ‘aux_LoadProgram’:
/samp/plugins/profiler/src/amx/amxaux.c:49: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result
/samp/plugins/profiler/src/amx/amxaux.c:71: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result
[ 20%] Building C object src/amx/CMakeFiles/amx.dir/amxdbg.c.o
/samp/plugins/profiler/src/amx/amxdbg.c: In function ‘dbg_LoadInfo’:
/samp/plugins/profiler/src/amx/amxdbg.c:79: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result
/samp/plugins/profiler/src/amx/amxdbg.c:92: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result
/samp/plugins/profiler/src/amx/amxdbg.c:134: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result
[ 23%] Linking C static library libamx.a
