<a href="https://lwn.net/Articles/558106/">Learn more ...</a>
+@section main-embedded Embedded platforms
+
+It is possible that some embedded platforms do not provide definitions for
+required types or that the guards to protect them are not defined. To address
+this issue you can create a header file name 'cmocka_platform.h' with the
+required types and definitions. After that point cmake to the include directory
+using:
+
+<pre>
+ cmake -DCMOCKA_PLATFORM_INCLUDE=/home/compiler/my/include_directory ..
+</pre>
+
@section main-threads Threading
cmocka is not fully thread safe and it is not the goal of it to be it. We have
project(cmocka-library C)
+set(CMOCKA_PLATFORM_INCLUDE CACHE PATH "Path to include directory for cmocka_platform.h")
+
set(CMOCKA_PUBLIC_INCLUDE_DIRS
${CMAKE_SOURCE_DIR}/include
+ ${CMOCKA_PLATFORM_INCLUDE}
CACHE INTERNAL "cmocka public include directories"
)
)
add_definitions(-DHAVE_CONFIG_H=1)
+if (CMOCKA_PLATFORM_INCLUDE)
+ add_definitions(-DCMOCKA_PLATFORM_INCLUDE=1)
+endif()
add_library(${CMOCKA_SHARED_LIBRARY} SHARED ${cmocka_SRCS})
#include <signal.h>
#endif /* _WIN32 */
+/*
+ * This allows to add a platform specific header file. Some embedded platforms
+ * sometimes miss certain types and definitions.
+ *
+ * Example:
+ *
+ * typedef unsigned long int uintptr_t
+ * #define _UINTPTR_T 1
+ * #define _UINTPTR_T_DEFINED 1
+ */
+#ifdef CMOCKA_PLATFORM_INCLUDE
+# include "cmocka_platform.h"
+#endif /* CMOCKA_PLATFORM_INCLUDE */
+
#include <cmocka_private.h>
#include <cmocka.h>