Skip to content

Commit c954463

Browse files
committed
Fixed on MacOS:
- "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]>
1 parent 3076542 commit c954463

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ if (CMAKE_COMPILER_IS_GNUCC)
7878
endif()
7979
endif()
8080

81+
if(APPLE)
82+
#full Single Unix Standard v3 (SUSv3) conformance (the Unix API)
83+
add_definitions(-D_DARWIN_C_SOURCE)
84+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -Wno-unused-parameter -Wno-sign-compare")
85+
endif()
86+
8187
include(CheckSymbolExists)
8288
check_symbol_exists(strdup "string.h" HAS_STRDUP)
8389
check_symbol_exists(strerror_r "string.h" HAS_STRERROR_R)

tests/iio_stresstest.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <errno.h>
2929
#include <limits.h>
3030
#include <sys/time.h>
31+
#include <sys/sysctl.h>
3132

3233
#define MY_NAME "iio_stresstest"
3334

0 commit comments

Comments
 (0)