diff --git a/ApacheConnector/CMakeLists.txt b/ApacheConnector/CMakeLists.txt index 0a0f17294..447488cc3 100644 --- a/ApacheConnector/CMakeLists.txt +++ b/ApacheConnector/CMakeLists.txt @@ -1,11 +1,20 @@ set(LIBNAME "mod_poco") -include_directories( include ${APACHE_INCLUDE_DIR} ${APRUTIL_INCLUDE_DIR} ) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SRCS ${SRCS_G}) -aux_source_directory(src SRCS) +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SRCS ${HDRS_G}) + +include_directories( "include" ) add_library( ${LIBNAME} SHARED ${SRCS} ) -set_target_properties( ${LIBNAME} PROPERTIES VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) +set_target_properties( ${LIBNAME} + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL ApacheHandlers_EXPORTS) target_link_libraries( ${LIBNAME} ) if (ENABLE_TESTS) diff --git a/ApacheConnector/samples/FormServer/CMakeLists.txt b/ApacheConnector/samples/FormServer/CMakeLists.txt index 72179c4ec..ae7a563c8 100644 --- a/ApacheConnector/samples/FormServer/CMakeLists.txt +++ b/ApacheConnector/samples/FormServer/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_library( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoFoundation ) diff --git a/ApacheConnector/samples/TimeServer/CMakeLists.txt b/ApacheConnector/samples/TimeServer/CMakeLists.txt index 82b302372..595b9c33a 100644 --- a/ApacheConnector/samples/TimeServer/CMakeLists.txt +++ b/ApacheConnector/samples/TimeServer/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_library( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoFoundation ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a2f80c7a..d92438f68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,9 @@ # POCO_STATIC # POCO_UNBUNDLED # POCO_NO_LOCALE +# +# ENABLE_{COMPONENT} +# ENABLE_TESTS project(Poco) @@ -61,6 +64,23 @@ endif () # For Debug build types, append a "d" to the library names. set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix" FORCE) +# Include some common macros to simpilfy the Poco CMake files +include(PocoMacros) + +# Allow enabling and disabling components +option(ENABLE_XML "Enable the XML" ON) +option(ENABLE_JSON "Enable the JSON" ON) +option(ENABLE_MONGODB "Enable MongoDB" ON) +option(ENABLE_PDF "Enable PDF" ON) +option(ENABLE_UTIL "Enable Util" ON) +option(ENABLE_NET "Enable Net" ON) +option(ENABLE_NETSSL "Enable NetSSL" ON) +option(ENABLE_CRYPTO "Enable Crypto" ON) +option(ENABLE_DATA "Enable Data" ON) +option(ENABLE_SEVENZIP "Enable SevenZip" ON) +option(ENABLE_ZIP "Enable Zip" ON) +option(ENABLE_APACHECONNECTOR "Enable ApacheConnector" ON) + option(ENABLE_TESTS "Set to OFF|ON (default is OFF) to control build of POCO tests & samples" OFF) @@ -96,7 +116,7 @@ else () endif () # Set local include path -include_directories( CppUnit/include Foundation/include XML/include Net/include NetSSL_OpenSSL/include Util/include Data/include Data/MySQL/include Data/SQLite/include Data/ODBC/include Zip/include Crypto/include Web/include JSON/include MongoDB/include PDF/include SevenZip/include) +include_directories( CppUnit/include CppUnit/WinTestRunner/include Foundation/include XML/include Net/include NetSSL_OpenSSL/include Util/include Data/include Data/MySQL/include Data/SQLite/include Data/ODBC/include Zip/include Crypto/include Web/include JSON/include MongoDB/include PDF/include SevenZip/include) include(CheckTypeSize) find_package(Cygwin) @@ -160,29 +180,54 @@ if (ENABLE_TESTS) endif () add_subdirectory(Foundation) +if(ENABLE_XML) add_subdirectory(XML) +endif() +if(ENABLE_JSON) add_subdirectory(JSON) +endif() +if(ENABLE_MONGODB) add_subdirectory(MongoDB) +endif() +if(ENABLE_PDF) add_subdirectory(PDF) +endif() +if(ENABLE_UTIL) add_subdirectory(Util) +endif() +if(ENABLE_NET) add_subdirectory(Net) +endif() # OPENSSL_SSL_LIBRARY find_package(OpenSSL) if(OPENSSL_FOUND) - include_directories(${OPENSSL_INCLUDE_DIR}) + include_directories("${OPENSSL_INCLUDE_DIR}") + if(ENABLE_NETSSL) add_subdirectory(NetSSL_OpenSSL) + endif() + if(ENABLE_CRYPTO) add_subdirectory(Crypto) + endif() endif(OPENSSL_FOUND) +if(ENABLE_DATA) add_subdirectory(Data) +endif() +if(ENABLE_SEVENZIP) add_subdirectory(SevenZip) +endif() +if(ENABLE_ZIP) add_subdirectory(Zip) +endif() -#find_package(ARP) -#find_package(Apache2) +find_package(APR) +find_package(Apache2) if(APRUTIL_FOUND AND APACHE_FOUND) + include_directories( "${APACHE_INCLUDE_DIR}" "${APRUTIL_INCLUDE_DIR}" ) + if(ENABLE_APACHECONNECTOR) add_subdirectory(ApacheConnector) + endif() endif(APRUTIL_FOUND AND APACHE_FOUND) ############################################################# diff --git a/CppUnit/CMakeLists.txt b/CppUnit/CMakeLists.txt index 9384afd9a..9fbec4b0b 100644 --- a/CppUnit/CMakeLists.txt +++ b/CppUnit/CMakeLists.txt @@ -1,20 +1,20 @@ set(LIBNAME "CppUnit") -set(SRCS - src/CppUnitException.cpp - src/TestCase.cpp - src/TestDecorator.cpp - src/TestFailure.cpp - src/TestResult.cpp - src/TestRunner.cpp - src/TestSuite.cpp - src/TextTestResult.cpp -) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SRCS ${HDRS_G}) add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) set_target_properties( ${LIBNAME} - PROPERTIES - VERSION "1" - SOVERSION "1") + PROPERTIES + VERSION "1" SOVERSION "1" + DEFINE_SYMBOL CppUnit_EXPORTS) target_link_libraries( ${LIBNAME} ) +if(WIN32) + add_subdirectory(WinTestRunner) +endif(WIN32) diff --git a/CppUnit/WinTestRunner/CMakeLists.txt b/CppUnit/WinTestRunner/CMakeLists.txt new file mode 100644 index 000000000..2eaf12e54 --- /dev/null +++ b/CppUnit/WinTestRunner/CMakeLists.txt @@ -0,0 +1,29 @@ +set(LIBNAME "WinTestRunner") + +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( WIN_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( WIN_SRCS ${HDRS_G}) + +file(GLOB_RECURSE HDRS_G "src/*.h" ) +POCO_HEADERS_AUTO( WIN_SRCS ${HDRS_G}) + +# TODO: Is this flag always required? +add_definitions("-D_AFXDLL") + +include_directories( "src" ) + +add_library( ${LIBNAME} ${LIB_MODE} ${WIN_SRCS} ) +set_target_properties( ${LIBNAME} + PROPERTIES + VERSION "1" SOVERSION "1" + DEFINE_SYMBOL WinTestRunner_EXPORTS) +target_link_libraries( ${LIBNAME} CppUnit ) +if(WIN32) + target_link_libraries( ${LIBNAME} winmm ) +endif(WIN32) + + diff --git a/Crypto/CMakeLists.txt b/Crypto/CMakeLists.txt index 90bd7d52f..9c4210cd7 100644 --- a/Crypto/CMakeLists.txt +++ b/Crypto/CMakeLists.txt @@ -1,27 +1,21 @@ set(LIBNAME "PocoCrypto") -set(SRCS - src/Cipher.cpp - src/CipherFactory.cpp - src/CipherImpl.cpp - src/CipherKey.cpp - src/CipherKeyImpl.cpp - src/CryptoStream.cpp - src/CryptoTransform.cpp - src/DigestEngine.cpp - src/OpenSSLInitializer.cpp - src/RSACipherImpl.cpp - src/RSADigestEngine.cpp - src/RSAKey.cpp - src/RSAKeyImpl.cpp - src/X509Certificate.cpp -) -add_definitions(-D_USRDLL -DCrypto_EXPORTS) -include_directories( include ${OPENSSL_INCLUDE_DIR} ) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SRCS ${HDRS_G}) + +add_definitions(-D_USRDLL) +include_directories( "include" ) add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) -set_target_properties( ${LIBNAME} PROPERTIES VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) - +set_target_properties( ${LIBNAME} + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL Crypto_EXPORTS) target_link_libraries( ${LIBNAME} PocoFoundation ${OPENSSL_LIBRARIES} ) install( diff --git a/Crypto/samples/genrsakey/CMakeLists.txt b/Crypto/samples/genrsakey/CMakeLists.txt index 8401b3ac9..2feabdc94 100644 --- a/Crypto/samples/genrsakey/CMakeLists.txt +++ b/Crypto/samples/genrsakey/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoCrypto PocoUtil PocoXML PocoFoundation ) diff --git a/Crypto/testsuite/CMakeLists.txt b/Crypto/testsuite/CMakeLists.txt index 1c7f46b30..e67401df6 100644 --- a/Crypto/testsuite/CMakeLists.txt +++ b/Crypto/testsuite/CMakeLists.txt @@ -1,21 +1,29 @@ -set( TEST_SRCS -src/CryptoTest.cpp -src/DigestEngineTest.cpp -src/CryptoTestSuite.cpp -src/Driver.cpp -src/RSATest.cpp -) - -#include_directories() - -set( WIN_TEST_SRCS -src/WinDriver.cpp -) - set(TESTUNIT "${LIBNAME}-testrunner") +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "src/*.h" ) +POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32 + src/WinDriver.cpp +) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE + src/WinCEDriver.cpp +) + add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) -target_link_libraries( ${TESTUNIT} PocoCrypto PocoNetSSL PocoXML PocoUtil PocoFoundation CppUnit pthread) +target_link_libraries( ${TESTUNIT} PocoCrypto PocoNetSSL PocoXML PocoUtil PocoFoundation CppUnit ) +if( WIN32) + #TODO: Is this flag always required? + add_definitions("-D_AFXDLL") + target_link_libraries( ${TESTUNIT} WinTestRunner) +else() + target_link_libraries( ${TESTUNIT} pthread) +endif(WIN32) diff --git a/Data/CMakeLists.txt b/Data/CMakeLists.txt index e71e169f2..31b727b31 100644 --- a/Data/CMakeLists.txt +++ b/Data/CMakeLists.txt @@ -1,46 +1,15 @@ set(LIBNAME "PocoData") -set(SRCS - src/AbstractBinder.cpp - src/AbstractBinding.cpp - src/AbstractExtraction.cpp - src/AbstractExtractor.cpp - src/AbstractPreparation.cpp - src/AbstractPreparator.cpp - src/ArchiveStrategy.cpp - src/Bulk.cpp - src/Connector.cpp - src/DataException.cpp - src/Date.cpp - src/DynamicLOB.cpp - src/Limit.cpp - src/MetaColumn.cpp - src/PooledSessionHolder.cpp - src/PooledSessionImpl.cpp - src/Position.cpp - src/Range.cpp - src/RecordSet.cpp - src/Row.cpp - src/RowFilter.cpp - src/RowFormatter.cpp - src/RowIterator.cpp - src/Session.cpp - src/SessionFactory.cpp - src/SessionImpl.cpp - src/SessionPoolContainer.cpp - src/SessionPool.cpp - src/SimpleRowFormatter.cpp - src/SQLChannel.cpp - src/Statement.cpp - src/StatementCreator.cpp - src/StatementImpl.cpp - src/Time.cpp - src/Transaction.cpp -) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SRCS ${SRCS_G}) +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SRCS ${HDRS_G}) if (NOT POCO_STATIC) - add_definitions(-DData_EXPORTS -DTHREADSAFE -DODBC_EXPORTS -DMySQL_EXPORTS -DSQLite_EXPORTS) + add_definitions(-DTHREADSAFE) endif (NOT POCO_STATIC) if(MSVC AND NOT(MSVC_VERSION LESS 1400)) @@ -51,7 +20,8 @@ endif() add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) set_target_properties( ${LIBNAME} PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL Data_EXPORTS) target_link_libraries( ${LIBNAME} PocoFoundation) install( @@ -72,19 +42,25 @@ add_subdirectory( SQLite ) 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(ODBC) if(CMAKE_SYSTEM MATCHES "Windows") + set(ODBC_LIBRARIES "") message(STATUS "Windows native ODBC Support Enabled") add_subdirectory( ODBC ) else () - if ( ${UNIX_ODBC_CONFIG} STREQUAL UNIX_ODBC_CONFIG-NOTFOUND AND ${IODBC_CONFIG} STREQUAL IODBC_CONFIG-NOTFOUND) - message(STATUS "ODBC Support Disabled - no ODBC runtime") - else () + 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() diff --git a/Data/MySQL/CMakeLists.txt b/Data/MySQL/CMakeLists.txt index a211dc973..ba5014804 100644 --- a/Data/MySQL/CMakeLists.txt +++ b/Data/MySQL/CMakeLists.txt @@ -1,26 +1,22 @@ set(LIBNAME "PocoDataMySQL") -set(SRCS - src/Binder.cpp - src/Connector.cpp - src/Extractor.cpp - src/MySQLException.cpp - src/MySQLStatementImpl.cpp - src/ResultMetadata.cpp - src/SessionHandle.cpp - src/SessionImpl.cpp - src/StatementExecutor.cpp - src/Utility.cpp -) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( MYSQL_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( MYSQL_SRCS ${HDRS_G}) add_definitions(-DTHREADSAFE -DNO_TCL) -include_directories( include ${MYSQL_INCLUDE_DIR}) +include_directories( "include" ) -add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) +add_library( ${LIBNAME} ${LIB_MODE} ${MYSQL_SRCS} ) set_target_properties( ${LIBNAME} PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL MySQL_EXPORTS) target_link_libraries( ${LIBNAME} PocoData PocoFoundation ${MYSQL_LIB}) install( @@ -28,7 +24,7 @@ install( DESTINATION include PATTERN ".svn" EXCLUDE ) - + install( TARGETS ${LIBNAME} LIBRARY DESTINATION lib${LIB_SUFFIX} diff --git a/Data/MySQL/testsuite/CMakeLists.txt b/Data/MySQL/testsuite/CMakeLists.txt index 8a6af7abf..984895f6c 100644 --- a/Data/MySQL/testsuite/CMakeLists.txt +++ b/Data/MySQL/testsuite/CMakeLists.txt @@ -1,19 +1,18 @@ -set( TEST_SRCS -src/Driver.cpp -src/MySQLTest.cpp -src/MySQLTestSuite.cpp -src/SQLExecutor.cpp -) - -#include_directories() - -set( WIN_TEST_SRCS -src/WinDriver.cpp -) - set(TESTUNIT "${LIBNAME}-testrunner") +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "src/*.h" ) +POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32 + src/WinDriver.cpp +) + add_executable( ${TESTUNIT} ${TEST_SRCS} ) -#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) +add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) target_link_libraries( ${TESTUNIT} PocoDataMySQL PocoData PocoFoundation CppUnit ) diff --git a/Data/ODBC/CMakeLists.txt b/Data/ODBC/CMakeLists.txt index 747514acb..c7b7bd2b9 100644 --- a/Data/ODBC/CMakeLists.txt +++ b/Data/ODBC/CMakeLists.txt @@ -1,38 +1,30 @@ set(LIBNAME "PocoDataODBC") -set(SRCS - src/Binder.cpp - src/ConnectionHandle.cpp - src/Connector.cpp - src/EnvironmentHandle.cpp - src/Extractor.cpp - src/ODBCException.cpp - src/ODBCMetaColumn.cpp - src/ODBCStatementImpl.cpp - src/Parameter.cpp - src/Preparator.cpp - src/SessionImpl.cpp - src/TypeInfo.cpp - src/Unicode.cpp - src/Utility.cpp -) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( ODBC_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( ODBC_SRCS ${HDRS_G}) add_definitions( ${ODBC_CFLAGS} ) -include_directories( include ) +include_directories( "include" ) -add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) +add_library( ${LIBNAME} ${LIB_MODE} ${ODBC_SRCS} ) set_target_properties( ${LIBNAME} PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) -target_link_libraries( ${LIBNAME} PocoData PocoFoundation ${ODBC_LINK_FLAGS}) + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL ODBC_EXPORTS) +target_link_libraries( ${LIBNAME} PocoData PocoFoundation ${ODBC_LIBRARIES}) install( DIRECTORY include/Poco DESTINATION include PATTERN ".svn" EXCLUDE ) - + install( TARGETS ${LIBNAME} LIBRARY DESTINATION lib${LIB_SUFFIX} diff --git a/Data/ODBC/testsuite/CMakeLists.txt b/Data/ODBC/testsuite/CMakeLists.txt index 0f0e64268..c5abab781 100644 --- a/Data/ODBC/testsuite/CMakeLists.txt +++ b/Data/ODBC/testsuite/CMakeLists.txt @@ -1,26 +1,22 @@ -set( TEST_SRCS -src/Driver.cpp -src/ODBCAccessTest.cpp -src/ODBCDB2Test.cpp -src/ODBCMySQLTest.cpp -src/ODBCOracleTest.cpp -src/ODBCPostgreSQLTest.cpp -src/ODBCSQLServerTest.cpp -src/ODBCSQLiteTest.cpp -src/ODBCTest.cpp -src/ODBCTestSuite.cpp -src/SQLExecutor.cpp -) - -#include_directories() - -set( WIN_TEST_SRCS -src/WinDriver.cpp -) - set(TESTUNIT "${LIBNAME}-testrunner") -add_executable( ${TESTUNIT} ${TEST_SRCS} ) -#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) -target_link_libraries( ${TESTUNIT} PocoDataODBC PocoData PocoFoundation CppUnit ) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "src/*.h" ) +POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32 + src/WinDriver.cpp +) + +add_executable( ${TESTUNIT} ${TEST_SRCS} ) +add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) +target_link_libraries( ${TESTUNIT} PocoDataODBC PocoData PocoFoundation CppUnit ) +if( WIN32) + add_definitions("-D_AFXDLL") + target_link_libraries( ${TESTUNIT} WinTestRunner) +endif(WIN32) diff --git a/Data/SQLite/CMakeLists.txt b/Data/SQLite/CMakeLists.txt index 1b9ecbe9d..c182cf244 100644 --- a/Data/SQLite/CMakeLists.txt +++ b/Data/SQLite/CMakeLists.txt @@ -1,33 +1,39 @@ set(LIBNAME "PocoDataSQLite") -set(SRCS - src/Binder.cpp - src/Connector.cpp - src/Extractor.cpp - src/Notifier.cpp - src/SessionImpl.cpp - src/SQLiteException.cpp - src/SQLiteStatementImpl.cpp - src/Utility.cpp -) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SQLITE_SRCS ${SRCS_G}) -include_directories( "include" src ) +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SQLITE_SRCS ${HDRS_G}) + +include_directories( "include" "src" ) if (POCO_UNBUNDLED) find_package(SQLite3) set(DATASQLITELIBS PocoData PocoFoundation ${SQLITE3_LIBRARIES}) - include_directories(${SQLITE3_INCLUDE_DIRS}) + include_directories("${SQLITE3_INCLUDE_DIRS}") else() - set(SRCS ${SRCS} src/sqlite3.c) + # sqlite3 + POCO_SOURCES( SQLITE_SRCS sqlite3 + src/sqlite3.c + ) + + POCO_HEADERS( SQLITE_SRCS sqlite3 + src/sqlite3.h + ) + set(DATASQLITELIBS PocoData PocoFoundation) endif() add_definitions(-DSQLITE_THREADSAFE=1 -DSQLITE_DISABLE_LFS -DSQLITE_OMIT_UTF16 -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_COMPLETE -DSQLITE_OMIT_TCL_VARIABLE -DSQLITE_OMIT_DEPRECATED) -add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) +add_library( ${LIBNAME} ${LIB_MODE} ${SQLITE_SRCS} ) set_target_properties( ${LIBNAME} PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL SQLite_EXPORTS) target_link_libraries( ${LIBNAME} ${DATASQLITELIBS} ) install( diff --git a/Data/SQLite/testsuite/CMakeLists.txt b/Data/SQLite/testsuite/CMakeLists.txt index c2c96731f..dc330a978 100644 --- a/Data/SQLite/testsuite/CMakeLists.txt +++ b/Data/SQLite/testsuite/CMakeLists.txt @@ -1,18 +1,23 @@ -set( TEST_SRCS -src/Driver.cpp -src/SQLiteTest.cpp -src/SQLiteTestSuite.cpp -) - -#include_directories() - -set( WIN_TEST_SRCS -src/WinDriver.cpp -) - set(TESTUNIT "${LIBNAME}-testrunner") -add_executable( ${TESTUNIT} ${TEST_SRCS} ) -#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) -target_link_libraries( ${TESTUNIT} PocoDataSQLite PocoData PocoFoundation CppUnit ) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "src/*.h" ) +POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32 + src/WinDriver.cpp +) + +add_executable( ${TESTUNIT} ${TEST_SRCS} ) +add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) +target_link_libraries( ${TESTUNIT} PocoDataSQLite PocoData PocoFoundation CppUnit ) +if( WIN32) + #TODO: Is this flag always required? + add_definitions("-D_AFXDLL") + target_link_libraries( ${TESTUNIT} WinTestRunner) +endif(WIN32) diff --git a/Data/samples/Binding/CMakeLists.txt b/Data/samples/Binding/CMakeLists.txt index d53950956..0e43e6cfe 100644 --- a/Data/samples/Binding/CMakeLists.txt +++ b/Data/samples/Binding/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoDataSQLite PocoData PocoFoundation ) diff --git a/Data/samples/RecordSet/CMakeLists.txt b/Data/samples/RecordSet/CMakeLists.txt index 9551a78f9..8f6be903d 100644 --- a/Data/samples/RecordSet/CMakeLists.txt +++ b/Data/samples/RecordSet/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoDataSQLite PocoData PocoFoundation ) diff --git a/Data/samples/RowFormatter/CMakeLists.txt b/Data/samples/RowFormatter/CMakeLists.txt index 08bde9c0e..54e732a23 100644 --- a/Data/samples/RowFormatter/CMakeLists.txt +++ b/Data/samples/RowFormatter/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoDataSQLite PocoData PocoFoundation ) diff --git a/Data/samples/Tuple/CMakeLists.txt b/Data/samples/Tuple/CMakeLists.txt index cf9a353db..de28affae 100644 --- a/Data/samples/Tuple/CMakeLists.txt +++ b/Data/samples/Tuple/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoDataSQLite PocoData PocoFoundation ) diff --git a/Data/samples/TypeHandler/CMakeLists.txt b/Data/samples/TypeHandler/CMakeLists.txt index 063e87863..5942db43c 100644 --- a/Data/samples/TypeHandler/CMakeLists.txt +++ b/Data/samples/TypeHandler/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoDataSQLite PocoData PocoFoundation ) diff --git a/Data/samples/WebNotifier/CMakeLists.txt b/Data/samples/WebNotifier/CMakeLists.txt index 181a9cbc1..167898b1f 100644 --- a/Data/samples/WebNotifier/CMakeLists.txt +++ b/Data/samples/WebNotifier/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoDataSQLite PocoData PocoNet PocoFoundation ) diff --git a/Data/testsuite/CMakeLists.txt b/Data/testsuite/CMakeLists.txt index e4dcb619a..e61d85b9a 100644 --- a/Data/testsuite/CMakeLists.txt +++ b/Data/testsuite/CMakeLists.txt @@ -1,26 +1,27 @@ -set( TEST_SRCS -src/Binder.cpp -src/Connector.cpp -src/DataTest.cpp -src/Driver.cpp -src/DataTestSuite.cpp -src/Extractor.cpp -src/Preparator.cpp -src/SessionImpl.cpp -src/SessionPoolTest.cpp -src/TestStatementImpl.cpp -) - -#include_directories() - -set( WIN_TEST_SRCS -src/WinDriver.cpp -) - set(TESTUNIT "${LIBNAME}-testrunner") +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "src/*.h" ) +POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32 + src/WinDriver.cpp +) + +#TODO: Why is this file there? It doesn't compile if it is include in the sources +POCO_SOURCES_AUTO_PLAT( TEST_SRCS OFF + src/StatementImpl.cpp +) + add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${TESTUNIT} PocoData PocoUtil PocoXML PocoFoundation CppUnit) - +if( WIN32) + #TODO: Is this flag always required? + add_definitions("-D_AFXDLL") + target_link_libraries( ${TESTUNIT} WinTestRunner) +endif(WIN32) diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt index a0fd25281..db2d254b3 100644 --- a/Foundation/CMakeLists.txt +++ b/Foundation/CMakeLists.txt @@ -1,182 +1,32 @@ set(LIBNAME "PocoFoundation") -if (WIN32) - # cmake has CMAKE_RC_COMPILER, but no message compiler - if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio") - # this path is only present for 2008+, but we currently require PATH to - # be set up anyway - get_filename_component(sdk_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" REALPATH) - get_filename_component(kit_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot]" REALPATH) - if (X64) - set(sdk_bindir "${sdk_dir}/bin/x64") - set(kit_bindir "${kit_dir}/bin/x64") - else (X64) - set(sdk_bindir "${sdk_dir}/bin") - set(kit_bindir "${kit_dir}/bin/x86") - endif (X64) - endif () - find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" - DOC "path to message compiler") - if (NOT CMAKE_MC_COMPILER) - message(FATAL_ERROR "message compiler not found: required to build") - endif (NOT CMAKE_MC_COMPILER) - message(STATUS "Found message compiler: ${CMAKE_MC_COMPILER}") - mark_as_advanced(CMAKE_MC_COMPILER) -endif(WIN32) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SRCS ${SRCS_G}) -set( BASE_SRCS - src/ASCIIEncoding.cpp - src/Ascii.cpp - src/AtomicCounter.cpp - src/AbstractObserver.cpp - src/ActiveDispatcher.cpp - src/ArchiveStrategy.cpp - src/AsyncChannel.cpp - src/Base64Decoder.cpp - src/Base64Encoder.cpp - src/Base32Decoder.cpp - src/Base32Encoder.cpp - src/BinaryReader.cpp - src/BinaryWriter.cpp - src/Bugcheck.cpp - src/ByteOrder.cpp - src/Channel.cpp - src/Checksum.cpp - src/Clock.cpp - src/Condition.cpp - src/Configurable.cpp - src/ConsoleChannel.cpp - src/CountingStream.cpp - src/DateTime.cpp - src/DateTimeFormat.cpp - src/DateTimeFormatter.cpp - src/DateTimeParser.cpp - src/Debugger.cpp - src/DeflatingStream.cpp - src/DigestEngine.cpp - src/DigestStream.cpp - src/DirectoryIterator.cpp - src/DirectoryIteratorStrategy.cpp - src/DirectoryWatcher.cpp - src/Environment.cpp - src/Error.cpp - src/ErrorHandler.cpp - src/Event.cpp - src/EventArgs.cpp - src/Exception.cpp - src/FPEnvironment.cpp - src/File.cpp - src/FIFOBufferStream.cpp - src/FileChannel.cpp - src/FileStream.cpp - src/FileStreamFactory.cpp - src/Format.cpp - src/Formatter.cpp - src/FormattingChannel.cpp - src/Glob.cpp - src/Hash.cpp - src/HashStatistic.cpp - src/HexBinaryDecoder.cpp - src/HexBinaryEncoder.cpp - src/InflatingStream.cpp - src/Latin1Encoding.cpp - src/Latin2Encoding.cpp - src/Latin9Encoding.cpp - src/LineEndingConverter.cpp - src/LocalDateTime.cpp - src/LogFile.cpp - src/LogStream.cpp - src/Logger.cpp - src/LoggingFactory.cpp - src/LoggingRegistry.cpp - src/MD4Engine.cpp - src/MD5Engine.cpp - src/Manifest.cpp - src/MemoryPool.cpp - src/MemoryStream.cpp - src/Message.cpp - src/Mutex.cpp - src/NamedEvent.cpp - src/NamedMutex.cpp - src/NestedDiagnosticContext.cpp - src/Notification.cpp - src/NotificationCenter.cpp - src/NotificationQueue.cpp - src/TimedNotificationQueue.cpp - src/PriorityNotificationQueue.cpp - src/NullChannel.cpp - src/NullStream.cpp - src/NumberFormatter.cpp - src/NumberParser.cpp - src/NumericString.cpp - src/Path.cpp - src/PatternFormatter.cpp - src/Pipe.cpp - src/PipeImpl.cpp - src/PipeStream.cpp - src/Process.cpp - src/PurgeStrategy.cpp - src/RWLock.cpp - src/Random.cpp - src/RandomStream.cpp - src/RefCountedObject.cpp - src/RegularExpression.cpp - src/RotateStrategy.cpp - src/Runnable.cpp - src/SHA1Engine.cpp - src/Semaphore.cpp - src/SharedLibrary.cpp - src/SharedMemory.cpp - src/SignalHandler.cpp - src/SimpleFileChannel.cpp - src/SortedDirectoryIterator.cpp - src/SplitterChannel.cpp - src/Stopwatch.cpp - src/StreamChannel.cpp - src/StreamConverter.cpp - src/StreamCopier.cpp - src/StreamTokenizer.cpp - src/String.cpp - src/NumericString.cpp - src/StringTokenizer.cpp - src/SynchronizedObject.cpp - src/Task.cpp - src/TaskManager.cpp - src/TaskNotification.cpp - src/TeeStream.cpp - src/TemporaryFile.cpp - src/TextConverter.cpp - src/TextEncoding.cpp - src/TextIterator.cpp - src/TextBufferIterator.cpp - src/Thread.cpp - src/ThreadTarget.cpp - src/ThreadLocal.cpp - src/ThreadPool.cpp - src/Timer.cpp - src/Timespan.cpp - src/Timestamp.cpp - src/Timezone.cpp - src/Token.cpp - src/URI.cpp - src/URIStreamFactory.cpp - src/URIStreamOpener.cpp - src/UTF16Encoding.cpp - src/UTF32Encoding.cpp - src/UTF8Encoding.cpp - src/UTF8String.cpp - src/UUID.cpp - src/UUIDGenerator.cpp - src/Unicode.cpp - src/UnicodeConverter.cpp - src/Var.cpp - src/VarHolder.cpp - src/VarIterator.cpp - src/Void.cpp - src/Windows1250Encoding.cpp - src/Windows1251Encoding.cpp - src/Windows1252Encoding.cpp -) +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SRCS ${HDRS_G}) + +# Platform Specific +POCO_SOURCES_AUTO_PLAT( SRCS OPENVMS src/OpcomChannel.cpp ) +POCO_HEADERS_AUTO( SRCS include/Poco/OpcomChannel.h ) + +POCO_SOURCES_AUTO_PLAT( SRCS UNIX src/SyslogChannel.cpp ) +POCO_HEADERS_AUTO( SRCS include/Poco/SyslogChannel.h ) + +POCO_SOURCES_AUTO_PLAT( SRCS WIN32 + src/WindowsConsoleChannel.cpp + src/EventLogChannel.cpp + ) + +POCO_HEADERS_AUTO( SRCS + include/Poco/WindowsConsoleChannel.h + include/Poco/EventLogChannel.h + ) + +# Messages +POCO_MESSAGES( SRCS Logging src/pocomsg.mc) # If POCO_UNBUNDLED is enabled we try to find the required packages # The configuration will fail if the packages are not found @@ -186,7 +36,7 @@ if (POCO_UNBUNDLED) include_directories(${PCRE_INCLUDE_DIRS}) #HACK: Unicode.cpp requires functions from these files. The can't be taken from the library - list(APPEND BASE_SRCS + POCO_SOURCES( SRCS RegExp src/pcre_ucd.c src/pcre_tables.c ) @@ -195,8 +45,8 @@ if (POCO_UNBUNDLED) set(SYSLIBS ${SYSLIBS} ${ZLIB_LIBRARIES}) include_directories(${ZLIB_INCLUDE_DIRS}) else() - # PCRE - list(APPEND BASE_SRCS + # pcre + POCO_SOURCES( SRCS pcre src/pcre_chartables.c src/pcre_compile.c src/pcre_exec.c @@ -213,8 +63,13 @@ else() src/pcre_xclass.c ) - # ZLIB - list(APPEND BASE_SRCS + # zlib + POCO_HEADERS( SRCS zlib + include/Poco/zconf.h + include/Poco/zlib.h + ) + + POCO_SOURCES( SRCS zlib src/adler32.c src/compress.c src/crc32.c @@ -228,47 +83,18 @@ else() ) endif (POCO_UNBUNDLED) -set(WIN_SRCS - src/EventLogChannel.cpp - src/WindowsConsoleChannel.cpp -) - -if (WIN32) - set(RES_SRCS ${CMAKE_SOURCE_DIR}/Foundation/src/pocomsg.h) - set_source_files_properties(${RES_SRCS} PROPERTIES GENERATED true) - add_custom_command( - OUTPUT ${RES_SRCS} - DEPENDS ${CMAKE_SOURCE_DIR}/Foundation/src/pocomsg.mc - COMMAND ${CMAKE_MC_COMPILER} - ARGS - -h ${CMAKE_SOURCE_DIR}/Foundation/src - -r ${CMAKE_SOURCE_DIR}/Foundation/src - ${CMAKE_SOURCE_DIR}/Foundation/src/pocomsg.mc - VERBATIM # recommended: p260 - ) - list(APPEND WIN_SRCS ${RES_SRCS}) -endif (WIN32) - -set(LIN_SRCS - src/SyslogChannel.cpp -) - -# TODO: Use this sources somewhere if built on OpenVMS -set(OPENVMS_SRCS - src/OpcomChannel.cpp -) - if(CMAKE_SYSTEM MATCHES "Windows") - set(SRCS ${BASE_SRCS} ${WIN_SRCS}) - add_definitions( -DPCRE_STATIC -DFoundation_EXPORTS) + add_definitions( -DPCRE_STATIC) set(SYSLIBS ${SYSLIBS} iphlpapi) else (CMAKE_SYSTEM MATCHES "Windows") - set(SRCS ${BASE_SRCS} ${LIN_SRCS}) add_definitions( -DPCRE_STATIC) endif(CMAKE_SYSTEM MATCHES "Windows") -add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) -set_target_properties( ${LIBNAME} PROPERTIES VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) +add_library( ${LIBNAME} ${LIB_MODE} ${SRCS}) +set_target_properties( ${LIBNAME} + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL Foundation_EXPORTS) if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro") set_target_properties( ${LIBNAME} PROPERTIES LINK_FLAGS "-library=stlport4") endif (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro") diff --git a/Foundation/samples/ActiveMethod/CMakeLists.txt b/Foundation/samples/ActiveMethod/CMakeLists.txt index da310114b..9dabf9d2a 100644 --- a/Foundation/samples/ActiveMethod/CMakeLists.txt +++ b/Foundation/samples/ActiveMethod/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${CMAKE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/Activity/CMakeLists.txt b/Foundation/samples/Activity/CMakeLists.txt index 7e2adc2ad..8e61f0211 100644 --- a/Foundation/samples/Activity/CMakeLists.txt +++ b/Foundation/samples/Activity/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/BinaryReaderWriter/CMakeLists.txt b/Foundation/samples/BinaryReaderWriter/CMakeLists.txt index c70a9c650..6e3d3c72c 100644 --- a/Foundation/samples/BinaryReaderWriter/CMakeLists.txt +++ b/Foundation/samples/BinaryReaderWriter/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/DateTime/CMakeLists.txt b/Foundation/samples/DateTime/CMakeLists.txt index 2744d03da..db904b9e2 100644 --- a/Foundation/samples/DateTime/CMakeLists.txt +++ b/Foundation/samples/DateTime/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation) diff --git a/Foundation/samples/LineEndingConverter/CMakeLists.txt b/Foundation/samples/LineEndingConverter/CMakeLists.txt index 2936130d5..a8c443a94 100644 --- a/Foundation/samples/LineEndingConverter/CMakeLists.txt +++ b/Foundation/samples/LineEndingConverter/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/LogRotation/CMakeLists.txt b/Foundation/samples/LogRotation/CMakeLists.txt index 850fab890..8be93b269 100644 --- a/Foundation/samples/LogRotation/CMakeLists.txt +++ b/Foundation/samples/LogRotation/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/Logger/CMakeLists.txt b/Foundation/samples/Logger/CMakeLists.txt index 7a9b3b7a3..574038287 100644 --- a/Foundation/samples/Logger/CMakeLists.txt +++ b/Foundation/samples/Logger/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/NotificationQueue/CMakeLists.txt b/Foundation/samples/NotificationQueue/CMakeLists.txt index 24be8fd39..35b2b61b0 100644 --- a/Foundation/samples/NotificationQueue/CMakeLists.txt +++ b/Foundation/samples/NotificationQueue/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/StringTokenizer/CMakeLists.txt b/Foundation/samples/StringTokenizer/CMakeLists.txt index eeac8546a..3adf1b123 100644 --- a/Foundation/samples/StringTokenizer/CMakeLists.txt +++ b/Foundation/samples/StringTokenizer/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/Timer/CMakeLists.txt b/Foundation/samples/Timer/CMakeLists.txt index 648b154b9..1f90c34c0 100644 --- a/Foundation/samples/Timer/CMakeLists.txt +++ b/Foundation/samples/Timer/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/URI/CMakeLists.txt b/Foundation/samples/URI/CMakeLists.txt index 20006774b..47775f89c 100644 --- a/Foundation/samples/URI/CMakeLists.txt +++ b/Foundation/samples/URI/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/base64decode/CMakeLists.txt b/Foundation/samples/base64decode/CMakeLists.txt index 2b98164a4..89a1e5e20 100644 --- a/Foundation/samples/base64decode/CMakeLists.txt +++ b/Foundation/samples/base64decode/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/base64encode/CMakeLists.txt b/Foundation/samples/base64encode/CMakeLists.txt index bbe51e070..fcac90cfe 100644 --- a/Foundation/samples/base64encode/CMakeLists.txt +++ b/Foundation/samples/base64encode/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/deflate/CMakeLists.txt b/Foundation/samples/deflate/CMakeLists.txt index 06c1cb07f..cce01c0ec 100644 --- a/Foundation/samples/deflate/CMakeLists.txt +++ b/Foundation/samples/deflate/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/dir/CMakeLists.txt b/Foundation/samples/dir/CMakeLists.txt index 831bef949..58f010de6 100644 --- a/Foundation/samples/dir/CMakeLists.txt +++ b/Foundation/samples/dir/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/grep/CMakeLists.txt b/Foundation/samples/grep/CMakeLists.txt index 2a53f3245..3b75a86b9 100644 --- a/Foundation/samples/grep/CMakeLists.txt +++ b/Foundation/samples/grep/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/hmacmd5/CMakeLists.txt b/Foundation/samples/hmacmd5/CMakeLists.txt index c7e0d3667..9c5eafbb3 100644 --- a/Foundation/samples/hmacmd5/CMakeLists.txt +++ b/Foundation/samples/hmacmd5/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/inflate/CMakeLists.txt b/Foundation/samples/inflate/CMakeLists.txt index 3f7f0e148..cacfb0eb5 100644 --- a/Foundation/samples/inflate/CMakeLists.txt +++ b/Foundation/samples/inflate/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/md5/CMakeLists.txt b/Foundation/samples/md5/CMakeLists.txt index f8c5443a5..93c1ec30f 100644 --- a/Foundation/samples/md5/CMakeLists.txt +++ b/Foundation/samples/md5/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/samples/uuidgen/CMakeLists.txt b/Foundation/samples/uuidgen/CMakeLists.txt index 522f48189..947259339 100644 --- a/Foundation/samples/uuidgen/CMakeLists.txt +++ b/Foundation/samples/uuidgen/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoFoundation ) diff --git a/Foundation/testsuite/CMakeLists.txt b/Foundation/testsuite/CMakeLists.txt index 4a50e29e0..7c00313ed 100644 --- a/Foundation/testsuite/CMakeLists.txt +++ b/Foundation/testsuite/CMakeLists.txt @@ -1,172 +1,55 @@ -set( TEST_SRCS -src/ActiveDispatcherTest.cpp -src/ActiveMethodTest.cpp -src/ActivityTest.cpp -src/AnyTest.cpp -src/ArrayTest.cpp -src/AutoPtrTest.cpp -src/AutoReleasePoolTest.cpp -src/Base32Test.cpp -src/Base64Test.cpp -src/BasicEventTest.cpp -src/BinaryReaderWriterTest.cpp -src/ByteOrderTest.cpp -src/CacheTestSuite.cpp -src/ChannelTest.cpp -src/ClassLoaderTest.cpp -src/ClockTest.cpp -src/ConditionTest.cpp -src/CoreTest.cpp -src/CoreTestSuite.cpp -src/CountingStreamTest.cpp -src/CryptTestSuite.cpp -src/DateTimeFormatterTest.cpp -src/DateTimeParserTest.cpp -src/DateTimeTest.cpp -src/DateTimeTestSuite.cpp -src/DigestStreamTest.cpp -src/DirectoryIteratorsTest.cpp -src/DirectoryWatcherTest.cpp -src/Driver.cpp -src/DummyDelegate.cpp -src/DynamicFactoryTest.cpp -src/DynamicTestSuite.cpp -src/EventTestSuite.cpp -src/ExpireCacheTest.cpp -src/ExpireLRUCacheTest.cpp -src/FIFOEventTest.cpp -src/FIFOBufferStreamTest.cpp -src/FPETest.cpp -src/FileChannelTest.cpp -src/FileStreamTest.cpp -src/FileTest.cpp -src/FilesystemTestSuite.cpp -src/FormatTest.cpp -src/FoundationTestSuite.cpp -src/GlobTest.cpp -src/HMACEngineTest.cpp -src/HashMapTest.cpp -src/HashSetTest.cpp -src/HashTableTest.cpp -src/HashingTestSuite.cpp -src/HexBinaryTest.cpp -src/LRUCacheTest.cpp -src/LineEndingConverterTest.cpp -src/LinearHashTableTest.cpp -src/ListMapTest.cpp -src/LocalDateTimeTest.cpp -src/LogStreamTest.cpp -src/LoggerTest.cpp -src/LoggingFactoryTest.cpp -src/LoggingRegistryTest.cpp -src/LoggingTestSuite.cpp -src/MD4EngineTest.cpp -src/MD5EngineTest.cpp -src/ManifestTest.cpp -src/MemoryPoolTest.cpp -src/MemoryStreamTest.cpp -src/NDCTest.cpp -src/NamedEventTest.cpp -src/NamedMutexTest.cpp -src/NamedTuplesTest.cpp -src/NotificationCenterTest.cpp -src/NotificationQueueTest.cpp -src/ObjectPoolTest.cpp -src/PriorityNotificationQueueTest.cpp -src/TimedNotificationQueueTest.cpp -src/NotificationsTestSuite.cpp -src/NullStreamTest.cpp -src/NumberFormatterTest.cpp -src/NumberParserTest.cpp -src/PathTest.cpp -src/PatternFormatterTest.cpp -src/PBKDF2EngineTest.cpp -src/PriorityEventTest.cpp -src/ProcessTest.cpp -src/ProcessesTestSuite.cpp -src/RWLockTest.cpp -src/RandomStreamTest.cpp -src/RandomTest.cpp -src/RegularExpressionTest.cpp -src/SHA1EngineTest.cpp -src/SemaphoreTest.cpp -src/SharedLibraryTest.cpp -src/SharedLibraryTestSuite.cpp -src/SharedMemoryTest.cpp -src/SharedPtrTest.cpp -src/SimpleFileChannelTest.cpp -src/SimpleHashTableTest.cpp -src/StopwatchTest.cpp -src/StreamConverterTest.cpp -src/StreamCopierTest.cpp -src/StreamTokenizerTest.cpp -src/StreamsTestSuite.cpp -src/StringTest.cpp -src/StringTokenizerTest.cpp -src/TaskManagerTest.cpp -src/TaskTest.cpp -src/TaskTestSuite.cpp -src/TeeStreamTest.cpp -src/TestChannel.cpp -src/TestPlugin.cpp -src/TextConverterTest.cpp -src/TextEncodingTest.cpp -src/TextIteratorTest.cpp -src/TextBufferIteratorTest.cpp -src/TextTestSuite.cpp -src/ThreadLocalTest.cpp -src/ThreadPoolTest.cpp -src/ThreadTest.cpp -src/ThreadingTestSuite.cpp -src/TimerTest.cpp -src/TimespanTest.cpp -src/TimestampTest.cpp -src/TimezoneTest.cpp -src/TuplesTest.cpp -src/TypeListTest.cpp -src/URIStreamOpenerTest.cpp -src/URITest.cpp -src/URITestSuite.cpp -src/UTF8StringTest.cpp -src/UUIDGeneratorTest.cpp -src/UUIDTest.cpp -src/UUIDTestSuite.cpp -src/UniqueExpireCacheTest.cpp -src/UnicodeConverterTest.cpp -src/UniqueExpireLRUCacheTest.cpp -src/VarTest.cpp -src/ZLibTest.cpp -) - -set( WIN_TEST_SRCS -src/WinDriver.cpp -) - set(TESTUNIT "${LIBNAME}-testrunner") +# Sources +file(GLOB SRCS_G "src/*.cpp") +file(GLOB SRCS_G_REMOVE + src/TestApp.cpp + src/TestApp_WINCE.cpp + src/TestLibrary.cpp + src/TestPlugin.cpp +) +list(REMOVE_ITEM SRCS_G ${SRCS_G_REMOVE}) +POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "src/*.h" ) +POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32 + src/WinDriver.cpp +) + +POCO_SOURCES_PLAT( TEST_SRCS FoundationTest WINCE + src/WinCEDriver.cpp +) + add_executable( ${TESTUNIT} ${TEST_SRCS} ) -add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) +add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${TESTUNIT} -all) set_tests_properties(${LIBNAME} PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=.") # The SharedLibaryTest has to look for shared libraries in the working directory #set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${TESTUNIT} PocoFoundation CppUnit ) -if (NOT ANDROID) - target_link_libraries( ${TESTUNIT} pthread) -endif () +if( WIN32) + add_definitions("-D_AFXDLL") + target_link_libraries( ${TESTUNIT} WinTestRunner) +else() + target_link_libraries( ${TESTUNIT} pthread) +endif(WIN32) -# The test is run in the build directory. So the test data is copied there too +# The test is run in the runtime directory. So the test data is copied there too add_custom_command(TARGET ${TESTUNIT} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_CURRENT_BINARY_DIR}/data ) + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/data ) +# TestApp add_executable( TestApp src/TestApp.cpp ) -# The test is run in the build directory. So the TestApp is built there too because it is used by the tests -set_target_properties( TestApp PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) -#set_target_properties( TestApp PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) +# The test is run in the runtime directory. So the TestApp is built there too because it is used by the tests +set_target_properties( TestApp PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ) target_link_libraries( TestApp PocoFoundation ) +# TODO: Add TestApp_WINCE -add_library( TestLibrary SHARED src/TestLibrary.cpp ) -set_target_properties( TestLibrary PROPERTIES PREFIX "") # The test requires the library named TestLibrary. By default it is prefixed with lib. -# The test is run in the build directory. So the TestLibrary is built there too because it is used by the tests -set_target_properties( TestLibrary PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) -#set_target_properties( TestLibrary PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) +# TestLibrary +add_library( TestLibrary SHARED src/TestLibrary.cpp src/TestPlugin.cpp src/TestPlugin.h ) +set_target_properties( TestLibrary PROPERTIES PREFIX "" DEBUG_POSTFIX "") # The test requires the library named TestLibrary. By default it is prefixed with lib. +# The test is run in the runtime directory. So the TestLibrary is built there too because it is used by the tests +set_target_properties( TestLibrary PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ) target_link_libraries( TestLibrary PocoFoundation ) diff --git a/JSON/CMakeLists.txt b/JSON/CMakeLists.txt index efb9864a0..27488fd9d 100644 --- a/JSON/CMakeLists.txt +++ b/JSON/CMakeLists.txt @@ -1,27 +1,18 @@ set(LIBNAME "PocoJSON") -set(SRCS - src/Array.cpp - src/Handler.cpp - src/JSONException.cpp - src/Object.cpp - src/ParseHandler.cpp - src/Parser.cpp - src/PrintHandler.cpp - src/Query.cpp - src/Stringifier.cpp - src/TemplateCache.cpp - src/Template.cpp -) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SRCS ${SRCS_G}) -if (NOT POCO_STATIC) - add_definitions(-DJSON_EXPORTS) -endif (NOT POCO_STATIC) +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SRCS ${HDRS_G}) add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) set_target_properties( ${LIBNAME} - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL JSON_EXPORTS) target_link_libraries( ${LIBNAME} PocoFoundation) install( @@ -29,7 +20,7 @@ install( DESTINATION include PATTERN ".svn" EXCLUDE ) - + install( TARGETS ${LIBNAME} LIBRARY DESTINATION lib${LIB_SUFFIX} diff --git a/JSON/samples/Benchmark/CMakeLists.txt b/JSON/samples/Benchmark/CMakeLists.txt index c39d136e5..4318ed395 100644 --- a/JSON/samples/Benchmark/CMakeLists.txt +++ b/JSON/samples/Benchmark/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoJSON PocoFoundation ) diff --git a/JSON/testsuite/CMakeLists.txt b/JSON/testsuite/CMakeLists.txt index 37158a02c..65fa85d5b 100644 --- a/JSON/testsuite/CMakeLists.txt +++ b/JSON/testsuite/CMakeLists.txt @@ -1,23 +1,24 @@ -set( TEST_SRCS -src/Driver.cpp -src/JSONTest.cpp -src/JSONTest.h -src/JSONTestSuite.cpp -src/JSONTestSuite.h -) - -#include_directories() - -set( WIN_TEST_SRCS -src/WinDriver.cpp -) - set(TESTUNIT "${LIBNAME}-testrunner") +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "src/*.h" ) +POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32 + src/WinDriver.cpp +) + add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${TESTUNIT} PocoJSON PocoFoundation CppUnit ) +if( WIN32) + add_definitions("-D_AFXDLL") + target_link_libraries( ${TESTUNIT} WinTestRunner) +endif(WIN32) # The test is run in the build directory. So the test data is copied there too add_custom_command(TARGET ${TESTUNIT} POST_BUILD diff --git a/MongoDB/CMakeLists.txt b/MongoDB/CMakeLists.txt index 9ee4b8529..e12a709de 100644 --- a/MongoDB/CMakeLists.txt +++ b/MongoDB/CMakeLists.txt @@ -1,37 +1,18 @@ set(LIBNAME "PocoMongoDB") -set(SRCS - src/Array.cpp - src/Binary.cpp - src/Connection.cpp - src/Cursor.cpp - src/Database.cpp - src/DeleteRequest.cpp - src/Document.cpp - src/Element.cpp - src/GetMoreRequest.cpp - src/InsertRequest.cpp - src/JavaScriptCode.cpp - src/KillCursorsRequest.cpp - src/Message.cpp - src/MessageHeader.cpp - src/ObjectId.cpp - src/QueryRequest.cpp - src/RegularExpression.cpp - src/ReplicaSet.cpp - src/RequestMessage.cpp - src/ResponseMessage.cpp - src/UpdateRequest.cpp -) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SRCS ${SRCS_G}) -if (NOT POCO_STATIC) - add_definitions(-DMongoDB_EXPORTS) -endif (NOT POCO_STATIC) +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SRCS ${HDRS_G}) add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) set_target_properties( ${LIBNAME} - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL MongoDB_EXPORTS) target_link_libraries( ${LIBNAME} PocoNet PocoFoundation) install( @@ -48,6 +29,7 @@ install( ) if (ENABLE_TESTS) + add_subdirectory(samples) add_subdirectory(testsuite) endif () diff --git a/MongoDB/samples/SQLToMongo/CMakeLists.txt b/MongoDB/samples/SQLToMongo/CMakeLists.txt index b06c5604d..023fbce23 100644 --- a/MongoDB/samples/SQLToMongo/CMakeLists.txt +++ b/MongoDB/samples/SQLToMongo/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoMongoDB PocoNet PocoFoundation ) diff --git a/MongoDB/testsuite/CMakeLists.txt b/MongoDB/testsuite/CMakeLists.txt index e1636bd52..6a0c9ce23 100644 --- a/MongoDB/testsuite/CMakeLists.txt +++ b/MongoDB/testsuite/CMakeLists.txt @@ -1,21 +1,24 @@ -set( TEST_SRCS -src/Driver.cpp -src/MongoDBTest.cpp -src/MongoDBTest.h -src/MongoDBTestSuite.cpp -src/MongoDBTestSuite.h -) +set(TESTUNIT "${LIBNAME}-testrunner") -#include_directories() +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) -set( WIN_TEST_SRCS -src/WinDriver.cpp +# Headers +file(GLOB_RECURSE HDRS_G "src/*.h" ) +POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32 + src/WinDriver.cpp ) set(TESTUNIT "${LIBNAME}-testrunner") add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${TESTUNIT} PocoMongoDB PocoFoundation CppUnit ) - +if( WIN32) + #TODO: Is this flag always required? + add_definitions("-D_AFXDLL") + target_link_libraries( ${TESTUNIT} WinTestRunner) +endif(WIN32) diff --git a/Net/CMakeLists.txt b/Net/CMakeLists.txt index c9319c81d..bd734dfd9 100644 --- a/Net/CMakeLists.txt +++ b/Net/CMakeLists.txt @@ -1,126 +1,23 @@ set(LIBNAME "PocoNet") -set( BASE_SRCS - src/AbstractHTTPRequestHandler.cpp - src/DatagramSocket.cpp - src/DatagramSocketImpl.cpp - src/DialogSocket.cpp - src/DNS.cpp - src/FilePartSource.cpp - src/FTPClientSession.cpp - src/FTPStreamFactory.cpp - src/HostEntry.cpp - src/HTMLForm.cpp - src/HTTPAuthenticationParams.cpp - src/HTTPBasicCredentials.cpp - src/HTTPBufferAllocator.cpp - src/HTTPChunkedStream.cpp - src/HTTPClientSession.cpp - src/HTTPCookie.cpp - src/HTTPCredentials.cpp - src/HTTPDigestCredentials.cpp - src/HTTPFixedLengthStream.cpp - src/HTTPHeaderStream.cpp - src/HTTPIOStream.cpp - src/HTTPMessage.cpp - src/HTTPRequest.cpp - src/HTTPRequestHandler.cpp - src/HTTPRequestHandlerFactory.cpp - src/HTTPResponse.cpp - src/HTTPServer.cpp - src/HTTPServerConnection.cpp - src/HTTPServerConnectionFactory.cpp - src/HTTPServerParams.cpp - src/HTTPServerRequest.cpp - src/HTTPServerRequestImpl.cpp - src/HTTPServerResponse.cpp - src/HTTPServerResponseImpl.cpp - src/HTTPServerSession.cpp - src/HTTPSession.cpp - src/HTTPSessionFactory.cpp - src/HTTPSessionInstantiator.cpp - src/HTTPStream.cpp - src/HTTPStreamFactory.cpp - src/ICMPClient.cpp - src/ICMPEventArgs.cpp - src/ICMPPacket.cpp - src/ICMPPacketImpl.cpp - src/ICMPSocket.cpp - src/ICMPSocketImpl.cpp - src/ICMPv4PacketImpl.cpp - src/IPAddress.cpp - src/IPAddressImpl.cpp - src/MailMessage.cpp - src/MailRecipient.cpp - src/MailStream.cpp - src/MediaType.cpp - src/MessageHeader.cpp - src/MulticastSocket.cpp - src/MultipartReader.cpp - src/MultipartWriter.cpp - src/NameValueCollection.cpp - src/Net.cpp - src/NetException.cpp - src/NetworkInterface.cpp - src/NTPClient.cpp - src/NTPEventArgs.cpp - src/NTPPacket.cpp - src/NullPartHandler.cpp - src/PartHandler.cpp - src/PartSource.cpp - src/PartStore.cpp - src/POP3ClientSession.cpp - src/QuotedPrintableDecoder.cpp - src/QuotedPrintableEncoder.cpp - src/RawSocket.cpp - src/RawSocketImpl.cpp - src/RemoteSyslogChannel.cpp - src/RemoteSyslogListener.cpp - src/ServerSocket.cpp - src/ServerSocketImpl.cpp - src/SMTPChannel.cpp - src/SMTPClientSession.cpp - src/Socket.cpp - src/SocketAddress.cpp - src/SocketAddressImpl.cpp - src/SocketImpl.cpp - src/SocketNotification.cpp - src/SocketNotifier.cpp - src/SocketReactor.cpp - src/SocketStream.cpp - src/StreamSocket.cpp - src/StreamSocketImpl.cpp - src/StringPartSource.cpp - src/TCPServer.cpp - src/TCPServerConnection.cpp - src/TCPServerConnectionFactory.cpp - src/TCPServerDispatcher.cpp - src/TCPServerParams.cpp - src/WebSocket.cpp - src/WebSocketImpl.cpp -) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SRCS ${SRCS_G}) -set( WIN_SRCS -) - -set( LIN_SRCS -) +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SRCS ${HDRS_G}) +#TODO: Can WIN32 be used here? if(CMAKE_SYSTEM MATCHES "Windows") - set(SRCS ${BASE_SRCS} ${WIN_SRCS}) - set(SYSLIBS ${SYSLIBS} "ws2_32.lib" "iphlpapi.lib") -else (CMAKE_SYSTEM MATCHES "Windows") - set(SRCS ${BASE_SRCS} ${LIN_SRCS}) + set(SYSLIBS ${SYSLIBS} "ws2_32.lib" "iphlpapi.lib") endif(CMAKE_SYSTEM MATCHES "Windows") -if (NOT POCO_STATIC) - add_definitions(-DNet_EXPORTS) -endif (NOT POCO_STATIC) - add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) -set_target_properties( ${LIBNAME} - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) +set_target_properties( ${LIBNAME} + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL Net_EXPORTS) target_link_libraries( ${LIBNAME} PocoFoundation ${SYSLIBS}) install( @@ -128,7 +25,7 @@ install( DESTINATION include PATTERN ".svn" EXCLUDE ) - + install( TARGETS ${LIBNAME} LIBRARY DESTINATION lib${LIB_SUFFIX} diff --git a/Net/samples/EchoServer/CMakeLists.txt b/Net/samples/EchoServer/CMakeLists.txt index 3c80e944b..a4fa6a52a 100644 --- a/Net/samples/EchoServer/CMakeLists.txt +++ b/Net/samples/EchoServer/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Net/samples/HTTPFormServer/CMakeLists.txt b/Net/samples/HTTPFormServer/CMakeLists.txt index 3aa08e298..766095367 100644 --- a/Net/samples/HTTPFormServer/CMakeLists.txt +++ b/Net/samples/HTTPFormServer/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Net/samples/HTTPLoadTest/CMakeLists.txt b/Net/samples/HTTPLoadTest/CMakeLists.txt index 14adeaead..2a5d5ff7d 100644 --- a/Net/samples/HTTPLoadTest/CMakeLists.txt +++ b/Net/samples/HTTPLoadTest/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Net/samples/HTTPTimeServer/CMakeLists.txt b/Net/samples/HTTPTimeServer/CMakeLists.txt index 7cf0b0ac7..135c65293 100644 --- a/Net/samples/HTTPTimeServer/CMakeLists.txt +++ b/Net/samples/HTTPTimeServer/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Net/samples/Mail/CMakeLists.txt b/Net/samples/Mail/CMakeLists.txt index 1f9741e49..1546ea0d4 100644 --- a/Net/samples/Mail/CMakeLists.txt +++ b/Net/samples/Mail/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Net/samples/Ping/CMakeLists.txt b/Net/samples/Ping/CMakeLists.txt index 0e187157e..63c769148 100644 --- a/Net/samples/Ping/CMakeLists.txt +++ b/Net/samples/Ping/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Net/samples/SMTPLogger/CMakeLists.txt b/Net/samples/SMTPLogger/CMakeLists.txt index a805d2812..eb84ca756 100644 --- a/Net/samples/SMTPLogger/CMakeLists.txt +++ b/Net/samples/SMTPLogger/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Net/samples/TimeServer/CMakeLists.txt b/Net/samples/TimeServer/CMakeLists.txt index 138f10026..ab9b46e14 100644 --- a/Net/samples/TimeServer/CMakeLists.txt +++ b/Net/samples/TimeServer/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Net/samples/TwitterClient/CMakeLists.txt b/Net/samples/TwitterClient/CMakeLists.txt index 0fd01621a..687b55c69 100644 --- a/Net/samples/TwitterClient/CMakeLists.txt +++ b/Net/samples/TwitterClient/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Net/samples/WebSocketServer/CMakeLists.txt b/Net/samples/WebSocketServer/CMakeLists.txt index e09622015..3ebda2493 100644 --- a/Net/samples/WebSocketServer/CMakeLists.txt +++ b/Net/samples/WebSocketServer/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Net/samples/dict/CMakeLists.txt b/Net/samples/dict/CMakeLists.txt index b3245565f..cb28ba7e4 100644 --- a/Net/samples/dict/CMakeLists.txt +++ b/Net/samples/dict/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Net/samples/download/CMakeLists.txt b/Net/samples/download/CMakeLists.txt index 38b0b9661..9b378a37a 100644 --- a/Net/samples/download/CMakeLists.txt +++ b/Net/samples/download/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Net/samples/httpget/CMakeLists.txt b/Net/samples/httpget/CMakeLists.txt index cada674e5..7833114fe 100644 --- a/Net/samples/httpget/CMakeLists.txt +++ b/Net/samples/httpget/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Net/samples/ifconfig/CMakeLists.txt b/Net/samples/ifconfig/CMakeLists.txt index 996e3ff72..4878d92dc 100644 --- a/Net/samples/ifconfig/CMakeLists.txt +++ b/Net/samples/ifconfig/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNet PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Net/testsuite/CMakeLists.txt b/Net/testsuite/CMakeLists.txt index 428922420..4eb688052 100644 --- a/Net/testsuite/CMakeLists.txt +++ b/Net/testsuite/CMakeLists.txt @@ -1,74 +1,21 @@ -set( TEST_SRCS -src/DNSTest.cpp -src/DatagramSocketTest.cpp -src/DialogServer.cpp -src/DialogSocketTest.cpp -src/Driver.cpp -src/EchoServer.cpp -src/FTPClientSessionTest.cpp -src/FTPClientTestSuite.cpp -src/FTPStreamFactoryTest.cpp -src/HTMLFormTest.cpp -src/HTMLTestSuite.cpp -src/HTTPClientSessionTest.cpp -src/HTTPClientTestSuite.cpp -src/HTTPCookieTest.cpp -src/HTTPCredentialsTest.cpp -src/HTTPRequestTest.cpp -src/HTTPResponseTest.cpp -src/HTTPServerTest.cpp -src/HTTPServerTestSuite.cpp -src/HTTPStreamFactoryTest.cpp -src/HTTPTestServer.cpp -src/HTTPTestSuite.cpp -src/ICMPClientTest.cpp -src/ICMPClientTestSuite.cpp -src/ICMPSocketTest.cpp -src/IPAddressTest.cpp -src/MailMessageTest.cpp -src/MailStreamTest.cpp -src/MailTestSuite.cpp -src/MediaTypeTest.cpp -src/MessageHeaderTest.cpp -src/MessagesTestSuite.cpp -src/MulticastEchoServer.cpp -src/MulticastSocketTest.cpp -src/MultipartReaderTest.cpp -src/MultipartWriterTest.cpp -src/NameValueCollectionTest.cpp -src/NetCoreTestSuite.cpp -src/NetTestSuite.cpp -src/NetworkInterfaceTest.cpp -src/NTPClientTest.cpp -src/NTPClientTestSuite.cpp -src/POP3ClientSessionTest.cpp -src/QuotedPrintableTest.cpp -src/RawSocketTest.cpp -src/ReactorTestSuite.cpp -src/SMTPClientSessionTest.cpp -src/SocketAddressTest.cpp -src/SocketReactorTest.cpp -src/SocketStreamTest.cpp -src/SocketTest.cpp -src/SocketsTestSuite.cpp -src/SyslogTest.cpp -src/TCPServerTest.cpp -src/TCPServerTestSuite.cpp -src/UDPEchoServer.cpp -src/WebSocketTest.cpp -src/WebSocketTestSuite.cpp -) - -#include_directories() - -set( WIN_TEST_SRCS -src/WinDriver.cpp -) - set(TESTUNIT "${LIBNAME}-testrunner") +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "src/*.h" ) +POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32 + src/WinDriver.cpp +) + add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${TESTUNIT} PocoNet PocoUtil PocoXML PocoFoundation CppUnit) - +if( WIN32) + add_definitions("-D_AFXDLL") + target_link_libraries( ${TESTUNIT} WinTestRunner) +endif(WIN32) diff --git a/NetSSL_OpenSSL/CMakeLists.txt b/NetSSL_OpenSSL/CMakeLists.txt index c975eb681..36862f2a7 100644 --- a/NetSSL_OpenSSL/CMakeLists.txt +++ b/NetSSL_OpenSSL/CMakeLists.txt @@ -1,45 +1,18 @@ set(LIBNAME "PocoNetSSL") -set(SRCS - src/AcceptCertificateHandler.cpp - src/CertificateHandlerFactory.cpp - src/CertificateHandlerFactoryMgr.cpp - src/ConsoleCertificateHandler.cpp - src/Context.cpp - src/HTTPSClientSession.cpp - src/HTTPSSessionInstantiator.cpp - src/HTTPSStreamFactory.cpp - src/InvalidCertificateHandler.cpp - src/KeyConsoleHandler.cpp - src/KeyFileHandler.cpp - src/PrivateKeyFactory.cpp - src/PrivateKeyFactoryMgr.cpp - src/PrivateKeyPassphraseHandler.cpp - src/RejectCertificateHandler.cpp - src/SecureServerSocket.cpp - src/SecureServerSocketImpl.cpp - src/SecureSMTPClientSession.cpp - src/SecureSocketImpl.cpp - src/SecureStreamSocket.cpp - src/SecureStreamSocketImpl.cpp - src/Session.cpp - src/SSLException.cpp - src/SSLManager.cpp - src/Utility.cpp - src/VerificationErrorArgs.cpp - src/X509Certificate.cpp -) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SRCS ${SRCS_G}) -include_directories( ${OPENSSL_INCLUDE_DIR} ) - -if (NOT POCO_STATIC) - add_definitions(-DNetSSL_EXPORTS) -endif (NOT POCO_STATIC) +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SRCS ${HDRS_G}) add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) set_target_properties( ${LIBNAME} - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL NetSSL_EXPORTS) target_link_libraries( ${LIBNAME} PocoCrypto PocoNet PocoUtil PocoFoundation ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ) install( diff --git a/NetSSL_OpenSSL/samples/CMakeLists.txt b/NetSSL_OpenSSL/samples/CMakeLists.txt index 18a675f6b..e6ad6f591 100644 --- a/NetSSL_OpenSSL/samples/CMakeLists.txt +++ b/NetSSL_OpenSSL/samples/CMakeLists.txt @@ -1,2 +1,3 @@ add_subdirectory( HTTPSTimeServer ) add_subdirectory( download ) +add_subdirectory( Mail ) diff --git a/NetSSL_OpenSSL/samples/HTTPSTimeServer/CMakeLists.txt b/NetSSL_OpenSSL/samples/HTTPSTimeServer/CMakeLists.txt index 8df89d0f3..0791da88d 100644 --- a/NetSSL_OpenSSL/samples/HTTPSTimeServer/CMakeLists.txt +++ b/NetSSL_OpenSSL/samples/HTTPSTimeServer/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNetSSL PocoCrypto PocoUtil PocoNet PocoXML PocoFoundation ) diff --git a/NetSSL_OpenSSL/samples/Mail/CMakeLists.txt b/NetSSL_OpenSSL/samples/Mail/CMakeLists.txt index 2e3bf9cf9..6cf2176ce 100644 --- a/NetSSL_OpenSSL/samples/Mail/CMakeLists.txt +++ b/NetSSL_OpenSSL/samples/Mail/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNetSSL PocoCrypto PocoUtil PocoNet PocoXML PocoFoundation ) diff --git a/NetSSL_OpenSSL/samples/download/CMakeLists.txt b/NetSSL_OpenSSL/samples/download/CMakeLists.txt index 0b22fff3a..47ad799ef 100644 --- a/NetSSL_OpenSSL/samples/download/CMakeLists.txt +++ b/NetSSL_OpenSSL/samples/download/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoNetSSL PocoCrypto PocoUtil PocoNet PocoXML PocoFoundation ) diff --git a/NetSSL_OpenSSL/testsuite/CMakeLists.txt b/NetSSL_OpenSSL/testsuite/CMakeLists.txt index 81518bd8d..3b5389928 100644 --- a/NetSSL_OpenSSL/testsuite/CMakeLists.txt +++ b/NetSSL_OpenSSL/testsuite/CMakeLists.txt @@ -1,33 +1,33 @@ -set( TEST_SRCS -src/Driver.cpp -src/HTTPSClientSessionTest.cpp -src/HTTPSClientTestSuite.cpp -src/HTTPSServerTest.cpp -src/HTTPSServerTestSuite.cpp -src/HTTPSStreamFactoryTest.cpp -src/HTTPSTestServer.cpp -src/NetSSLTestSuite.cpp -src/TCPServerTest.cpp -src/TCPServerTestSuite.cpp -) - -#include_directories() - -set( WIN_TEST_SRCS -src/WinDriver.cpp -) - set(TESTUNIT "${LIBNAME}-testrunner") +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "src/*.h" ) +POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32 + src/WinDriver.cpp +) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE + src/WinCEDriver.cpp +) + add_executable( ${TESTUNIT} ${TEST_SRCS} ) -add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) +add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${TESTUNIT} -all) target_link_libraries( ${TESTUNIT} PocoNetSSL PocoCrypto PocoNet PocoUtil PocoXML PocoFoundation CppUnit) +if( WIN32) + add_definitions("-D_AFXDLL") + target_link_libraries( ${TESTUNIT} WinTestRunner) +endif(WIN32) # The test is run in the build directory. So the test data is copied there too add_custom_command(TARGET ${TESTUNIT} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/any.pem ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/rootcert.pem ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/testrunner.xml ${CMAKE_CURRENT_BINARY_DIR}/${TESTUNIT}.xml + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/any.pem ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/rootcert.pem ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/testrunner.xml ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTUNIT}.xml ) diff --git a/PDF/CMakeLists.txt b/PDF/CMakeLists.txt index ff6a31c3e..716a1906a 100644 --- a/PDF/CMakeLists.txt +++ b/PDF/CMakeLists.txt @@ -1,17 +1,12 @@ set(LIBNAME "PocoPDF") -set(SRCS - src/Destination.cpp - src/Document.cpp - src/Encoder.cpp - src/Font.cpp - src/Image.cpp - src/LinkAnnotation.cpp - src/Outline.cpp - src/Page.cpp - src/PDFException.cpp - src/TextAnnotation.cpp -) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SRCS ${HDRS_G}) # If POCO_UNBUNDLED is enabled we try to find the required packages # The configuration will fail if the packages are not found @@ -20,8 +15,8 @@ if (POCO_UNBUNDLED) set(SYSLIBS ${SYSLIBS} ${ZLIB_LIBRARIES}) include_directories(${ZLIB_INCLUDE_DIRS}) else() - # ZLIB - list(APPEND SRCS + # zlib + POCO_SOURCES( SRCS zlib src/adler32.c src/compress.c src/crc32.c @@ -38,8 +33,8 @@ endif (POCO_UNBUNDLED) # TODO: Currently only bundled is supported, in future this should also be possible # with an unbundled version of hpdf -# HPDF -list(APPEND SRCS +# hpdf +POCO_SOURCES( SRCS hpdf src/hpdf_annotation.c src/hpdf_array.c src/hpdf_binary.c @@ -94,7 +89,7 @@ list(APPEND SRCS # TODO: Currently only bundled is supported, in future this should also be possible # with an unbundled version of libpng -list(APPEND SRCS +POCO_SOURCES( SRCS libpng src/png.c src/pngerror.c src/pnggccrd.c @@ -115,16 +110,13 @@ list(APPEND SRCS src/pngwutil.c ) -include_directories(include/Poco/PDF) # zip src - -if (NOT POCO_STATIC) - add_definitions(-DPDF_EXPORTS) -endif (NOT POCO_STATIC) +include_directories( "include/Poco/PDF" ) # zip src add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) set_target_properties( ${LIBNAME} - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL PDF_EXPORTS) target_link_libraries( ${LIBNAME} ${SYSLIBS} PocoFoundation ) install( diff --git a/PDF/samples/Image/CMakeLists.txt b/PDF/samples/Image/CMakeLists.txt index b7eb9d2d1..1f8d58c55 100644 --- a/PDF/samples/Image/CMakeLists.txt +++ b/PDF/samples/Image/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoPDF PocoFoundation ) diff --git a/PDF/samples/Text/CMakeLists.txt b/PDF/samples/Text/CMakeLists.txt index 01cdf4ab7..98bd3d3fc 100644 --- a/PDF/samples/Text/CMakeLists.txt +++ b/PDF/samples/Text/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoPDF PocoFoundation ) diff --git a/PDF/testsuite/CMakeLists.txt b/PDF/testsuite/CMakeLists.txt index b3c4f6448..f4046d781 100644 --- a/PDF/testsuite/CMakeLists.txt +++ b/PDF/testsuite/CMakeLists.txt @@ -1,21 +1,22 @@ -set( TEST_SRCS -src/Driver.cpp -src/PDFTest.cpp -src/PDFTest.h -src/PDFTestSuite.cpp -src/PDFTestSuite.h -) - -#include_directories() - -set( WIN_TEST_SRCS -src/WinDriver.cpp -) - set(TESTUNIT "${LIBNAME}-testrunner") +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "src/*.h" ) +POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32 + src/WinDriver.cpp +) + add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${TESTUNIT} PocoPDF PocoFoundation CppUnit ) +if( WIN32) + add_definitions("-D_AFXDLL") + target_link_libraries( ${TESTUNIT} WinTestRunner) +endif(WIN32) diff --git a/SevenZip/CMakeLists.txt b/SevenZip/CMakeLists.txt index 1ab5c59a4..2162572d8 100644 --- a/SevenZip/CMakeLists.txt +++ b/SevenZip/CMakeLists.txt @@ -1,13 +1,16 @@ set(LIBNAME "PocoSevenZip") -set(SRCS - src/Archive.cpp - src/ArchiveEntry.cpp -) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SRCS ${HDRS_G}) # TODO: Currently only bundled is supported, in future this should also be possible # with an unbundled version of 7z -list(APPEND SRCS +POCO_SOURCES( SRCS 7z src/7zAlloc.c src/7zBuf2.c src/7zBuf.c @@ -17,7 +20,7 @@ list(APPEND SRCS src/7zFile.c src/7zIn.c src/7zStream.c -# src/Alloc.c + src/Alloc.c src/Bcj2.c src/Bra86.c src/Bra.c @@ -46,16 +49,13 @@ list(APPEND SRCS # src/XzIn.c ) -include_directories( "include" ) - -if (NOT POCO_STATIC) - add_definitions(-DSevenZip_EXPORTS) -endif (NOT POCO_STATIC) +include_directories( include ) add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) set_target_properties( ${LIBNAME} - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL SevenZip_EXPORTS) target_link_libraries( ${LIBNAME} PocoUtil PocoXML PocoFoundation) install( @@ -72,8 +72,7 @@ install( ) if (ENABLE_TESTS) - # TODO: Enable CMake for samples - #add_subdirectory(samples) + add_subdirectory(samples) # TODO: Add tests #add_subdirectory(testsuite) endif () diff --git a/SevenZip/samples/CMakeLists.txt b/SevenZip/samples/CMakeLists.txt new file mode 100644 index 000000000..74a93e4b3 --- /dev/null +++ b/SevenZip/samples/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory( un7zip ) diff --git a/SevenZip/samples/un7zip/CMakeLists.txt b/SevenZip/samples/un7zip/CMakeLists.txt new file mode 100644 index 000000000..bfae9b5c8 --- /dev/null +++ b/SevenZip/samples/un7zip/CMakeLists.txt @@ -0,0 +1,7 @@ +set(SAMPLE_NAME "un7zip") + +set(LOCAL_SRCS "") +aux_source_directory(src LOCAL_SRCS) + +add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) +target_link_libraries( ${SAMPLE_NAME} PocoSevenZip PocoUtil PocoXML PocoFoundation ) diff --git a/Util/CMakeLists.txt b/Util/CMakeLists.txt index 1e2431592..058a7d73b 100644 --- a/Util/CMakeLists.txt +++ b/Util/CMakeLists.txt @@ -1,36 +1,14 @@ set(LIBNAME "PocoUtil") -set(BASE_SRCS - src/AbstractConfiguration.cpp - src/Application.cpp - src/ConfigurationMapper.cpp - src/ConfigurationView.cpp - src/FilesystemConfiguration.cpp - src/HelpFormatter.cpp - src/IniFileConfiguration.cpp - src/IntValidator.cpp - src/JSONConfiguration.cpp - src/LayeredConfiguration.cpp - src/LoggingConfigurator.cpp - src/LoggingSubsystem.cpp - src/MapConfiguration.cpp - src/OptionCallback.cpp - src/Option.cpp - src/OptionException.cpp - src/OptionProcessor.cpp - src/OptionSet.cpp - src/PropertyFileConfiguration.cpp - src/RegExpValidator.cpp - src/ServerApplication.cpp - src/Subsystem.cpp - src/SystemConfiguration.cpp - src/Timer.cpp - src/TimerTask.cpp - src/Validator.cpp - src/XMLConfiguration.cpp -) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SRCS ${SRCS_G}) -set( WIN_SRCS +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SRCS ${HDRS_G}) + +POCO_SOURCES_AUTO_PLAT( SRCS WIN32 src/WinRegistryConfiguration.cpp src/WinRegistryKey.cpp src/WinService.cpp @@ -38,17 +16,11 @@ set( WIN_SRCS include_directories( "include" ) -if(CMAKE_SYSTEM MATCHES "Windows") - set(SRCS ${BASE_SRCS} ${WIN_SRCS}) - add_definitions(-DUtil_EXPORTS) -else (CMAKE_SYSTEM MATCHES "Windows") - set(SRCS ${BASE_SRCS}) -endif(CMAKE_SYSTEM MATCHES "Windows") - add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) set_target_properties( ${LIBNAME} PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL Util_EXPORTS) target_link_libraries( ${LIBNAME} PocoJSON PocoXML PocoFoundation) install( diff --git a/Util/samples/SampleApp/CMakeLists.txt b/Util/samples/SampleApp/CMakeLists.txt index 605979dbf..74df9e7de 100644 --- a/Util/samples/SampleApp/CMakeLists.txt +++ b/Util/samples/SampleApp/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Util/samples/SampleServer/CMakeLists.txt b/Util/samples/SampleServer/CMakeLists.txt index b78b60489..b743e4ab9 100644 --- a/Util/samples/SampleServer/CMakeLists.txt +++ b/Util/samples/SampleServer/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Util/samples/Units/CMakeLists.txt b/Util/samples/Units/CMakeLists.txt index 7aa07e55a..aa3bb053c 100644 --- a/Util/samples/Units/CMakeLists.txt +++ b/Util/samples/Units/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Util/samples/pkill/CMakeLists.txt b/Util/samples/pkill/CMakeLists.txt index 7312ab663..5e248d7f3 100644 --- a/Util/samples/pkill/CMakeLists.txt +++ b/Util/samples/pkill/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoUtil PocoJSON PocoXML PocoFoundation ) diff --git a/Util/testsuite/CMakeLists.txt b/Util/testsuite/CMakeLists.txt index e321314cc..30e30225b 100644 --- a/Util/testsuite/CMakeLists.txt +++ b/Util/testsuite/CMakeLists.txt @@ -1,39 +1,28 @@ -set( TEST_SRCS -src/AbstractConfigurationTest.cpp -src/JSONConfigurationTest.cpp -src/ConfigurationMapperTest.cpp -src/ConfigurationTestSuite.cpp -src/ConfigurationViewTest.cpp -src/Driver.cpp -src/FilesystemConfigurationTest.cpp -src/HelpFormatterTest.cpp -src/IniFileConfigurationTest.cpp -src/LayeredConfigurationTest.cpp -src/LoggingConfiguratorTest.cpp -src/MapConfigurationTest.cpp -src/OptionProcessorTest.cpp -src/OptionSetTest.cpp -src/OptionTest.cpp -src/OptionsTestSuite.cpp -src/PropertyFileConfigurationTest.cpp -src/SystemConfigurationTest.cpp -src/UtilTestSuite.cpp -src/ValidatorTest.cpp -src/XMLConfigurationTest.cpp -src/TimerTestSuite.cpp -src/TimerTest.cpp -) - -set( WIN_TEST_SRCS -src/WinConfigurationTest.cpp -src/WinDriver.cpp -src/WinRegistryTest.cpp -src/WindowsTestSuite.cpp -) - set(TESTUNIT "${LIBNAME}-testrunner") +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "src/*.h" ) +POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32 + src/WinDriver.cpp + src/WinConfigurationTest.cpp + src/WinRegistryTest.cpp + src/WindowsTestSuite.cpp +) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE + src/WinCEDriver.cpp +) + add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${TESTUNIT} PocoUtil PocoJSON PocoXML PocoFoundation CppUnit) +if( WIN32) + add_definitions("-D_AFXDLL") + target_link_libraries( ${TESTUNIT} WinTestRunner) +endif(WIN32) diff --git a/XML/CMakeLists.txt b/XML/CMakeLists.txt index 9ac594f62..0c9bccfd7 100644 --- a/XML/CMakeLists.txt +++ b/XML/CMakeLists.txt @@ -1,74 +1,12 @@ set(LIBNAME "PocoXML") -set(SRCS - src/AbstractContainerNode.cpp - src/AbstractNode.cpp - src/Attr.cpp - src/Attributes.cpp - src/AttributesImpl.cpp - src/AttrMap.cpp - src/CDATASection.cpp - src/CharacterData.cpp - src/ChildNodesList.cpp - src/Comment.cpp - src/ContentHandler.cpp - src/DeclHandler.cpp - src/DefaultHandler.cpp - src/Document.cpp - src/DocumentEvent.cpp - src/DocumentFragment.cpp - src/DocumentType.cpp - src/DOMBuilder.cpp - src/DOMException.cpp - src/DOMImplementation.cpp - src/DOMObject.cpp - src/DOMParser.cpp - src/DOMSerializer.cpp - src/DOMWriter.cpp - src/DTDHandler.cpp - src/DTDMap.cpp - src/Element.cpp - src/ElementsByTagNameList.cpp - src/Entity.cpp - src/EntityReference.cpp - src/EntityResolver.cpp - src/EntityResolverImpl.cpp - src/ErrorHandler.cpp - src/Event.cpp - src/EventDispatcher.cpp - src/EventException.cpp - src/EventListener.cpp - src/EventTarget.cpp - src/InputSource.cpp - src/LexicalHandler.cpp - src/Locator.cpp - src/LocatorImpl.cpp - src/MutationEvent.cpp - src/Name.cpp - src/NamedNodeMap.cpp - src/NamePool.cpp - src/NamespaceStrategy.cpp - src/NamespaceSupport.cpp - src/NodeAppender.cpp - src/Node.cpp - src/NodeFilter.cpp - src/NodeIterator.cpp - src/NodeList.cpp - src/Notation.cpp - src/ParserEngine.cpp - src/ProcessingInstruction.cpp - src/SAXException.cpp - src/SAXParser.cpp - src/Text.cpp - src/TreeWalker.cpp - src/WhitespaceFilter.cpp - src/XMLException.cpp - src/XMLFilter.cpp - src/XMLFilterImpl.cpp - src/XMLReader.cpp - src/XMLString.cpp - src/XMLWriter.cpp -) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SRCS ${HDRS_G}) # If POCO_UNBUNDLED is enabled we try to find the required packages # The configuration will fail if the packages are not found @@ -77,7 +15,7 @@ if (POCO_UNBUNDLED) set(SYSLIBS ${SYSLIBS} ${EXPAT_LIBRARIES}) include_directories(${EXPAT_INCLUDE_DIRS}) else() - list(APPEND SRCS + POCO_SOURCES( SRCS expat src/xmlparse.cpp src/xmlrole.c src/xmltok.c @@ -86,18 +24,13 @@ else() ) endif (POCO_UNBUNDLED) - - -add_definitions(-D_USRDLL -DXML_NS -DXML_DTD -DHAVE_EXPAT_CONFIG_H -DXML_EXPORTS) - -if (NOT POCO_STATIC) - add_definitions(-DXML_EXPORTS) -endif (NOT POCO_STATIC) +add_definitions(-D_USRDLL -DXML_NS -DXML_DTD -DHAVE_EXPAT_CONFIG_H) add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) set_target_properties( ${LIBNAME} - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL XML_EXPORTS) target_link_libraries( ${LIBNAME} ${SYSLIBS} PocoFoundation) install( diff --git a/XML/samples/DOMParser/CMakeLists.txt b/XML/samples/DOMParser/CMakeLists.txt index 9d704e5de..eb10f936a 100644 --- a/XML/samples/DOMParser/CMakeLists.txt +++ b/XML/samples/DOMParser/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoXML PocoFoundation ) diff --git a/XML/samples/DOMWriter/CMakeLists.txt b/XML/samples/DOMWriter/CMakeLists.txt index 4d1457623..52185ded6 100644 --- a/XML/samples/DOMWriter/CMakeLists.txt +++ b/XML/samples/DOMWriter/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoXML PocoFoundation ) diff --git a/XML/samples/PrettyPrint/CMakeLists.txt b/XML/samples/PrettyPrint/CMakeLists.txt index 6097ada61..297917678 100644 --- a/XML/samples/PrettyPrint/CMakeLists.txt +++ b/XML/samples/PrettyPrint/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoXML PocoFoundation ) diff --git a/XML/samples/SAXParser/CMakeLists.txt b/XML/samples/SAXParser/CMakeLists.txt index 4210d33d4..99f1567c8 100644 --- a/XML/samples/SAXParser/CMakeLists.txt +++ b/XML/samples/SAXParser/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoXML PocoFoundation ) diff --git a/XML/testsuite/CMakeLists.txt b/XML/testsuite/CMakeLists.txt index 7c93a5ef7..d7983d223 100644 --- a/XML/testsuite/CMakeLists.txt +++ b/XML/testsuite/CMakeLists.txt @@ -1,37 +1,26 @@ -set( TEST_SRCS -src/AttributesImplTest.cpp -src/ChildNodesTest.cpp -src/DOMTestSuite.cpp -src/DocumentTest.cpp -src/DocumentTypeTest.cpp -src/Driver.cpp -src/ElementTest.cpp -src/EventTest.cpp -src/NamePoolTest.cpp -src/NameTest.cpp -src/NamespaceSupportTest.cpp -src/NodeAppenderTest.cpp -src/NodeIteratorTest.cpp -src/NodeTest.cpp -src/ParserWriterTest.cpp -src/SAXParserTest.cpp -src/SAXTestSuite.cpp -src/TextTest.cpp -src/TreeWalkerTest.cpp -src/XMLTestSuite.cpp -src/XMLWriterTest.cpp -) - -#include_directories() - -set( WIN_TEST_SRCS -src/WinDriver.cpp -) - set(TESTUNIT "${LIBNAME}-testrunner") +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "src/*.h" ) +POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32 + src/WinDriver.cpp +) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE + src/WinCEDriver.cpp +) + add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) -#set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${TESTUNIT} PocoXML PocoFoundation CppUnit) +if( WIN32) + add_definitions("-D_AFXDLL") + target_link_libraries( ${TESTUNIT} WinTestRunner) +endif(WIN32) diff --git a/Zip/CMakeLists.txt b/Zip/CMakeLists.txt index 11677c53a..7d3850164 100644 --- a/Zip/CMakeLists.txt +++ b/Zip/CMakeLists.txt @@ -1,38 +1,18 @@ set(LIBNAME "PocoZip") -set(SRCS - src/Add.cpp - src/AutoDetectStream.cpp - src/Compress.cpp - src/Decompress.cpp - src/Delete.cpp - src/Keep.cpp - src/ParseCallback.cpp - src/PartialStream.cpp - src/Rename.cpp - src/Replace.cpp - src/SkipCallback.cpp - src/ZipArchive.cpp - src/ZipArchiveInfo.cpp - src/ZipCommon.cpp - src/ZipDataInfo.cpp - src/ZipException.cpp - src/ZipFileInfo.cpp - src/ZipLocalFileHeader.cpp - src/ZipManipulator.cpp - src/ZipOperation.cpp - src/ZipStream.cpp - src/ZipUtil.cpp -) +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( SRCS ${SRCS_G}) -if (NOT POCO_STATIC) - add_definitions(-DZip_EXPORTS) -endif (NOT POCO_STATIC) +# Headers +file(GLOB_RECURSE HDRS_G "include/*.h" ) +POCO_HEADERS_AUTO( SRCS ${HDRS_G}) add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} ) -set_target_properties( ${LIBNAME} - PROPERTIES - VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} ) +set_target_properties( ${LIBNAME} + PROPERTIES + VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} + DEFINE_SYMBOL Zip_EXPORTS) target_link_libraries( ${LIBNAME} PocoUtil PocoXML PocoFoundation) install( diff --git a/Zip/samples/unzip/CMakeLists.txt b/Zip/samples/unzip/CMakeLists.txt index 9fda9b453..e881cbe9f 100644 --- a/Zip/samples/unzip/CMakeLists.txt +++ b/Zip/samples/unzip/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoZip PocoUtil PocoXML PocoFoundation ) diff --git a/Zip/samples/zip/CMakeLists.txt b/Zip/samples/zip/CMakeLists.txt index 254afa73b..8b79e0dd4 100644 --- a/Zip/samples/zip/CMakeLists.txt +++ b/Zip/samples/zip/CMakeLists.txt @@ -4,5 +4,4 @@ set(LOCAL_SRCS "") aux_source_directory(src LOCAL_SRCS) add_executable( ${SAMPLE_NAME} ${LOCAL_SRCS} ) -#set_target_properties( ${SAMPLE_NAME} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${SAMPLE_NAME} PocoZip PocoUtil PocoXML PocoFoundation ) diff --git a/Zip/testsuite/CMakeLists.txt b/Zip/testsuite/CMakeLists.txt index ab3ffa34c..af1547ec9 100644 --- a/Zip/testsuite/CMakeLists.txt +++ b/Zip/testsuite/CMakeLists.txt @@ -1,23 +1,29 @@ -set( TEST_SRCS -src/CompressTest.cpp -src/Driver.cpp -src/PartialStreamTest.cpp -src/ZipTest.cpp -src/ZipTestSuite.cpp -) - -#include_directories() - -set( WIN_TEST_SRCS -src/WinDriver.cpp -) - set(TESTUNIT "${LIBNAME}-testrunner") +# Sources +file(GLOB SRCS_G "src/*.cpp") +POCO_SOURCES_AUTO( TEST_SRCS ${SRCS_G}) + +# Headers +file(GLOB_RECURSE HDRS_G "src/*.h" ) +POCO_HEADERS_AUTO( TEST_SRCS ${HDRS_G}) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WIN32 + src/WinDriver.cpp +) + +POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE + src/WinCEDriver.cpp +) + add_executable( ${TESTUNIT} ${TEST_SRCS} ) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${TESTUNIT} -all) #set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) target_link_libraries( ${TESTUNIT} PocoZip PocoNet PocoFoundation CppUnit ) +if( WIN32) + add_definitions("-D_AFXDLL") + target_link_libraries( ${TESTUNIT} WinTestRunner) +endif(WIN32) # The test is run in the build directory. So the test data is copied there too add_custom_command(TARGET ${TESTUNIT} POST_BUILD diff --git a/build/config/Android b/build/config/Android index c86d6a6ee..f1cb5e6fa 100644 --- a/build/config/Android +++ b/build/config/Android @@ -24,7 +24,7 @@ ARCHFLAGS = -march=armv7-a -mfloat-abi=softfp LINKFLAGS = -Wl,--fix-cortex-a8 else ifeq ($(ANDROID_ABI),x86) -TOOL = i686-android-linux +TOOL = i686-linux-android ARCHFLAGS = -march=i686 -msse3 -mstackrealign -mfpmath=sse else $(error Invalid ABI specified in ANDROID_ABI) diff --git a/buildwin.ps1 b/buildwin.ps1 index 7650afe69..6fc748074 100644 --- a/buildwin.ps1 +++ b/buildwin.ps1 @@ -337,6 +337,19 @@ function Build if ($omitArray -NotContains $component) { $vsProject = "$poco_base\$componentDir\$componentName$($platformName)$($suffix).$($extension)" + + if (!(Test-Path -Path $vsProject)) # when VS project name is not same as directory name + { + $vsProject = "$poco_base\$componentDir$($platformName)$($suffix).$($extension)" + if (!(Test-Path -Path $vsProject)) # not found + { + Write-Host "+------------------------------------------------------------------" + Write-Host "| VS project $vsProject not found, skipping." + Write-Host "+------------------------------------------------------------------" + Return # since Foreach-Object is a function, this is actually loop "continue" + } + } + Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" Write-Host "| Building $vsProject" Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" diff --git a/cmake/FindODBC.cmake b/cmake/FindODBC.cmake index 15b527aa4..9e229ed4a 100644 --- a/cmake/FindODBC.cmake +++ b/cmake/FindODBC.cmake @@ -1,48 +1,58 @@ -# check for location of odbc_config -find_program(UNIX_ODBC_CONFIG odbc_config - $ENV{ODBC_PATH}/bin - /usr/bin - /usr/local/bin - PATHS) +# +# Find the ODBC driver manager includes and library. +# +# ODBC is an open standard for connecting to different databases in a +# semi-vendor-independent fashion. First you install the ODBC driver +# manager. Then you need a driver for each separate database you want +# to connect to (unless a generic one works). VTK includes neither +# the driver manager nor the vendor-specific drivers: you have to find +# those yourself. +# +# This module defines +# ODBC_INCLUDE_DIRECTORIES, where to find sql.h +# ODBC_LIBRARIES, the libraries to link against to use ODBC +# ODBC_FOUND. If false, you cannot build anything that requires MySQL. -# Check that we can find the ODBC headers in `odbc_config --include-prefix` -# location If the headers cannot be found, set UNIX_ODBC_CONFIG to -# UNIX_ODBC_CONFIG-NOTFOUND since the odbc_config tool is essentially useless -# if `odbc_config --include-prefix` doesn't actually point to ODBC headers -if(NOT ${UNIX_ODBC_CONFIG} MATCHES "UNIX_ODBC_CONFIG-NOTFOUND") - execute_process(COMMAND ${UNIX_ODBC_CONFIG} --include-prefix - OUTPUT_VARIABLE UNIX_ODBC_INCLUDE_PREFIX - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(NOT EXISTS ${UNIX_ODBC_INCLUDE_PREFIX}/sqlext.h) - set(UNIX_ODBC_CONFIG "UNIX_ODBC_CONFIG-NOTFOUND") - endif(NOT EXISTS ${UNIX_ODBC_INCLUDE_PREFIX}/sqlext.h) -endif(NOT ${UNIX_ODBC_CONFIG} MATCHES "UNIX_ODBC_CONFIG-NOTFOUND") +find_path(ODBC_INCLUDE_DIRECTORIES + NAMES sql.h + HINTS + /usr/include + /usr/include/odbc + /usr/local/include + /usr/local/include/odbc + /usr/local/odbc/include + "C:/Program Files/ODBC/include" + "C:/Program Files/Microsoft SDKs/Windows/v7.0/include" + "C:/Program Files/Microsoft SDKs/Windows/v6.0a/include" + "C:/ODBC/include" + DOC "Specify the directory containing sql.h." +) -if(${UNIX_ODBC_CONFIG} MATCHES "UNIX_ODBC_CONFIG-NOTFOUND") - message(STATUS "Couldn't find unixODBC") -else(${UNIX_ODBC_CONFIG} MATCHES "UNIX_ODBC_CONFIG-NOTFOUND") - message(STATUS "Found unixODBC: odbc_config in ${UNIX_ODBC_CONFIG}") - exec_program(${UNIX_ODBC_CONFIG} ARGS "--include-prefix" OUTPUT_VARIABLE ODBC_INCLUDE_DIR) - include_directories(${ODBC_INCLUDE_DIR}) - exec_program(${UNIX_ODBC_CONFIG} ARGS "--libs" OUTPUT_VARIABLE ODBC_LINK_FLAGS) - add_definitions(-DPOCO_UNIXODBC) -endif(${UNIX_ODBC_CONFIG} MATCHES "UNIX_ODBC_CONFIG-NOTFOUND") +find_library(ODBC_LIBRARIES + NAMES iodbc odbc odbcinst odbc32 + HINTS + /usr/lib + /usr/lib/odbc + /usr/local/lib + /usr/local/lib/odbc + /usr/local/odbc/lib + "C:/Program Files/ODBC/lib" + "C:/ODBC/lib/debug" + "C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib" + DOC "Specify the ODBC driver manager library here." +) -find_program(IODBC_CONFIG iodbc-config - $ENV{ODBC_PATH}/bin - /usr/bin - /usr/local/bin - PATHS) +# MinGW find usually fails +if(MINGW) + set(ODBC_INCLUDE_DIRECTORIES ".") + set(ODBC_LIBRARIES odbc32) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ODBC + DEFAULT_MSG + ODBC_INCLUDE_DIRECTORIES + ODBC_LIBRARIES + ) -if(${IODBC_CONFIG} MATCHES "IODBC_CONFIG-NOTFOUND") - message(STATUS "Couldn't find iODBC") -else(${IODBC_CONFIG} MATCHES "IODBC_CONFIG-NOTFOUND") - message(STATUS "Found iODBC: iodbc-config in ${IODBC_CONFIG}") - exec_program(${IODBC_CONFIG} ARGS "--cflags" OUTPUT_VARIABLE ODBC_CFLAGS) - add_definitions( ${ODBC_CFLAGS} ) - exec_program(${IODBC_CONFIG} ARGS "--libs" OUTPUT_VARIABLE ODBC_LINK_FLAGS) - add_definitions(-DPOCO_IODBC) -endif(${IODBC_CONFIG} MATCHES "IODBC_CONFIG-NOTFOUND") - -message(STATUS "UNIX ODBC: ${UNIX_ODBC_CONFIG}") -message(STATUS "IODBC: ${IODBC_CONFIG}") +mark_as_advanced(ODBC_FOUND ODBC_LIBRARIES ODBC_INCLUDE_DIRECTORIES) diff --git a/cmake/PocoMacros.cmake b/cmake/PocoMacros.cmake new file mode 100644 index 000000000..42c49b350 --- /dev/null +++ b/cmake/PocoMacros.cmake @@ -0,0 +1,184 @@ +# Copyright Siemens AG, 2014 +# Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +# and Contributors. +# +# SPDX-License-Identifier: BSL-1.0 +# +# Collection of common functionality for Poco CMake + +# Find the Microsoft mc.exe message compiler +# +# CMAKE_MC_COMPILER - where to find mc.exe +if (WIN32) + # cmake has CMAKE_RC_COMPILER, but no message compiler + if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio") + # this path is only present for 2008+, but we currently require PATH to + # be set up anyway + get_filename_component(sdk_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" REALPATH) + get_filename_component(kit_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot]" REALPATH) + if (X64) + set(sdk_bindir "${sdk_dir}/bin/x64") + set(kit_bindir "${kit_dir}/bin/x64") + else (X64) + set(sdk_bindir "${sdk_dir}/bin") + set(kit_bindir "${kit_dir}/bin/x86") + endif (X64) + endif () + find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" + DOC "path to message compiler") + if (NOT CMAKE_MC_COMPILER) + message(FATAL_ERROR "message compiler not found: required to build") + endif (NOT CMAKE_MC_COMPILER) + message(STATUS "Found message compiler: ${CMAKE_MC_COMPILER}") + mark_as_advanced(CMAKE_MC_COMPILER) +endif(WIN32) + +#=============================================================================== +# Macros for Source file management +# +# POCO_SOURCES_PLAT - Adds a list of files to the sources of a components +# Usage: POCO_SOURCES_PLAT( out name platform sources) +# 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 ) +# +# POCO_SOURCES - Like POCO_SOURCES_PLAT with platform = ON (Built on all platforms) +# Usage: POCO_SOURCES( out name sources) +# Example: POCO_SOURCES( SRCS Foundation src/Foundation.cpp) +# +# POCO_SOURCES_AUTO - Like POCO_SOURCES but the name is read from the file header // Package: X +# Usage: POCO_SOURCES_AUTO( out sources) +# Example: POCO_SOURCES_AUTO( SRCS src/Foundation.cpp) +# +# POCO_SOURCES_AUTO_PLAT - Like POCO_SOURCES_PLAT but the name is read from the file header // Package: X +# Usage: POCO_SOURCES_AUTO_PLAT(out platform sources) +# Example: POCO_SOURCES_AUTO_PLAT( SRCS WIN32 src/Foundation.cpp) +# +# +# POCO_HEADERS - Adds a list of files to the headers of a components +# Usage: POCO_HEADERS( out name headers) +# INPUT: +# out the variable the headers are added to +# name: the name of the components +# headers: a list of files to add to HDRSt +# Example: POCO_HEADERS( HDRS Foundation include/Poco/Foundation.h ) +# +# POCO_HEADERS_AUTO - Like POCO_HEADERS but the name is read from the file header // Package: X +# Usage: POCO_HEADERS_AUTO( out headers) +# Example: POCO_HEADERS_AUTO( HDRS src/Foundation.cpp) +# +# +# POCO_MESSAGES - Adds a list of files to the messages of a components +# and adds the generated headers to the header list of the component. +# On platforms other then Windows this does nothing +# Usage: POCO_MESSAGES( out name messages) +# INPUT: +# out the variable the message and the resulting headers are added to +# name: the name of the components +# messages: a list of files to add to MSGS +# Example: POCO_MESSAGES( HDRS Foundation include/Poco/Foundation.mc ) +# + + +macro(POCO_SOURCES_PLAT out name platform) + source_group("${name}\\Source Files" FILES ${ARGN}) + list(APPEND ${out} ${ARGN}) + if(NOT ${platform}) + set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE) + endif() +endmacro() + +macro(POCO_SOURCES out name) + POCO_SOURCES_PLAT( ${out} ${name} ON ${ARGN}) +endmacro() + +macro(POCO_SOURCES_AUTO out) + POCO_SOURCES_AUTO_PLAT( ${out} ON ${ARGN}) +endmacro() + +macro(POCO_SOURCES_AUTO_PLAT out platform) + foreach( f ${ARGN}) + + get_filename_component(fname ${f} NAME) + + # Read the package name from the source file + file(STRINGS ${f} package REGEX "// Package: (.*)") + if(package) + string(REGEX REPLACE ".*: (.*)" "\\1" name ${package}) + + # Files of the Form X_UNIX.cpp are treated as headers + if(${fname} MATCHES ".*_.*\\..*") + #message(STATUS "Platform: ${name} ${f} ${platform}") + POCO_SOURCES_PLAT( ${out} ${name} OFF ${f}) + else() + #message(STATUS "Source: ${name} ${f} ${platform}") + POCO_SOURCES_PLAT( ${out} ${name} ${platform} ${f}) + endif() + else() + #message(STATUS "Source: Unknown ${f} ${platform}") + POCO_SOURCES_PLAT( ${out} Unknown ${platform} ${f}) + endif() + endforeach() +endmacro() + + +macro(POCO_HEADERS_AUTO out) + foreach( f ${ARGN}) + + get_filename_component(fname ${f} NAME) + + # Read the package name from the source file + file(STRINGS ${f} package REGEX "// Package: (.*)") + if(package) + string(REGEX REPLACE ".*: (.*)" "\\1" name ${package}) + #message(STATUS "Header: ${name} ${f}") + POCO_HEADERS( ${out} ${name} ${f}) + else() + #message(STATUS "Header: Unknown ${f}") + POCO_HEADERS( ${out} Unknown ${f}) + endif() + endforeach() +endmacro() + +macro(POCO_HEADERS out name) + set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE) + source_group("${name}\\Header Files" FILES ${ARGN}) + list(APPEND ${out} ${ARGN}) +endmacro() + + +macro(POCO_MESSAGES out name) + if (WIN32) + foreach(msg ${ARGN}) + get_filename_component(msg_name ${msg} NAME) + get_filename_component(msg_path ${msg} ABSOLUTE) + string(REPLACE ".mc" ".h" hdr ${msg_name}) + set_source_files_properties(${hdr} PROPERTIES GENERATED TRUE) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${hdr} + DEPENDS ${msg} + COMMAND ${CMAKE_MC_COMPILER} + ARGS + -h ${CMAKE_CURRENT_BINARY_DIR} + -r ${CMAKE_CURRENT_BINARY_DIR} + ${msg_path} + VERBATIM # recommended: p260 + ) + + # Add the generated file to the include directory + include_directories(${CMAKE_CURRENT_BINARY_DIR}) + + # Add the generated headers to POCO_HEADERS of the component + POCO_HEADERS( ${out} ${name} ${CMAKE_CURRENT_BINARY_DIR}/${hdr}) + + endforeach() + + set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE) + source_group("${name}\\Message Files" FILES ${ARGN}) + list(APPEND ${out} ${ARGN}) + + endif (WIN32) +endmacro()