mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-23 07:24:40 +01:00
commit
238b12b899
@ -26,24 +26,10 @@ target_include_directories( "${LIBNAME}"
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
||||
|
@ -27,24 +27,11 @@ target_include_directories( "${LIBNAME}"
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
@ -34,54 +34,41 @@ target_include_directories( "${LIBNAME}"
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if(ENABLE_DATA_SQLITE)
|
||||
# SQlite3 is built in any case
|
||||
add_subdirectory( SQLite )
|
||||
# SQlite3 is built in any case
|
||||
add_subdirectory( SQLite )
|
||||
endif(ENABLE_DATA_SQLITE)
|
||||
|
||||
if(ENABLE_DATA_MYSQL)
|
||||
find_package(MySQL)
|
||||
if(MYSQL_FOUND)
|
||||
include_directories("${MYSQL_INCLUDE_DIR}")
|
||||
message(STATUS "MySQL Support Enabled")
|
||||
add_subdirectory( MySQL )
|
||||
else()
|
||||
message(STATUS "MySQL Support Disabled - no MySQL library")
|
||||
endif(MYSQL_FOUND)
|
||||
find_package(MySQL)
|
||||
if(MYSQL_FOUND)
|
||||
include_directories("${MYSQL_INCLUDE_DIR}")
|
||||
message(STATUS "MySQL Support Enabled")
|
||||
add_subdirectory( MySQL )
|
||||
else()
|
||||
message(STATUS "MySQL Support Disabled - no MySQL library")
|
||||
endif(MYSQL_FOUND)
|
||||
endif(ENABLE_DATA_MYSQL)
|
||||
|
||||
if(ENABLE_DATA_ODBC)
|
||||
find_package(ODBC)
|
||||
if(WIN32 AND NOT WINCE)
|
||||
set(ODBC_LIBRARIES "odbc32" "odbccp32")
|
||||
message(STATUS "Windows native ODBC Support Enabled")
|
||||
add_subdirectory( ODBC )
|
||||
else(WIN32 AND NOT WINCE)
|
||||
if(ODBC_FOUND)
|
||||
include_directories("${ODBC_INCLUDE_DIRECTORIES}")
|
||||
message(STATUS "ODBC Support Enabled")
|
||||
find_package(ODBC)
|
||||
if(WIN32 AND NOT WINCE)
|
||||
set(ODBC_LIBRARIES "odbc32" "odbccp32")
|
||||
message(STATUS "Windows native ODBC Support Enabled")
|
||||
add_subdirectory( ODBC )
|
||||
else()
|
||||
message(STATUS "ODBC Support Disabled - no ODBC runtime")
|
||||
endif()
|
||||
endif(WIN32 AND NOT WINCE)
|
||||
else(WIN32 AND NOT WINCE)
|
||||
if(ODBC_FOUND)
|
||||
include_directories("${ODBC_INCLUDE_DIRECTORIES}")
|
||||
message(STATUS "ODBC Support Enabled")
|
||||
add_subdirectory( ODBC )
|
||||
else()
|
||||
message(STATUS "ODBC Support Disabled - no ODBC runtime")
|
||||
endif()
|
||||
endif(WIN32 AND NOT WINCE)
|
||||
endif(ENABLE_DATA_ODBC)
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
|
@ -27,22 +27,9 @@ target_include_directories( "${LIBNAME}"
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
|
@ -27,22 +27,9 @@ target_include_directories( "${LIBNAME}"
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
|
@ -48,22 +48,9 @@ target_include_directories( "${LIBNAME}"
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
|
@ -121,22 +121,8 @@ target_include_directories( "${LIBNAME}"
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory( samples )
|
||||
|
@ -148,9 +148,9 @@ protected:
|
||||
//
|
||||
|
||||
|
||||
#if defined(GNUC) && (GNUC > 4) && (GNUC_MINOR > 6)
|
||||
#if defined(POCO_COMPILER_GCC) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406)
|
||||
GCC_DIAG_OFF(unused-local-typedefs) // supress numerous gcc warnings
|
||||
#endif // (GNUC) && (GNUC > 4) && (GNUC_MINOR > 6)
|
||||
#endif // POCO_COMPILER_GCC && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406)
|
||||
|
||||
|
||||
template <bool x>
|
||||
|
@ -74,6 +74,66 @@ public:
|
||||
return char_traits::eof();
|
||||
}
|
||||
|
||||
virtual pos_type seekoff(off_type off, std::ios_base::seekdir way, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out)
|
||||
{
|
||||
const pos_type fail = off_type(-1);
|
||||
off_type newoff = off_type(-1);
|
||||
|
||||
if ((which & std::ios_base::in) != 0)
|
||||
{
|
||||
if (this->gptr() == 0)
|
||||
return fail;
|
||||
|
||||
switch (way)
|
||||
{
|
||||
case std::ios_base::beg:
|
||||
newoff = 0;
|
||||
break;
|
||||
case std::ios_base::cur:
|
||||
// cur is not valid if both in and out are specified (Condition 3)
|
||||
if ((which & std::ios_base::out) != 0)
|
||||
return fail;
|
||||
newoff = this->gptr() - this->eback();
|
||||
break;
|
||||
case std::ios_base::end:
|
||||
newoff = this->egptr() - this->eback();
|
||||
break;
|
||||
}
|
||||
|
||||
if ((newoff + off) < 0 || (this->egptr() - this->eback()) < (newoff + off))
|
||||
return fail;
|
||||
this->setg(this->eback(), this->eback() + newoff + off, this->egptr());
|
||||
}
|
||||
|
||||
if ((which & std::ios_base::out) != 0)
|
||||
{
|
||||
if (this->pptr() == 0)
|
||||
return fail;
|
||||
|
||||
switch (way)
|
||||
{
|
||||
case std::ios_base::beg:
|
||||
newoff = 0;
|
||||
break;
|
||||
case std::ios_base::cur:
|
||||
// cur is not valid if both in and out are specified (Condition 3)
|
||||
if ((which & std::ios_base::in) != 0)
|
||||
return fail;
|
||||
newoff = this->pptr() - this->pbase();
|
||||
break;
|
||||
case std::ios_base::end:
|
||||
newoff = this->epptr() - this->pbase();
|
||||
break;
|
||||
}
|
||||
|
||||
if (newoff + off < 0 || (this->epptr() - this->pbase()) < newoff + off)
|
||||
return fail;
|
||||
this->pbump((int)(newoff + off - (this->pptr() - this->pbase())));
|
||||
}
|
||||
|
||||
return newoff;
|
||||
}
|
||||
|
||||
virtual int sync()
|
||||
{
|
||||
return 0;
|
||||
|
@ -66,9 +66,8 @@ public:
|
||||
|
||||
enum
|
||||
{
|
||||
D_INFINITE = 0
|
||||
D_INFINITE = 0 /// Constant for infinite traverse depth.
|
||||
};
|
||||
/// Constant for infinite traverse depth.
|
||||
|
||||
RecursiveDirectoryIterator()
|
||||
/// Creates the end iterator.
|
||||
@ -76,31 +75,34 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
RecursiveDirectoryIterator(const std::string& path, UInt16 maxDepth = D_INFINITE);
|
||||
RecursiveDirectoryIterator(const std::string& path, UInt16 maxDepth = D_INFINITE)
|
||||
/// Creates a recursive directory iterator for the given path.
|
||||
|
||||
RecursiveDirectoryIterator(const MyType& iterator)
|
||||
/// Creates a copy of another recursive directory iterator.
|
||||
: _pImpl(iterator._pImpl), _path(iterator._path), _file(iterator._file)
|
||||
: _pImpl(new ImplType(path, maxDepth)), _path(Path(_pImpl->get())), _file(_path)
|
||||
{
|
||||
}
|
||||
|
||||
RecursiveDirectoryIterator(const DirectoryIterator& iterator, UInt16 maxDepth = D_INFINITE)
|
||||
RecursiveDirectoryIterator(const MyType& iterator):
|
||||
/// Creates a copy of another recursive directory iterator.
|
||||
_pImpl(iterator._pImpl), _path(iterator._path), _file(iterator._file)
|
||||
{
|
||||
}
|
||||
|
||||
RecursiveDirectoryIterator(const DirectoryIterator& iterator, UInt16 maxDepth = D_INFINITE):
|
||||
/// Creates a recursive directory iterator for the path of
|
||||
/// non-recursive directory iterator.
|
||||
: _pImpl(new ImplType(iterator->path(), maxDepth)), _path(Path(_pImpl->get())), _file(_path)
|
||||
_pImpl(new ImplType(iterator->path(), maxDepth)), _path(Path(_pImpl->get())), _file(_path)
|
||||
{
|
||||
}
|
||||
|
||||
RecursiveDirectoryIterator(const File& file, UInt16 maxDepth = D_INFINITE)
|
||||
RecursiveDirectoryIterator(const File& file, UInt16 maxDepth = D_INFINITE):
|
||||
/// Creates a recursive directory iterator for the given path.
|
||||
: _pImpl(new ImplType(file.path(), maxDepth)), _path(Path(_pImpl->get())), _file(_path)
|
||||
_pImpl(new ImplType(file.path(), maxDepth)), _path(Path(_pImpl->get())), _file(_path)
|
||||
{
|
||||
}
|
||||
|
||||
RecursiveDirectoryIterator(const Path& path, UInt16 maxDepth = D_INFINITE)
|
||||
RecursiveDirectoryIterator(const Path& path, UInt16 maxDepth = D_INFINITE):
|
||||
/// Creates a recursive directory iterator for the given path.
|
||||
: _pImpl(new ImplType(path.toString(), maxDepth)), _path(Path(_pImpl->get())), _file(_path)
|
||||
_pImpl(new ImplType(path.toString(), maxDepth)), _path(Path(_pImpl->get())), _file(_path)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <mach/clock.h>
|
||||
#elif defined(POCO_OS_FAMILY_UNIX)
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#elif defined(POCO_VXWORKS)
|
||||
#include <timers.h>
|
||||
#elif defined(POCO_OS_FAMILY_WINDOWS)
|
||||
|
@ -288,12 +288,8 @@ void FileImpl::copyToImpl(const std::string& path) const
|
||||
{
|
||||
poco_assert (!_path.empty());
|
||||
|
||||
if (CopyFileA(_path.c_str(), path.c_str(), FALSE) != 0)
|
||||
{
|
||||
FileImpl copy(path);
|
||||
copy.setWriteableImpl(true);
|
||||
}
|
||||
else handleLastErrorImpl(_path);
|
||||
if (CopyFileA(_path.c_str(), path.c_str(), FALSE) == 0)
|
||||
handleLastErrorImpl(_path);
|
||||
}
|
||||
|
||||
|
||||
|
@ -294,12 +294,8 @@ void FileImpl::copyToImpl(const std::string& path) const
|
||||
|
||||
std::wstring upath;
|
||||
UnicodeConverter::toUTF16(path, upath);
|
||||
if (CopyFileW(_upath.c_str(), upath.c_str(), FALSE) != 0)
|
||||
{
|
||||
FileImpl copy(path);
|
||||
copy.setWriteableImpl(true);
|
||||
}
|
||||
else handleLastErrorImpl(_path);
|
||||
if (CopyFileW(_upath.c_str(), upath.c_str(), FALSE) == 0)
|
||||
handleLastErrorImpl(_path);
|
||||
}
|
||||
|
||||
|
||||
|
@ -285,12 +285,8 @@ void FileImpl::copyToImpl(const std::string& path) const
|
||||
|
||||
std::wstring upath;
|
||||
UnicodeConverter::toUTF16(path, upath);
|
||||
if (CopyFileW(_upath.c_str(), upath.c_str(), FALSE) != 0)
|
||||
{
|
||||
FileImpl copy(path);
|
||||
copy.setWriteableImpl(true);
|
||||
}
|
||||
else handleLastErrorImpl(_path);
|
||||
if (CopyFileW(_upath.c_str(), upath.c_str(), FALSE) == 0)
|
||||
handleLastErrorImpl(_path);
|
||||
}
|
||||
|
||||
|
||||
|
@ -208,6 +208,7 @@ void Timer::run()
|
||||
{
|
||||
Poco::ErrorHandler::handle();
|
||||
}
|
||||
Poco::FastMutex::ScopedLock lock(_mutex);
|
||||
interval = _periodicInterval;
|
||||
}
|
||||
_nextInvocation += static_cast<Clock::ClockVal>(interval)*1000;
|
||||
|
@ -372,9 +372,11 @@ void FileTest::testCopy()
|
||||
|
||||
File f1("testfile.dat");
|
||||
TemporaryFile f2;
|
||||
f1.copyTo(f2.path());
|
||||
f1.setReadOnly().copyTo(f2.path());
|
||||
assert (f2.exists());
|
||||
assert (!f2.canWrite());
|
||||
assert (f1.getSize() == f2.getSize());
|
||||
f1.setWriteable().remove();
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,8 +13,10 @@
|
||||
#include "MemoryStreamTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/Buffer.h"
|
||||
#include "Poco/MemoryStream.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using Poco::MemoryInputStream;
|
||||
using Poco::MemoryOutputStream;
|
||||
@ -86,6 +88,343 @@ void MemoryStreamTest::testOutput()
|
||||
assert (ostr2.fail());
|
||||
}
|
||||
|
||||
void MemoryStreamTest::testTell()
|
||||
{
|
||||
Poco::Buffer<char> buffer(1024);
|
||||
Poco::MemoryOutputStream ostr(buffer.begin(), buffer.size());
|
||||
ostr << 'H' << 'e' << 'l' << 'l' << 'o' << '\0';
|
||||
std::streamoff np = ostr.tellp();
|
||||
assert (np == 6);
|
||||
|
||||
Poco::MemoryInputStream istr(buffer.begin(), buffer.size());
|
||||
|
||||
char c;
|
||||
istr >> c;
|
||||
assert (c == 'H');
|
||||
|
||||
istr >> c;
|
||||
assert (c == 'e');
|
||||
|
||||
istr >> c;
|
||||
assert (c == 'l');
|
||||
|
||||
std::streamoff ng = istr.tellg();
|
||||
assert (ng == 3);
|
||||
}
|
||||
|
||||
|
||||
void MemoryStreamTest::testInputSeek()
|
||||
{
|
||||
Poco::Buffer<char> buffer(9);
|
||||
Poco::MemoryOutputStream ostr(buffer.begin(), buffer.size());
|
||||
ostr << '1' << '2' << '3' << '4' << '5' << '6' << '7' << '8' << '9';
|
||||
|
||||
Poco::MemoryInputStream istr(buffer.begin(), buffer.size());
|
||||
char c;
|
||||
|
||||
istr >> c;
|
||||
assert (c == '1');
|
||||
|
||||
istr.seekg(3, std::ios_base::beg); // 3 from beginning
|
||||
istr >> c; // now that makes 4
|
||||
assert (4 == istr.tellg());
|
||||
assert (c == '4');
|
||||
|
||||
istr.seekg(2, std::ios_base::cur); // now that makes 6
|
||||
istr >> c; // now that makes 7
|
||||
assert (7 == istr.tellg());
|
||||
assert (c == '7');
|
||||
|
||||
istr.seekg(-7, std::ios_base::end); // so that puts us at 9-7=2
|
||||
istr >> c; // now 3
|
||||
assert (3 == istr.tellg());
|
||||
assert (c == '3');
|
||||
|
||||
|
||||
istr.seekg(9, std::ios_base::beg);
|
||||
assert (istr.good());
|
||||
assert (9 == istr.tellg());
|
||||
|
||||
{
|
||||
Poco::MemoryInputStream istr2(buffer.begin(), buffer.size());
|
||||
istr2.seekg(10, std::ios_base::beg);
|
||||
assert (istr2.fail());
|
||||
}
|
||||
|
||||
|
||||
istr.seekg(-9, std::ios_base::end);
|
||||
assert (istr.good());
|
||||
assert (0 == istr.tellg());
|
||||
|
||||
{
|
||||
Poco::MemoryInputStream istr2(buffer.begin(), buffer.size());
|
||||
istr2.seekg(-10, std::ios_base::end);
|
||||
assert (istr2.fail());
|
||||
}
|
||||
|
||||
|
||||
istr.seekg(0, std::ios_base::beg);
|
||||
assert (istr.good());
|
||||
assert (0 == istr.tellg());
|
||||
|
||||
{
|
||||
Poco::MemoryInputStream istr2(buffer.begin(), buffer.size());
|
||||
istr2.seekg(-1, std::ios_base::beg);
|
||||
assert (istr2.fail());
|
||||
}
|
||||
|
||||
|
||||
istr.seekg(0, std::ios_base::end);
|
||||
assert (istr.good());
|
||||
assert (9 == istr.tellg());
|
||||
|
||||
{
|
||||
Poco::MemoryInputStream istr2(buffer.begin(), buffer.size());
|
||||
istr2.seekg(1, std::ios_base::end);
|
||||
assert (istr2.fail());
|
||||
}
|
||||
|
||||
|
||||
istr.seekg(3, std::ios_base::beg);
|
||||
assert (istr.good());
|
||||
assert (3 == istr.tellg());
|
||||
istr.seekg(6, std::ios_base::cur);
|
||||
assert (istr.good());
|
||||
assert (9 == istr.tellg());
|
||||
|
||||
{
|
||||
Poco::MemoryInputStream istr2(buffer.begin(), buffer.size());
|
||||
istr2.seekg(4, std::ios_base::beg);
|
||||
istr2.seekg(6, std::ios_base::cur);
|
||||
assert (istr2.fail());
|
||||
}
|
||||
|
||||
|
||||
istr.seekg(-4, std::ios_base::end);
|
||||
assert (istr.good());
|
||||
assert (5 == istr.tellg());
|
||||
istr.seekg(4, std::ios_base::cur);
|
||||
assert (istr.good());
|
||||
assert (9 == istr.tellg());
|
||||
|
||||
{
|
||||
Poco::MemoryInputStream istr2(buffer.begin(), buffer.size());
|
||||
istr2.seekg(-4, std::ios_base::end);
|
||||
istr2.seekg(5, std::ios_base::cur);
|
||||
assert (istr2.fail());
|
||||
}
|
||||
|
||||
|
||||
istr.seekg(4, std::ios_base::beg);
|
||||
assert (istr.good());
|
||||
assert (4 == istr.tellg());
|
||||
istr.seekg(-4, std::ios_base::cur);
|
||||
assert (istr.good());
|
||||
assert (0 == istr.tellg());
|
||||
|
||||
{
|
||||
Poco::MemoryInputStream istr2(buffer.begin(), buffer.size());
|
||||
istr2.seekg(4, std::ios_base::beg);
|
||||
istr2.seekg(-5, std::ios_base::cur);
|
||||
assert (istr2.fail());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MemoryStreamTest::testInputSeekVsStringStream()
|
||||
{
|
||||
Poco::Buffer<char> buffer(9);
|
||||
Poco::MemoryOutputStream ostr(buffer.begin(), buffer.size());
|
||||
ostr << '1' << '2' << '3' << '4' << '5' << '6' << '7' << '8' << '9';
|
||||
|
||||
std::stringstream sss;
|
||||
sss << '1' << '2' << '3' << '4' << '5' << '6' << '7' << '8' << '9';
|
||||
|
||||
Poco::MemoryInputStream mis(buffer.begin(), buffer.size());
|
||||
|
||||
char x, y;
|
||||
|
||||
sss >> x;
|
||||
mis >> y;
|
||||
assert (x == y);
|
||||
|
||||
sss.seekg(3, std::ios_base::beg);
|
||||
mis.seekg(3, std::ios_base::beg);
|
||||
sss >> x;
|
||||
mis >> y;
|
||||
assert (x == y);
|
||||
assert (sss.tellg() == mis.tellg());
|
||||
|
||||
sss.seekg(2, std::ios_base::cur);
|
||||
mis.seekg(2, std::ios_base::cur);
|
||||
sss >> x;
|
||||
mis >> y;
|
||||
assert (x == y);
|
||||
assert (sss.tellg() == mis.tellg());
|
||||
|
||||
sss.seekg(-7, std::ios_base::end);
|
||||
mis.seekg(-7, std::ios_base::end);
|
||||
sss >> x;
|
||||
mis >> y;
|
||||
assert (x == y);
|
||||
assert (sss.tellg() == mis.tellg());
|
||||
}
|
||||
|
||||
|
||||
void MemoryStreamTest::testOutputSeek()
|
||||
{
|
||||
Poco::Buffer<char> buffer(9);
|
||||
Poco::MemoryOutputStream ostr(buffer.begin(), buffer.size());
|
||||
ostr << '1' << '2' << '3' << '4' << '5' << '6' << '7' << '8' << '9';
|
||||
|
||||
ostr.seekp(4, std::ios_base::beg); // 4 from beginning
|
||||
ostr << 'a'; // and that makes 5 (zero index 4)
|
||||
assert (5 == ostr.tellp());
|
||||
assert (buffer[4] == 'a');
|
||||
|
||||
ostr.seekp(2, std::ios_base::cur); // and this makes 7
|
||||
ostr << 'b'; // and this makes 8 (zero index 7)
|
||||
assert (8 == ostr.tellp());
|
||||
assert (buffer[7] == 'b');
|
||||
|
||||
ostr.seekp(-3, std::ios_base::end); // 9-3=6 from the beginning
|
||||
ostr << 'c'; // and this makes 7 (zero index 6)
|
||||
assert (7 == ostr.tellp());
|
||||
assert (buffer[6] == 'c');
|
||||
|
||||
|
||||
ostr.seekp(9, std::ios_base::beg);
|
||||
assert (ostr.good());
|
||||
assert (9 == ostr.tellp());
|
||||
|
||||
{
|
||||
Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size());
|
||||
ostr2.seekp(10, std::ios_base::beg);
|
||||
assert (ostr2.fail());
|
||||
}
|
||||
|
||||
|
||||
ostr.seekp(-9, std::ios_base::end);
|
||||
assert (ostr.good());
|
||||
assert (0 == ostr.tellp());
|
||||
|
||||
{
|
||||
Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size());
|
||||
ostr2.seekp(-10, std::ios_base::end);
|
||||
assert (ostr2.fail());
|
||||
}
|
||||
|
||||
|
||||
ostr.seekp(0, std::ios_base::beg);
|
||||
assert (ostr.good());
|
||||
assert (0 == ostr.tellp());
|
||||
|
||||
{
|
||||
Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size());
|
||||
ostr2.seekp(-1, std::ios_base::beg);
|
||||
assert (ostr2.fail());
|
||||
}
|
||||
|
||||
|
||||
ostr.seekp(0, std::ios_base::end);
|
||||
assert (ostr.good());
|
||||
assert (9 == ostr.tellp());
|
||||
|
||||
{
|
||||
Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size());
|
||||
ostr2.seekp(1, std::ios_base::end);
|
||||
assert (ostr2.fail());
|
||||
}
|
||||
|
||||
|
||||
ostr.seekp(3, std::ios_base::beg);
|
||||
assert (ostr.good());
|
||||
assert (3 == ostr.tellp());
|
||||
ostr.seekp(6, std::ios_base::cur);
|
||||
assert (ostr.good());
|
||||
assert (9 == ostr.tellp());
|
||||
|
||||
{
|
||||
Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size());
|
||||
ostr2.seekp(4, std::ios_base::beg);
|
||||
ostr2.seekp(6, std::ios_base::cur);
|
||||
assert (ostr2.fail());
|
||||
}
|
||||
|
||||
|
||||
ostr.seekp(-4, std::ios_base::end);
|
||||
assert (ostr.good());
|
||||
assert (5 == ostr.tellp());
|
||||
ostr.seekp(4, std::ios_base::cur);
|
||||
assert (ostr.good());
|
||||
assert (9 == ostr.tellp());
|
||||
|
||||
{
|
||||
Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size());
|
||||
ostr2.seekp(-4, std::ios_base::end);
|
||||
ostr2.seekp(5, std::ios_base::cur);
|
||||
assert (ostr2.fail());
|
||||
}
|
||||
|
||||
|
||||
ostr.seekp(4, std::ios_base::beg);
|
||||
assert (ostr.good());
|
||||
assert (4 == ostr.tellp());
|
||||
ostr.seekp(-4, std::ios_base::cur);
|
||||
assert (ostr.good());
|
||||
assert (0 == ostr.tellp());
|
||||
|
||||
{
|
||||
Poco::MemoryOutputStream ostr2(buffer.begin(), buffer.size());
|
||||
ostr2.seekp(4, std::ios_base::beg);
|
||||
ostr2.seekp(-5, std::ios_base::cur);
|
||||
assert (ostr2.fail());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MemoryStreamTest::testOutputSeekVsStringStream()
|
||||
{
|
||||
Poco::Buffer<char> buffer(9);
|
||||
Poco::MemoryOutputStream mos(buffer.begin(), buffer.size());
|
||||
mos << '1' << '2' << '3' << '4' << '5' << '6' << '7' << '8' << '9';
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << '1' << '2' << '3' << '4' << '5' << '6' << '7' << '8' << '9';
|
||||
|
||||
mos.seekp(4, std::ios_base::beg);
|
||||
oss.seekp(4, std::ios_base::beg);
|
||||
mos << 'a';
|
||||
oss << 'a';
|
||||
assert (oss.str()[4] == 'a');
|
||||
assert (buffer[4] == oss.str()[4]);
|
||||
assert (oss.tellp() == mos.tellp());
|
||||
|
||||
mos.seekp(2, std::ios_base::cur);
|
||||
oss.seekp(2, std::ios_base::cur);
|
||||
mos << 'b';
|
||||
oss << 'b';
|
||||
assert (oss.str()[7] == 'b');
|
||||
assert (buffer[7] == oss.str()[7]);
|
||||
assert (oss.tellp() == mos.tellp());
|
||||
|
||||
mos.seekp(-3, std::ios_base::end);
|
||||
oss.seekp(-3, std::ios_base::end);
|
||||
mos << 'c';
|
||||
oss << 'c';
|
||||
assert (oss.str()[6] == 'c');
|
||||
assert (buffer[6] == oss.str()[6]);
|
||||
assert (oss.tellp() == mos.tellp());
|
||||
|
||||
mos.seekp(-2, std::ios_base::cur);
|
||||
oss.seekp(-2, std::ios_base::cur);
|
||||
mos << 'd';
|
||||
oss << 'd';
|
||||
assert (oss.str()[5] == 'd');
|
||||
assert (buffer[5] == oss.str()[5]);
|
||||
assert (oss.tellp() == mos.tellp());
|
||||
}
|
||||
|
||||
|
||||
void MemoryStreamTest::setUp()
|
||||
{
|
||||
@ -103,6 +442,11 @@ CppUnit::Test* MemoryStreamTest::suite()
|
||||
|
||||
CppUnit_addTest(pSuite, MemoryStreamTest, testInput);
|
||||
CppUnit_addTest(pSuite, MemoryStreamTest, testOutput);
|
||||
CppUnit_addTest(pSuite, MemoryStreamTest, testTell);
|
||||
CppUnit_addTest(pSuite, MemoryStreamTest, testInputSeek);
|
||||
CppUnit_addTest(pSuite, MemoryStreamTest, testInputSeekVsStringStream);
|
||||
CppUnit_addTest(pSuite, MemoryStreamTest, testOutputSeek);
|
||||
CppUnit_addTest(pSuite, MemoryStreamTest, testOutputSeekVsStringStream);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
|
@ -28,6 +28,11 @@ public:
|
||||
|
||||
void testInput();
|
||||
void testOutput();
|
||||
void testTell();
|
||||
void testInputSeek();
|
||||
void testInputSeekVsStringStream();
|
||||
void testOutputSeek();
|
||||
void testOutputSeekVsStringStream();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
@ -26,25 +26,11 @@ target_include_directories( "${LIBNAME}"
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
||||
|
@ -25,25 +25,12 @@ target_include_directories( "${LIBNAME}"
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
||||
|
@ -34,25 +34,12 @@ target_include_directories( "${LIBNAME}"
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
||||
|
@ -25,25 +25,12 @@ target_include_directories( "${LIBNAME}"
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
||||
|
@ -25,26 +25,13 @@ target_include_directories( "${LIBNAME}"
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
#TODO: Looks like the samples use crypto somehow?
|
||||
#add_subdirectory(samples)
|
||||
#add_subdirectory(testsuite)
|
||||
#TODO: Looks like the samples use crypto somehow?
|
||||
#add_subdirectory(samples)
|
||||
#add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
||||
|
@ -130,25 +130,12 @@ target_include_directories( "${LIBNAME}"
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
||||
|
@ -19,5 +19,3 @@ install(
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
#POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
|
@ -19,5 +19,3 @@ install(
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
#POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
|
@ -15,5 +15,3 @@ install(
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
#POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
|
@ -1,6 +1,13 @@
|
||||
POCO C++ Libraries [![Build Status](https://travis-ci.org/pocoproject/poco.png?branch=develop)](https://travis-ci.org/pocoproject/poco)
|
||||
POCO C++ Libraries
|
||||
==================
|
||||
|
||||
Build Status
|
||||
------------
|
||||
|
||||
- Travis: [![Travis Build Status](https://travis-ci.org/pocoproject/poco.png?branch=develop)](https://travis-ci.org/pocoproject/poco)
|
||||
- AppVeyor: [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/7iyrx3f233s3akae)](https://ci.appveyor.com/project/obiltschnig/poco)
|
||||
|
||||
|
||||
POrtable COmponents C++ Libraries are:
|
||||
--------------------------------------
|
||||
- A collection of C++ class libraries, conceptually similar to the Java Class Library, the .NET Framework or Apple’s Cocoa.
|
||||
|
@ -66,26 +66,13 @@ target_include_directories( "${LIBNAME}"
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(samples)
|
||||
# TODO: Add tests
|
||||
#add_subdirectory(testsuite)
|
||||
add_subdirectory(samples)
|
||||
# TODO: Add tests
|
||||
#add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
||||
|
@ -32,22 +32,8 @@ target_include_directories( "${LIBNAME}"
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(samples)
|
||||
|
@ -86,6 +86,8 @@ class Util_API Application: public Subsystem
|
||||
{
|
||||
public:
|
||||
typedef std::vector<std::string> ArgVec;
|
||||
typedef Poco::AutoPtr<Subsystem> SubsystemPtr;
|
||||
typedef std::vector<SubsystemPtr> SubsystemVec;
|
||||
|
||||
enum ExitCode
|
||||
/// Commonly used exit status codes.
|
||||
@ -218,6 +220,9 @@ public:
|
||||
/// Throws a NotFoundException if such a subsystem has
|
||||
/// not been registered.
|
||||
|
||||
SubsystemVec& subsystems();
|
||||
/// Returns a reference to the subsystem list
|
||||
|
||||
virtual int run();
|
||||
/// Runs the application by performing additional (un)initializations
|
||||
/// and calling the main() method.
|
||||
@ -367,8 +372,6 @@ private:
|
||||
void processOptions();
|
||||
bool findAppConfigFile(const std::string& appName, const std::string& extension, Poco::Path& path) const;
|
||||
|
||||
typedef Poco::AutoPtr<Subsystem> SubsystemPtr;
|
||||
typedef std::vector<SubsystemPtr> SubsystemVec;
|
||||
typedef Poco::AutoPtr<LayeredConfiguration> ConfigPtr;
|
||||
|
||||
ConfigPtr _pConfig;
|
||||
@ -410,6 +413,11 @@ template <class C> C& Application::getSubsystem() const
|
||||
throw Poco::NotFoundException("The subsystem has not been registered", typeid(C).name());
|
||||
}
|
||||
|
||||
inline Application::SubsystemVec& Application::subsystems()
|
||||
{
|
||||
return _subsystems;
|
||||
}
|
||||
|
||||
|
||||
inline bool Application::initialized() const
|
||||
{
|
||||
|
@ -53,11 +53,11 @@ public:
|
||||
Subsystem();
|
||||
/// Creates the Subsystem.
|
||||
|
||||
protected:
|
||||
virtual const char* name() const = 0;
|
||||
/// Returns the name of the subsystem.
|
||||
/// Must be implemented by subclasses.
|
||||
|
||||
protected:
|
||||
virtual void initialize(Application& app) = 0;
|
||||
/// Initializes the subsystem.
|
||||
|
||||
|
@ -46,6 +46,12 @@ public:
|
||||
REGT_STRING_EXPAND = 2,
|
||||
REGT_BINARY = 3,
|
||||
REGT_DWORD = 4,
|
||||
REGT_DWORD_BIG_ENDIAN = 5,
|
||||
REGT_LINK = 6,
|
||||
REGT_MULTI_STRING = 7,
|
||||
REGT_RESOURCE_LIST = 8,
|
||||
REGT_FULL_RESOURCE_DESCRIPTOR = 9,
|
||||
REGT_RESOURCE_REQUIREMENTS_LIST = 10,
|
||||
REGT_QWORD = 11
|
||||
};
|
||||
|
||||
@ -162,6 +168,7 @@ protected:
|
||||
void close();
|
||||
std::string key() const;
|
||||
std::string key(const std::string& valueName) const;
|
||||
HKEY handle();
|
||||
void handleSetError(const std::string& name);
|
||||
static HKEY handleFor(const std::string& rootKey);
|
||||
|
||||
|
@ -114,7 +114,7 @@ std::string WinRegistryKey::getString(const std::string& name)
|
||||
#if defined(POCO_WIN32_UTF8)
|
||||
std::wstring uname;
|
||||
Poco::UnicodeConverter::toUTF16(name, uname);
|
||||
if (RegQueryValueExW(_hKey, uname.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS || type != REG_SZ && type != REG_EXPAND_SZ)
|
||||
if (RegQueryValueExW(_hKey, uname.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS || (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_LINK))
|
||||
throw NotFoundException(key(name));
|
||||
if (size > 0)
|
||||
{
|
||||
@ -128,7 +128,7 @@ std::string WinRegistryKey::getString(const std::string& name)
|
||||
return result;
|
||||
}
|
||||
#else
|
||||
if (RegQueryValueExA(_hKey, name.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS || type != REG_SZ && type != REG_EXPAND_SZ)
|
||||
if (RegQueryValueExA(_hKey, name.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS || (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_LINK))
|
||||
throw NotFoundException(key(name));
|
||||
if (size > 0)
|
||||
{
|
||||
@ -168,7 +168,7 @@ std::string WinRegistryKey::getStringExpand(const std::string& name)
|
||||
#if defined(POCO_WIN32_UTF8)
|
||||
std::wstring uname;
|
||||
Poco::UnicodeConverter::toUTF16(name, uname);
|
||||
if (RegQueryValueExW(_hKey, uname.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS || type != REG_SZ && type != REG_EXPAND_SZ)
|
||||
if (RegQueryValueExW(_hKey, uname.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS || (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_LINK))
|
||||
throw NotFoundException(key(name));
|
||||
if (size > 0)
|
||||
{
|
||||
@ -190,7 +190,7 @@ std::string WinRegistryKey::getStringExpand(const std::string& name)
|
||||
return result;
|
||||
}
|
||||
#else
|
||||
if (RegQueryValueExA(_hKey, name.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS || type != REG_SZ && type != REG_EXPAND_SZ)
|
||||
if (RegQueryValueExA(_hKey, name.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS || (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_LINK))
|
||||
throw NotFoundException(key(name));
|
||||
if (size > 0)
|
||||
{
|
||||
@ -280,10 +280,10 @@ int WinRegistryKey::getInt(const std::string& name)
|
||||
#if defined(POCO_WIN32_UTF8)
|
||||
std::wstring uname;
|
||||
Poco::UnicodeConverter::toUTF16(name, uname);
|
||||
if (RegQueryValueExW(_hKey, uname.c_str(), NULL, &type, (BYTE*) &data, &size) != ERROR_SUCCESS || type != REG_DWORD)
|
||||
if (RegQueryValueExW(_hKey, uname.c_str(), NULL, &type, (BYTE*) &data, &size) != ERROR_SUCCESS || (type != REG_DWORD && type != REG_DWORD_BIG_ENDIAN))
|
||||
throw NotFoundException(key(name));
|
||||
#else
|
||||
if (RegQueryValueExA(_hKey, name.c_str(), NULL, &type, (BYTE*) &data, &size) != ERROR_SUCCESS || type != REG_DWORD)
|
||||
if (RegQueryValueExA(_hKey, name.c_str(), NULL, &type, (BYTE*) &data, &size) != ERROR_SUCCESS || (type != REG_DWORD && type != REG_DWORD_BIG_ENDIAN))
|
||||
throw NotFoundException(key(name));
|
||||
#endif
|
||||
return data;
|
||||
@ -443,8 +443,6 @@ WinRegistryKey::Type WinRegistryKey::type(const std::string& name)
|
||||
if (RegQueryValueExA(_hKey, name.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS)
|
||||
throw NotFoundException(key(name));
|
||||
#endif
|
||||
if (type != REG_SZ && type != REG_EXPAND_SZ && type != REG_DWORD && type != REG_QWORD && type != REG_BINARY)
|
||||
throw NotFoundException(key(name)+": type not supported");
|
||||
|
||||
Type aType = (Type)type;
|
||||
return aType;
|
||||
@ -558,6 +556,13 @@ std::string WinRegistryKey::key(const std::string& valueName) const
|
||||
}
|
||||
|
||||
|
||||
HKEY WinRegistryKey::handle()
|
||||
{
|
||||
open();
|
||||
return _hKey;
|
||||
}
|
||||
|
||||
|
||||
HKEY WinRegistryKey::handleFor(const std::string& rootKey)
|
||||
{
|
||||
if (rootKey == "HKEY_CLASSES_ROOT")
|
||||
|
@ -49,25 +49,11 @@ target_include_directories( "${LIBNAME}"
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
||||
|
@ -25,25 +25,12 @@ target_include_directories( "${LIBNAME}"
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
POCO_INSTALL("${LIBNAME}")
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
||||
|
11
appveyor.yml
Normal file
11
appveyor.yml
Normal file
@ -0,0 +1,11 @@
|
||||
version: '{build}'
|
||||
|
||||
install:
|
||||
- cinst cmake
|
||||
|
||||
build_script:
|
||||
- set PATH=C:\ProgramData\chocolatey\bin;%PATH%
|
||||
- mkdir cmake-build
|
||||
- cd cmake-build
|
||||
- cmake ..
|
||||
- cmake --build .
|
@ -32,7 +32,7 @@ CXX = clang++
|
||||
LINK = $(CXX) -bind_at_load
|
||||
LIB = libtool -static -o
|
||||
RANLIB = ranlib
|
||||
SHLIB = $(CXX) -dynamiclib -o $@
|
||||
SHLIB = $(CXX) -dynamiclib -Wl,-install_name,$(POCO_LIB_INSTALLDIR)/$(notdir \$@) -o $@
|
||||
DYLIB = $(CXX) -dynamic -bundle $(RORELOCS) -Wl,-bind_at_load -o $@
|
||||
SHLIBLN = $(POCO_BASE)/build/script/shlibln
|
||||
STRIP =
|
||||
|
@ -29,7 +29,7 @@ CXX = $(shell xcrun -find clang++)
|
||||
LINK = $(CXX) -bind_at_load
|
||||
LIB = libtool -static -o
|
||||
RANLIB = ranlib
|
||||
SHLIB = $(CXX) -dynamiclib -o $@
|
||||
SHLIB = $(CXX) -dynamiclib -Wl,-install_name,$(POCO_LIB_INSTALLDIR)/$(notdir \$@) -o $@
|
||||
DYLIB = $(CXX) -dynamic -bundle -read_only_relocs suppress -Wl,-bind_at_load -o $@
|
||||
SHLIBLN = $(POCO_BASE)/build/script/shlibln
|
||||
STRIP =
|
||||
|
@ -29,7 +29,7 @@ CXX = g++
|
||||
LINK = $(CXX) -bind_at_load
|
||||
LIB = libtool -static -o
|
||||
RANLIB = ranlib
|
||||
SHLIB = $(CXX) -dynamiclib -o $@
|
||||
SHLIB = $(CXX) -dynamiclib -Wl,-install_name,$(POCO_LIB_INSTALLDIR)/$(notdir \$@) -o $@
|
||||
DYLIB = $(CXX) -dynamic -bundle -bind_at_load -o $@
|
||||
SHLIBLN = $(POCO_BASE)/build/script/shlibln
|
||||
STRIP =
|
||||
|
@ -192,6 +192,11 @@ POCO_HOST_LIBDIR = lib/$(POCO_HOST_OSNAME)/$(POCO_HOST_OSARCH)
|
||||
POCO_TARGET_LIBDIR = $(LIBDIR)
|
||||
POCO_HOST_LIBPATH = $(POCO_BUILD)/$(POCO_HOST_LIBDIR)
|
||||
POCO_TARGET_LIBPATH = $(LIBPATH)
|
||||
ifdef POCO_PREFIX
|
||||
POCO_LIB_INSTALLDIR = $(POCO_PREFIX)/lib
|
||||
else
|
||||
POCO_LIB_INSTALLDIR = $(LIBPATH)
|
||||
endif
|
||||
|
||||
ifeq ($(POCO_BASE),$(PROJECT_BASE))
|
||||
POCO_LIBRARY =
|
||||
|
@ -1,143 +0,0 @@
|
||||
# - Find the Poco includes and libraries.
|
||||
# The following variables are set if Poco is found. If Poco is not
|
||||
# found, Poco_FOUND is set to false.
|
||||
# Poco_FOUND - True when the Poco include directory is found.
|
||||
# Poco_INCLUDE_DIRS - the path to where the poco include files are.
|
||||
# Poco_LIBRARY_DIRS - The path to where the poco library files are.
|
||||
# Poco_BINARY_DIRS - The path to where the poco dlls are.
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# If you have installed Poco in a non-standard location.
|
||||
# Then you have three options.
|
||||
# In the following comments, it is assumed that <Your Path>
|
||||
# points to the root directory of the include directory of Poco. e.g
|
||||
# If you have put poco in C:\development\Poco then <Your Path> is
|
||||
# "C:/development/Poco" and in this directory there will be two
|
||||
# directories called "include" and "lib".
|
||||
# 1) After CMake runs, set Poco_INCLUDE_DIR to <Your Path>/poco<-version>
|
||||
# 2) Use CMAKE_INCLUDE_PATH to set a path to <Your Path>/poco<-version>. This will allow FIND_PATH()
|
||||
# to locate Poco_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g.
|
||||
# SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "<Your Path>/include")
|
||||
# 3) Set an environment variable called ${POCO_ROOT} that points to the root of where you have
|
||||
# installed Poco, e.g. <Your Path>. It is assumed that there is at least a subdirectory called
|
||||
# Foundation/include/Poco in this path.
|
||||
#
|
||||
# Note:
|
||||
# 1) If you are just using the poco headers, then you do not need to use
|
||||
# Poco_LIBRARY_DIRS in your CMakeLists.txt file.
|
||||
# 2) If Poco has not been installed, then when setting Poco_LIBRARY_DIRS
|
||||
# the script will look for /lib first and, if this fails, then for /stage/lib.
|
||||
#
|
||||
# Usage:
|
||||
# In your CMakeLists.txt file do something like this:
|
||||
# ...
|
||||
# # Poco
|
||||
# FIND_PACKAGE(Poco)
|
||||
# ...
|
||||
# INCLUDE_DIRECTORIES(${Poco_INCLUDE_DIRS})
|
||||
# LINK_DIRECTORIES(${Poco_LIBRARY_DIRS})
|
||||
#
|
||||
# In Windows, we make the assumption that, if the Poco files are installed, the default directory
|
||||
# will be C:\poco or C:\Program Files\Poco.
|
||||
|
||||
SET(POCO_INCLUDE_PATH_DESCRIPTION "top-level directory containing the poco include directories. E.g /usr/local/include/poco-1.2.1 or c:\\poco\\include\\poco-1.2.1")
|
||||
SET(POCO_INCLUDE_DIR_MESSAGE "Set the Poco_INCLUDE_DIR cmake cache entry to the ${POCO_INCLUDE_PATH_DESCRIPTION}")
|
||||
SET(POCO_LIBRARY_PATH_DESCRIPTION "top-level directory containing the poco libraries.")
|
||||
SET(POCO_LIBRARY_DIR_MESSAGE "Set the Poco_LIBRARY_DIR cmake cache entry to the ${POCO_LIBRARY_PATH_DESCRIPTION}")
|
||||
|
||||
|
||||
SET(POCO_DIR_SEARCH $ENV{POCO_ROOT})
|
||||
IF(POCO_DIR_SEARCH)
|
||||
FILE(TO_CMAKE_PATH ${POCO_DIR_SEARCH} POCO_DIR_SEARCH)
|
||||
ENDIF(POCO_DIR_SEARCH)
|
||||
|
||||
|
||||
IF(WIN32)
|
||||
SET(POCO_DIR_SEARCH
|
||||
${POCO_DIR_SEARCH}
|
||||
C:/poco
|
||||
D:/poco
|
||||
"C:Program Files/poco"
|
||||
"D:Program Files/poco"
|
||||
)
|
||||
ENDIF(WIN32)
|
||||
|
||||
# Add in some path suffixes. These will have to be updated whenever a new Poco version comes out.
|
||||
SET(SUFFIX_FOR_INCLUDE_PATH
|
||||
poco-1.2.4
|
||||
poco-1.2.3
|
||||
poco-1.2.1
|
||||
)
|
||||
|
||||
SET(SUFFIX_FOR_LIBRARY_PATH
|
||||
poco-1.2.4/lib
|
||||
poco-1.2.4/lib/Linux/i686
|
||||
poco-1.2.3/lib
|
||||
poco-1.2.3/lib/Linux/i686
|
||||
poco-1.2.1/lib
|
||||
poco-1.2.1/lib/Linux/i686
|
||||
lib
|
||||
lib/Linux/i686
|
||||
)
|
||||
|
||||
#
|
||||
# Look for an installation.
|
||||
#
|
||||
FIND_PATH(Poco_INCLUDE_DIR NAMES Foundation/include/Poco/AbstractCache.h PATH_SUFFIXES ${SUFFIX_FOR_INCLUDE_PATH} PATHS
|
||||
|
||||
# Look in other places.
|
||||
${POCO_DIR_SEARCH}
|
||||
|
||||
# Help the user find it if we cannot.
|
||||
DOC "The ${POCO_INCLUDE_DIR_MESSAGE}"
|
||||
)
|
||||
|
||||
# Assume we didn't find it.
|
||||
SET(Poco_FOUND 0)
|
||||
|
||||
# Now try to get the include and library path.
|
||||
IF(Poco_INCLUDE_DIR)
|
||||
|
||||
IF(EXISTS "${Poco_INCLUDE_DIR}")
|
||||
SET(Poco_INCLUDE_DIRS
|
||||
${Poco_INCLUDE_DIR}/CppUnit/include
|
||||
${Poco_INCLUDE_DIR}/Foundation/include
|
||||
${Poco_INCLUDE_DIR}/Net/include
|
||||
${Poco_INCLUDE_DIR}/Util/include
|
||||
${Poco_INCLUDE_DIR}/XML/include
|
||||
)
|
||||
SET(Poco_FOUND 1)
|
||||
ENDIF(EXISTS "${Poco_INCLUDE_DIR}")
|
||||
|
||||
FIND_LIBRARY(Poco_LIBRARY_DIR NAMES PocoFoundation PocoFoundationd PATH_SUFFIXES ${SUFFIX_FOR_LIBRARY_PATH} PATHS
|
||||
|
||||
# Look in other places.
|
||||
${Poco_INCLUDE_DIR}
|
||||
${POCO_DIR_SEARCH}
|
||||
|
||||
# Help the user find it if we cannot.
|
||||
DOC "The ${POCO_LIBRARY_PATH_DESCRIPTION}"
|
||||
)
|
||||
GET_FILENAME_COMPONENT(Poco_LIBRARY_DIR ${Poco_LIBRARY_DIR} PATH)
|
||||
IF(Poco_INCLUDE_DIR)
|
||||
SET(Poco_LIBRARY_DIRS ${Poco_LIBRARY_DIR})
|
||||
|
||||
# Look for the poco binary path.
|
||||
SET(Poco_BINARY_DIR ${Poco_INCLUDE_DIR})
|
||||
IF(Poco_BINARY_DIR AND EXISTS "${Poco_BINARY_DIR}")
|
||||
SET(Poco_BINARY_DIRS ${Poco_BINARY_DIR}/bin)
|
||||
ENDIF(Poco_BINARY_DIR AND EXISTS "${Poco_BINARY_DIR}")
|
||||
ENDIF(Poco_INCLUDE_DIR)
|
||||
|
||||
ENDIF(Poco_INCLUDE_DIR)
|
||||
|
||||
IF(NOT Poco_FOUND)
|
||||
IF(NOT Poco_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Poco was not found. ${POCO_DIR_MESSAGE}")
|
||||
ELSE(NOT Poco_FIND_QUIETLY)
|
||||
IF(Poco_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Poco was not found. ${POCO_DIR_MESSAGE}")
|
||||
ENDIF(Poco_FIND_REQUIRED)
|
||||
ENDIF(NOT Poco_FIND_QUIETLY)
|
||||
ENDIF(NOT Poco_FOUND)
|
||||
|
@ -187,46 +187,67 @@ endmacro()
|
||||
#===============================================================================
|
||||
# Macros for Package generation
|
||||
#
|
||||
#TODO: Document this!
|
||||
# POCO_GENERATE_PACKAGE - Generates *Config.cmake
|
||||
# Usage: POCO_SOURCES_PLAT( out name platform sources)
|
||||
# Usage: POCO_GENERATE_PACKAGE(target_name)
|
||||
# INPUT:
|
||||
# out the variable the sources are added to
|
||||
# name: the name of the components
|
||||
# platform: the platform this sources are for (ON = All, OFF = None, WIN32, UNIX ...)
|
||||
# sources: a list of files to add to ${out}
|
||||
# Example: POCO_SOURCES_PLAT( SRCS Foundation ON src/Foundation.cpp )
|
||||
macro(POCO_GENERATE_PACKAGE target_name export_name package_destination)
|
||||
# target_name the name of the target. e.g. Foundation for PocoFoundation
|
||||
# Example: POCO_GENERATE_PACKAGE(Foundation)
|
||||
macro(POCO_GENERATE_PACKAGE target_name)
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Poco${target_name}ConfigVersion.cmake"
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion
|
||||
)
|
||||
export(EXPORT "${export_name}"
|
||||
FILE "${CMAKE_CURRENT_BINARY_DIR}/Poco${target_name}Targets.cmake"
|
||||
NAMESPACE "Poco::"
|
||||
export(EXPORT "${target_name}Targets"
|
||||
FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake"
|
||||
NAMESPACE "${PROJECT_NAME}::"
|
||||
)
|
||||
configure_file(cmake/Poco${target_name}Config.cmake
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Poco${target_name}Config.cmake"
|
||||
configure_file("cmake/Poco${target_name}Config.cmake"
|
||||
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake"
|
||||
@ONLY
|
||||
)
|
||||
|
||||
set(ConfigPackageLocation "${package_destination}")
|
||||
set(ConfigPackageLocation "lib/cmake/${PROJECT_NAME}")
|
||||
|
||||
install(
|
||||
EXPORT "${export_name}"
|
||||
FILE "Poco${target_name}Targets.cmake"
|
||||
NAMESPACE "Poco::"
|
||||
DESTINATION ${package_destination}
|
||||
EXPORT "${target_name}Targets"
|
||||
FILE "${PROJECT_NAME}${target_name}Targets.cmake"
|
||||
NAMESPACE "${PROJECT_NAME}::"
|
||||
DESTINATION "lib/cmake/${PROJECT_NAME}"
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Poco${target_name}Config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Poco${target_name}ConfigVersion.cmake"
|
||||
DESTINATION ${package_destination}
|
||||
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake"
|
||||
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}ConfigVersion.cmake"
|
||||
DESTINATION "lib/cmake/${PROJECT_NAME}"
|
||||
COMPONENT Devel
|
||||
)
|
||||
|
||||
endmacro()
|
||||
|
||||
#===============================================================================
|
||||
# Macros for simplified installation
|
||||
#
|
||||
# POCO_INSTALL - Install the given target
|
||||
# Usage: POCO_INSTALL(target_name)
|
||||
# INPUT:
|
||||
# target_name the name of the target. e.g. Foundation for PocoFoundation
|
||||
# Example: POCO_INSTALL(Foundation)
|
||||
macro(POCO_INSTALL target_name)
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS "${target_name}" EXPORT "${target_name}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
endmacro()
|
||||
|
Loading…
Reference in New Issue
Block a user