mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 10:13:51 +01:00
cmake: android support
Foundation/src/Error.cpp: ndk-r9 define _GNU_SOURCE in features.h but only the XSI-compliant strerror_r in string.h
This commit is contained in:
parent
5edb90c48e
commit
8b3561a525
@ -114,12 +114,12 @@ if(CMAKE_SYSTEM MATCHES "Windows")
|
|||||||
|
|
||||||
endif(CMAKE_SYSTEM MATCHES "Windows")
|
endif(CMAKE_SYSTEM MATCHES "Windows")
|
||||||
|
|
||||||
if (CMAKE_SYSTEM MATCHES "Linux")
|
if (CMAKE_SYSTEM MATCHES "Linux" AND NOT ANDROID )
|
||||||
add_definitions( -DPOCO_OS_FAMILY_UNIX )
|
add_definitions( -DPOCO_OS_FAMILY_UNIX )
|
||||||
# Standard 'must be' defines
|
# Standard 'must be' defines
|
||||||
add_definitions( -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
|
add_definitions( -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
|
||||||
set(SYSLIBS pthread dl rt)
|
set(SYSLIBS pthread dl rt)
|
||||||
endif(CMAKE_SYSTEM MATCHES "Linux")
|
endif(CMAKE_SYSTEM MATCHES "Linux" AND NOT ANDROID )
|
||||||
|
|
||||||
if (CMAKE_SYSTEM MATCHES "SunOS")
|
if (CMAKE_SYSTEM MATCHES "SunOS")
|
||||||
add_definitions( -DPOCO_OS_FAMILY_UNIX )
|
add_definitions( -DPOCO_OS_FAMILY_UNIX )
|
||||||
@ -149,6 +149,11 @@ if (IOS)
|
|||||||
add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS -DPOCO_NO_NET_IFTYPES )
|
add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS -DPOCO_NO_NET_IFTYPES )
|
||||||
endif(IOS)
|
endif(IOS)
|
||||||
|
|
||||||
|
#ANDROID
|
||||||
|
if (ANDROID)
|
||||||
|
add_definitions( -DPOCO_ANDROID -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING -DPOCO_NO_SHAREDMEMORY )
|
||||||
|
endif()
|
||||||
|
|
||||||
IF (ENABLE_TESTS)
|
IF (ENABLE_TESTS)
|
||||||
add_subdirectory(CppUnit)
|
add_subdirectory(CppUnit)
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
@ -75,10 +75,10 @@ namespace Poco {
|
|||||||
without -D_GNU_SOURCE is needed, otherwise the GNU version is
|
without -D_GNU_SOURCE is needed, otherwise the GNU version is
|
||||||
preferred.
|
preferred.
|
||||||
*/
|
*/
|
||||||
#ifdef _GNU_SOURCE
|
#if defined _GNU_SOURCE && !POCO_ANDROID
|
||||||
char errmsg[256] = "";
|
char errmsg[256] = "";
|
||||||
return std::string(strerror_r(errorCode, errmsg, 256));
|
return std::string(strerror_r(errorCode, errmsg, 256));
|
||||||
#elif (_XOPEN_SOURCE >= 600)
|
#elif (_XOPEN_SOURCE >= 600) || POCO_ANDROID
|
||||||
char errmsg[256] = "";
|
char errmsg[256] = "";
|
||||||
strerror_r(errorCode, errmsg, 256);
|
strerror_r(errorCode, errmsg, 256);
|
||||||
return errmsg;
|
return errmsg;
|
||||||
|
@ -143,7 +143,10 @@ set(TESTUNIT "${LIBNAME}-testrunner")
|
|||||||
|
|
||||||
add_executable( ${TESTUNIT} ${TEST_SRCS} )
|
add_executable( ${TESTUNIT} ${TEST_SRCS} )
|
||||||
#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} )
|
#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} )
|
||||||
target_link_libraries( ${TESTUNIT} PocoFoundation CppUnit pthread)
|
target_link_libraries( ${TESTUNIT} PocoFoundation CppUnit )
|
||||||
|
if (NOT ANDROID)
|
||||||
|
target_link_libraries( ${TESTUNIT} pthread)
|
||||||
|
endif ()
|
||||||
|
|
||||||
add_executable( TestApp src/TestApp.cpp )
|
add_executable( TestApp src/TestApp.cpp )
|
||||||
#set_target_properties( TestApp PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} )
|
#set_target_properties( TestApp PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} )
|
||||||
|
Loading…
Reference in New Issue
Block a user