Skip to content

Commit

Permalink
Fixed on MacOS:
Browse files Browse the repository at this point in the history
- "warning: implicit declaration of function 'sysctlbyname' is invalid in C99"
- "error: unknown type name 'u_int'" after including <sys/sysctl.h>

Signed-off-by: Matej Kenda <[email protected]>
  • Loading branch information
matejk committed Mar 13, 2020
1 parent 3076542 commit c954463
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ if (CMAKE_COMPILER_IS_GNUCC)
endif()
endif()

if(APPLE)
#full Single Unix Standard v3 (SUSv3) conformance (the Unix API)
add_definitions(-D_DARWIN_C_SOURCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-sign-compare")
endif()

include(CheckSymbolExists)
check_symbol_exists(strdup "string.h" HAS_STRDUP)
check_symbol_exists(strerror_r "string.h" HAS_STRERROR_R)
Expand Down
1 change: 1 addition & 0 deletions tests/iio_stresstest.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <errno.h>
#include <limits.h>
#include <sys/time.h>
#include <sys/sysctl.h>

#define MY_NAME "iio_stresstest"

Expand Down

0 comments on commit c954463

Please sign in to comment.