From 8b3561a5257b147b253a8e1fe4b548e78421fbe2 Mon Sep 17 00:00:00 2001 From: Csaba Keszegh Date: Fri, 1 Nov 2013 16:46:20 +0100 Subject: [PATCH 1/3] 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 --- CMakeLists.txt | 9 +++++++-- Foundation/src/Error.cpp | 4 ++-- Foundation/testsuite/CMakeLists.txt | 5 ++++- 3 files changed, 13 insertions(+), 5 deletions(-) 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} ) From edf0ab9dbacb456c1fa7f5d409f35c5788a1d95d Mon Sep 17 00:00:00 2001 From: Csaba Keszegh Date: Fri, 1 Nov 2013 16:47:27 +0100 Subject: [PATCH 2/3] cmake: missing files added to CMakeLists.txt fix: linker error for testsuits --- Foundation/CMakeLists.txt | 1 + Foundation/testsuite/CMakeLists.txt | 1 + Net/CMakeLists.txt | 1 + 3 files changed, 3 insertions(+) diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt index 0f6b3f69a..b41968af0 100644 --- a/Foundation/CMakeLists.txt +++ b/Foundation/CMakeLists.txt @@ -52,6 +52,7 @@ set( BASE_SRCS src/DigestEngine.cpp src/DigestStream.cpp src/DirectoryIterator.cpp + src/DirectoryIteratorStrategy.cpp src/DirectoryWatcher.cpp src/Environment.cpp src/Error.cpp diff --git a/Foundation/testsuite/CMakeLists.txt b/Foundation/testsuite/CMakeLists.txt index 5bd1de418..4862b1f69 100644 --- a/Foundation/testsuite/CMakeLists.txt +++ b/Foundation/testsuite/CMakeLists.txt @@ -52,6 +52,7 @@ src/HexBinaryTest.cpp src/LRUCacheTest.cpp src/LineEndingConverterTest.cpp src/LinearHashTableTest.cpp +src/ListMapTest.cpp src/LocalDateTimeTest.cpp src/LogStreamTest.cpp src/LoggerTest.cpp diff --git a/Net/CMakeLists.txt b/Net/CMakeLists.txt index 0c0e619b6..b5edd8a5a 100644 --- a/Net/CMakeLists.txt +++ b/Net/CMakeLists.txt @@ -65,6 +65,7 @@ set( BASE_SRCS src/NullPartHandler.cpp src/PartHandler.cpp src/PartSource.cpp + src/PartStore.cpp src/POP3ClientSession.cpp src/QuotedPrintableDecoder.cpp src/QuotedPrintableEncoder.cpp From 638b10856bffef2242caf3d5d259a13919270ed1 Mon Sep 17 00:00:00 2001 From: Csaba Keszegh Date: Fri, 1 Nov 2013 16:50:30 +0100 Subject: [PATCH 3/3] fix: configure_file error if CMAKE_MODULE_PATH had multiple directories --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8904d21a4..eb2213c4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,7 +185,7 @@ endif(APRUTIL_FOUND AND APACHE_FOUND) ############################################################# # Uninstall stuff see: http://www.vtk.org/Wiki/CMake_FAQ CONFIGURE_FILE( - "${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)