diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d02f136d..8904d21a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,12 +114,12 @@ if(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 ) # Standard 'must be' defines add_definitions( -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) set(SYSLIBS pthread dl rt) -endif(CMAKE_SYSTEM MATCHES "Linux") +endif(CMAKE_SYSTEM MATCHES "Linux" AND NOT ANDROID ) if (CMAKE_SYSTEM MATCHES "SunOS") 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 ) endif(IOS) +#ANDROID +if (ANDROID) + add_definitions( -DPOCO_ANDROID -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING -DPOCO_NO_SHAREDMEMORY ) +endif() + IF (ENABLE_TESTS) add_subdirectory(CppUnit) ENDIF () diff --git a/Foundation/src/Error.cpp b/Foundation/src/Error.cpp index 1491f3e5c..befec869e 100644 --- a/Foundation/src/Error.cpp +++ b/Foundation/src/Error.cpp @@ -75,10 +75,10 @@ namespace Poco { without -D_GNU_SOURCE is needed, otherwise the GNU version is preferred. */ -#ifdef _GNU_SOURCE +#if defined _GNU_SOURCE && !POCO_ANDROID char errmsg[256] = ""; return std::string(strerror_r(errorCode, errmsg, 256)); -#elif (_XOPEN_SOURCE >= 600) +#elif (_XOPEN_SOURCE >= 600) || POCO_ANDROID char errmsg[256] = ""; strerror_r(errorCode, errmsg, 256); return errmsg; diff --git a/Foundation/testsuite/CMakeLists.txt b/Foundation/testsuite/CMakeLists.txt index 3385d124a..5bd1de418 100644 --- a/Foundation/testsuite/CMakeLists.txt +++ b/Foundation/testsuite/CMakeLists.txt @@ -143,7 +143,10 @@ set(TESTUNIT "${LIBNAME}-testrunner") add_executable( ${TESTUNIT} ${TEST_SRCS} ) #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 ) #set_target_properties( TestApp PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} )