diff --git a/CMakeLists.txt b/CMakeLists.txt index 32151c34a..5f9fef065 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,13 @@ +PROJECT(poco) + cmake_minimum_required(VERSION 2.4.8) set(CPACK_PACKAGE_VERSION_MAJOR "1") set(CPACK_PACKAGE_VERSION_MINOR "3") set(CPACK_PACKAGE_VERSION_PATCH "99") +SET(COMPLETE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}) +SET(RELEASE_NAME "Unstable-trunk") +SET(PROJECT_VERSION ${COMPLETE_VERSION}) #set(COMMON_CXX "-Wall -Wno-sign-compare") set(DEBUG_CXX_FLAGS "${COMMON_CXX} ${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") @@ -15,6 +20,13 @@ else(POCO_STATIC) set( LIB_MODE SHARED ) endif(POCO_STATIC) +# whether unit tests should be build +SET (ENABLE_TESTS FALSE CACHE BOOL "Build unit tests?") + +IF (ENABLE_TESTS) + ENABLE_TESTING() +ENDIF (ENABLE_TESTS) + # Set local include path include_directories( CppUnit/include Foundation/include XML/include Net/include NetSSL_OpenSSL/include Util/include Data/include WebWidgets/include Zip/include) @@ -37,17 +49,17 @@ endif(CMAKE_SYSTEM MATCHES "Windows") # Standard 'must be' defines add_definitions( -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 ) -# UTF-8 detection (POCO_WIN32_UTF8) - add_subdirectory(CppUnit) add_subdirectory(Foundation) add_subdirectory(XML) add_subdirectory(Util) add_subdirectory(Net) + if(OPENSSL_FOUND) add_subdirectory(NetSSL_OpenSSL) add_subdirectory(Crypto) endif(OPENSSL_FOUND) + add_subdirectory(Data) add_subdirectory(WebWidgets) add_subdirectory(Zip) @@ -55,3 +67,26 @@ add_subdirectory(Zip) if(APRUTIL_FOUND AND APACHE_FOUND) add_subdirectory(ApacheConnector) endif(APRUTIL_FOUND AND APACHE_FOUND) + +############################################################# +# Uninstall stuff see: http://www.vtk.org/Wiki/CMake_FAQ +CONFIGURE_FILE( + "${CMAKE_CURRENT_SOURCE_DIR}/contrib/cmake/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + +ADD_CUSTOM_TARGET(uninstall + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") + +############################################################# +# Enable packaging + +INCLUDE(InstallRequiredSystemLibraries) + +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Poco Libraries") +SET(CPACK_PACKAGE_VENDOR "Applied Informatics Software Engineering GmbH") +SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") +SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +SET(CPACK_PACKAGE_INSTALL_DIRECTORY "/usr/local") + +INCLUDE(CPack) diff --git a/contrib/cmake/cmake_uninstall.cmake.in b/contrib/cmake/cmake_uninstall.cmake.in new file mode 100644 index 000000000..03137d5af --- /dev/null +++ b/contrib/cmake/cmake_uninstall.cmake.in @@ -0,0 +1,22 @@ +IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") +FOREACH(file ${files}) + MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + IF(EXISTS "$ENV{DESTDIR}${file}") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF("${rm_retval}" STREQUAL 0) + ELSE("${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + ENDIF("${rm_retval}" STREQUAL 0) + ELSE(EXISTS "$ENV{DESTDIR}${file}") + MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + ENDIF(EXISTS "$ENV{DESTDIR}${file}") +ENDFOREACH(file)