Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Signed-off-by: Bernhard Sessler <bernhard.sessler@corscience.de>
---
 CMakeLists.txt                         |  45 ++++++++++
 cmake/CheckCXXSourcefileCompiles.cmake |  99 ++++++++++++++++++++++
 cmake/CheckCXXTypeExists.cmake         |  35 ++++++++
 cmake/CheckCXXTypeExists.cpp.in        |   6 ++
 cmake/PlatformChecks.cmake             | 139 +++++++++++++++++++++++++++++++
 cmake/Versioning.cmake                 |  47 +++++++++++
 cmake/have_casts.cpp                   |  25 ++++++
 cmake/have_namespaces.cpp              |  32 +++++++
 cmake/have_rtti.cpp                    |  28 +++++++
 cmake/string_compare_signature.cpp     |  30 +++++++
 include/CMakeLists.txt                 |  23 ++++++
 include/config-auto.h.in               | 147 +++++++++++++++++++++++++++++++++
 include/cppunit/TestAssert.h           |   2 +-
 src/CMakeLists.txt                     |  20 +++++
 src/cppunit/CMakeLists.txt             | 105 +++++++++++++++++++++++
 15 files changed, 782 insertions(+), 1 deletion(-)
 create mode 100644 CMakeLists.txt
 create mode 100644 cmake/CheckCXXSourcefileCompiles.cmake
 create mode 100644 cmake/CheckCXXTypeExists.cmake
 create mode 100644 cmake/CheckCXXTypeExists.cpp.in
 create mode 100644 cmake/PlatformChecks.cmake
 create mode 100644 cmake/Versioning.cmake
 create mode 100644 cmake/have_casts.cpp
 create mode 100644 cmake/have_namespaces.cpp
 create mode 100644 cmake/have_rtti.cpp
 create mode 100644 cmake/string_compare_signature.cpp
 create mode 100644 include/CMakeLists.txt
 create mode 100644 include/config-auto.h.in
 create mode 100644 src/CMakeLists.txt
 create mode 100644 src/cppunit/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..c61228f
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,45 @@
+#=============================================================================
+# CppUnit - The C++ Unit Test Library
+# Copyright (c) 2013 - The Document Foundation
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#=============================================================================
+
+project(cppunit C CXX)
+cmake_minimum_required(VERSION 2.8.7)
+
+# Add project specific CMake module path
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+
+# Perform platform and compiler feature checks
+include(PlatformChecks)
+
+# Versioning
+include(Versioning)
+
+# Build options
+option(BUILD_SHARED_LIBS "Build cppunit as shared or static library" ON)
+
+if(BUILD_SHARED_LIBS)
+    add_definitions(-DCPPUNIT_BUILD_DLL)
+endif()
+
+# Include paths
+include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
+include_directories("${CMAKE_CURRENT_BINARY_DIR}/include")
+
+# Subdirectories
+add_subdirectory(include)
+add_subdirectory(src)
diff --git a/cmake/CheckCXXSourcefileCompiles.cmake b/cmake/CheckCXXSourcefileCompiles.cmake
new file mode 100644
index 0000000..9e7a351
--- /dev/null
+++ b/cmake/CheckCXXSourcefileCompiles.cmake
@@ -0,0 +1,99 @@
+# - Check if given C++ source in the specified file compiles and links into an executable
+# CHECK_CXX_SOURCEFILE_COMPILES(<file> <var> [FAIL_REGEX <fail-regex>])
+#  <file>       - source file to try to compile, must define 'main'
+#  <var>        - variable to store whether the source code compiled
+#  <fail-regex> - fail if test output matches this regex
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+#  CMAKE_REQUIRED_FLAGS = string of compile command line flags
+#  CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+#  CMAKE_REQUIRED_INCLUDES = list of include directories
+#  CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+#
+# Original implementation by:
+#=============================================================================
+# Copyright 2005-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+#
+# This macro overwrites the original macro shipped with the CMake distribution in a way that
+# allows to specify a _file_ containing source code instead of passing the source code directly
+# as argument.
+#
+# Author: Bernhard Sessler <bernhard.sessler@corscience.de>
+# (c) 2013, The Document Foundation
+
+macro(CHECK_CXX_SOURCEFILE_COMPILES SOURCEFILE VAR)
+  if("${VAR}" MATCHES "^${VAR}$")
+    set(_FAIL_REGEX)
+    set(_key)
+    foreach(arg ${ARGN})
+      if("${arg}" MATCHES "^(FAIL_REGEX)$")
+        set(_key "${arg}")
+      elseif(_key)
+        list(APPEND _${_key} "${arg}")
+      else()
+        message(FATAL_ERROR "Unknown argument:\n  ${arg}\n")
+      endif()
+    endforeach()
+
+    if(NOT EXISTS ${SOURCEFILE})
+        message(FATAL_ERROR "Could not find file ${SOURCEFILE}")
+    endif()
+
+    set(MACRO_CHECK_FUNCTION_DEFINITIONS
+      "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
+    if(CMAKE_REQUIRED_LIBRARIES)
+      set(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
+        LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
+    else()
+      set(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES)
+    endif()
+    if(CMAKE_REQUIRED_INCLUDES)
+      set(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES
+        "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+    else()
+      set(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES)
+    endif()
+
+    message(STATUS "Performing Test ${VAR}")
+    try_compile(${VAR}
+      ${CMAKE_CURRENT_BINARY_DIR}
+      ${SOURCEFILE}
+      COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+      ${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}
+      CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+      "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}"
+      OUTPUT_VARIABLE OUTPUT)
+
+    foreach(_regex ${_FAIL_REGEX})
+      if("${OUTPUT}" MATCHES "${_regex}")
+        set(${VAR} 0)
+      endif()
+    endforeach()
+
+    if(${VAR})
+      set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
+      message(STATUS "Performing Test ${VAR} - Success")
+      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+        "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n"
+        "${OUTPUT}\n"
+        "Source file was:\n${SOURCEFILE}\n")
+    else()
+      message(STATUS "Performing Test ${VAR} - Failed")
+      set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
+      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+        "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n"
+        "${OUTPUT}\n"
+        "Source file was:\n${SOURCEFILE}\n")
+    endif()
+  endif()
+endmacro()
+
diff --git a/cmake/CheckCXXTypeExists.cmake b/cmake/CheckCXXTypeExists.cmake
new file mode 100644
index 0000000..1920a80
--- /dev/null
+++ b/cmake/CheckCXXTypeExists.cmake
@@ -0,0 +1,35 @@
+# Checks if a C++ type exists
+# Contrary to CheckTypeSize, complex C++ types can be used here.
+#
+# The parameters have following meaning:
+#  TYPE - the type like "std::tr1::shared_ptr<int>"
+#  HEADER - the header to include, for example "tr1/memory"
+#  VARIABLE - the name of the variable that is set to TRUE on success
+#
+# Example:
+#  check_cxx_type_exists("std::tr1::array<int, 20>" "tr1/array" HAVE_STD_TR1_ARRAY)
+#
+# Author: Bernhard Sessler <bernhard.sessler@corscience.de>
+# (c) 2013, The Document Foundation
+
+macro(CHECK_CXX_TYPE_EXISTS TYPE HEADER VARIABLE)
+    set(CHECK_CXX_TYPE_EXISTS_HEADER ${HEADER})
+    set(CHECK_CXX_TYPE_EXISTS_TYPE ${TYPE})
+
+    if(NOT DEFINED ${VARIABLE})
+        message(STATUS "Looking for ${TYPE}")
+        configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/CheckCXXTypeExists.cpp.in"
+                       "${CMAKE_BINARY_DIR}/cmake/CheckCXXTypeExists_${VARIABLE}.cpp")
+
+        try_compile(${VARIABLE}
+                    "${CMAKE_BINARY_DIR}"
+                    "${CMAKE_BINARY_DIR}/cmake/CheckCXXTypeExists_${VARIABLE}.cpp")
+
+        if(${VARIABLE})
+            message(STATUS "Looking for ${TYPE} - found")
+        else ()
+            message(STATUS "Looking for ${TYPE} - not found")
+        endif()
+        set(${var} "${${var}}" CACHE INTERNAL "CHECK_CXX_TYPE_EXISTS(${TYPE})")
+    endif()
+endmacro()
diff --git a/cmake/CheckCXXTypeExists.cpp.in b/cmake/CheckCXXTypeExists.cpp.in
new file mode 100644
index 0000000..2a97911
--- /dev/null
+++ b/cmake/CheckCXXTypeExists.cpp.in
@@ -0,0 +1,6 @@
+#include <@CHECK_CXX_TYPE_EXISTS_HEADER@>
+
+int main()
+{
+    @CHECK_CXX_TYPE_EXISTS_TYPE@ type;
+}
diff --git a/cmake/PlatformChecks.cmake b/cmake/PlatformChecks.cmake
new file mode 100644
index 0000000..657bf3b
--- /dev/null
+++ b/cmake/PlatformChecks.cmake
@@ -0,0 +1,139 @@
+#=============================================================================
+# CppUnit - The C++ Unit Test Library
+# Copyright (c) 2013 - The Document Foundation
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#=============================================================================
+
+##########################
+# C platform checks
+##########################
+
+# C header Checks
+include(CheckIncludeFile)
+check_include_file(sys/types.h CPPUNIT_HAVE_SYS_TYPES_H)
+check_include_file(sys/stat.h CPPUNIT_HAVE_SYS_STAT_H)
+check_include_file(stdlib.h CPPUNIT_HAVE_STDLIB_H)
+check_include_file(string.h CPPUNIT_HAVE_STRING_H)
+check_include_file(memory.h CPPUNIT_HAVE_MEMORY_H)
+check_include_file(strings.h CPPUNIT_HAVE_STRINGS_H)
+check_include_file(inttypes.h CPPUNIT_HAVE_INTTYPES_H)
+check_include_file(stdint.h CPPUNIT_HAVE_STDINT_H)
+check_include_file(unistd.h CPPUNIT_HAVE_UNISTD_H)
+check_include_file(dlfcn.h CPPUNIT_HAVE_DLFCN_H)
+check_include_file(math.h CPPUNIT_HAVE_MATH_H)
+check_include_file(ieeefp.h CPPUNIT_HAVE_IEEEFP_H)
+
+# C library checks
+include(CheckLibraryExists)
+check_library_exists(dl dlopen dlfcn.h CPPUNIT_HAVE_LIBDL)
+check_library_exists(dl dlerror dlfcn.h CPPUNIT_HAVE_DLERROR)
+if(CPPUNIT_HAVE_LIBDL)
+    list(APPEND CPPUNIT_COMMON_LIBS "dl")
+endif()
+
+if(NOT CPPUNIT_HAVE_LIBDL)
+    check_library_exists(svld dlopen dlfcn.h CPPUNIT_HAVE_LIBDL)
+    check_library_exists(svld dlerror dlfcn.h CPPUNIT_HAVE_DLERROR)
+    if(CPPUNIT_HAVE_LIBDL)
+        list(APPEND CPPUNIT_COMMON_LIBS "svld")
+    endif()
+endif()
+
+check_library_exists(dld dld_link dld.h CPPUNIT_HAVE_DLD)
+check_library_exists(dld shl_load dld.h CPPUNIT_HAVE_UNIX_SHL_LOADER)
+if(CPPUNIT_HAVE_UNIX_SHL_LOADER)
+    list(APPEND CPPUNIT_COMMON_LIBS "dld")
+endif()
+
+# C function checks
+include(CheckFunctionExists)
+check_function_exists(finite CPPUNIT_HAVE_FINITE)
+check_function_exists(_finite CPPUNIT_HAVE__FINITE)
+
+# C symbol checks
+include(CheckSymbolExists)
+if(CPPUNIT_HAVE_MATH_H)
+    set(_header math.h)
+elseif(CPPUNIT_HAVE_IEEEFP_H)
+    set(_header ieeefp.h)
+else()
+    set(_unsupported_compiler 1)
+endif()
+
+if(CPPUNIT_HAVE_MATH_H OR CPPUNIT_HAVE_IEEEFP_H)
+    check_symbol_exists(isfinite ${_header} CPPUNIT_HAVE_ISFINITE)
+endif()
+
+# MinGW depends on the MS Visual C Runtime.
+# Unfortunately on Windows XP the default runtime does not support the Microsoft secure API.
+# That's why it's explicitly disabled for all Windows versions < 6.0 (Vista) here.
+if(MINGW AND ${CMAKE_SYSTEM_VERSION} VERSION_LESS "6.0")
+    set(CPPUNIT_HAVE_SPRINTF_S FALSE CACHE INTERNAL "MinGW on Windows < 6.0 does not support this")
+        message(STATUS "Building for ${CMAKE_SYSTEM} with MinGW - disabling Secure API")
+else()
+        check_symbol_exists(sprintf_s "stdio.h" CPPUNIT_HAVE_SPRINTF_S)
+endif()
+
+##########################
+# C++ platform checks
+##########################
+
+# C++ header checks
+include(CheckIncludeFileCXX)
+check_include_file_cxx(strstream CPPUNIT_HAVE_STRSTREAM)
+check_include_file_cxx(cmath CPPUNIT_HAVE_CMATH)
+check_include_file_cxx(memory.h CPPUNIT_HAVE_MEMORY_H)
+check_include_file_cxx(cxxabi.h CPPUNIT_HAVE_CXXABI_H)
+check_include_file_cxx(typeinfo CPPUNIT_HAVE_TYPEINFO)
+
+# C++ symbol checks
+include(CheckCXXSymbolExists)
+if(CPPUNIT_HAVE_CXXABI_H)
+    check_cxx_symbol_exists(abi::__cxa_demangle cxxabi.h CPPUNIT_HAVE_GCC_ABI_DEMANGLE)
+endif()
+
+# C++ type checks
+include(CheckCXXTypeExists)
+check_cxx_type_exists(std::stringstream sstream CPPUNIT_HAVE_SSTREAM)
+if(CPPUNIT_HAVE_STRSTREAM)
+    set(_header strstream)
+else()
+    set(_header strstream.h)
+endif()
+check_cxx_type_exists(std::ostrstream ${_header} CPPUNIT_HAVE_CLASS_STRSTREAM)
+
+# C++ feature checks
+include(CheckCXXSourcefileCompiles)
+check_cxx_sourcefile_compiles(${PROJECT_SOURCE_DIR}/cmake/have_namespaces.cpp
+                              CPPUNIT_HAVE_NAMESPACES)
+check_cxx_sourcefile_compiles(${PROJECT_SOURCE_DIR}/cmake/have_casts.cpp
+                              CPPUNIT_HAVE_CPP_CAST)
+check_cxx_sourcefile_compiles(${PROJECT_SOURCE_DIR}/cmake/string_compare_signature.cpp
+                              CPPUNIT_FUNC_STRING_COMPARE_SIZE_FIRST)
+
+if(NOT CPPUNIT_FUNC_STRING_COMPARE_SIZE_FIRST)
+    set(CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST 1
+        CACHE INTERNAL "define if library uses std::string::compare(string,pos,n)")
+endif()
+
+if(CPPUNIT_HAVE_TYPEINFO)
+    check_cxx_sourcefile_compiles(${PROJECT_SOURCE_DIR}/cmake/have_rtti.cpp
+                                  CPPUNIT_HAVE_RTTI)
+endif()
+
+if(_unsupported_compiler)
+    message(FATAL_ERROR "Your compiler does not support all features required to build cppunit!")
+endif()
diff --git a/cmake/Versioning.cmake b/cmake/Versioning.cmake
new file mode 100644
index 0000000..8cc9dee
--- /dev/null
+++ b/cmake/Versioning.cmake
@@ -0,0 +1,47 @@
+#=============================================================================
+# CppUnit - The C++ Unit Test Library
+# Copyright (c) 2013 - The Document Foundation
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#=============================================================================
+
+set(CPPUNIT_PACKAGE "cppunit" CACHE INTERNAL "The library package name")
+set(CPPUNIT_SOVERSION_MAJOR 1)
+set(CPPUNIT_SOVERSION_MINOR 0)
+set(CPPUNIT_SOVERSION_PATCH 0)
+
+if(EXISTS "${PROJECT_SOURCE_DIR}/.version")
+    file(READ "${PROJECT_SOURCE_DIR}/.version" _version)
+    string(STRIP ${_version} _version)
+endif()
+
+if(NOT _version)
+    find_package(Git)
+    if(GIT_FOUND)
+        execute_process(
+            COMMAND             ${GIT_EXECUTABLE} describe
+            WORKING_DIRECTORY   ${PROJECT_SOURCE_DIR}
+            OUTPUT_VARIABLE     _version
+            OUTPUT_STRIP_TRAILING_WHITESPACE
+            RESULT_VARIABLE     CPPUNIT_VERSION_RESULT)
+    endif()
+endif()
+
+if(NOT _version)
+    set(_version "unknown")
+endif()
+
+set(CPPUNIT_VERSION "${_version}" CACHE INTERNAL "The cppunit library version")
+message(STATUS "Building cppunit version: ${CPPUNIT_VERSION}")
diff --git a/cmake/have_casts.cpp b/cmake/have_casts.cpp
new file mode 100644
index 0000000..de35b46
--- /dev/null
+++ b/cmake/have_casts.cpp
@@ -0,0 +1,25 @@
+//=============================================================================
+// CppUnit - The C++ Unit Test Library
+// Copyright (c) 2013 - The Document Foundation
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//=============================================================================
+
+// Check whether the compiler supports C++ style casts
+int main()
+{
+    char c = 0;
+    return static_cast<int>(c);
+}
diff --git a/cmake/have_namespaces.cpp b/cmake/have_namespaces.cpp
new file mode 100644
index 0000000..0183235
--- /dev/null
+++ b/cmake/have_namespaces.cpp
@@ -0,0 +1,32 @@
+//=============================================================================
+// CppUnit - The C++ Unit Test Library
+// Copyright (c) 2013 - The Document Foundation
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//=============================================================================
+
+// Check whether the compiler supports namespaces
+namespace o {
+namespace i {
+int r = 0;
+}
+}
+
+using namespace o::i;
+
+int main()
+{
+    return r;
+}
diff --git a/cmake/have_rtti.cpp b/cmake/have_rtti.cpp
new file mode 100644
index 0000000..b0b9774
--- /dev/null
+++ b/cmake/have_rtti.cpp
@@ -0,0 +1,28 @@
+//=============================================================================
+// CppUnit - The C++ Unit Test Library
+// Copyright (c) 2013 - The Document Foundation
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//=============================================================================
+
+#include <typeinfo>
+
+// Check whether the compiler supports run-time type information (RTTI)
+int main()
+{
+    int t = 0;
+    const char* id = typeid(t).name();
+    return t;
+}
diff --git a/cmake/string_compare_signature.cpp b/cmake/string_compare_signature.cpp
new file mode 100644
index 0000000..66ba5d4
--- /dev/null
+++ b/cmake/string_compare_signature.cpp
@@ -0,0 +1,30 @@
+//=============================================================================
+// CppUnit - The C++ Unit Test Library
+// Copyright (c) 2013 - The Document Foundation
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//=============================================================================
+
+// Check whether the std::string::compare method takes a size_t as first argument
+#include <string>
+
+int main()
+{
+    std::string s1("Test");
+    std::string s2("test");
+    int res = s2.compare(0, std::string::npos, s1);
+
+    return 0;
+}
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
new file mode 100644
index 0000000..b129580
--- /dev/null
+++ b/include/CMakeLists.txt
@@ -0,0 +1,23 @@
+#=============================================================================
+# CppUnit - The C++ Unit Test Library
+# Copyright (c) 2013 - The Document Foundation
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#=============================================================================
+
+configure_file(config-auto.h.in "${CMAKE_CURRENT_BINARY_DIR}/cppunit/config-auto.h")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cppunit/config-auto.h" DESTINATION include/cppunit)
+
+install(DIRECTORY cppunit DESTINATION include FILES_MATCHING PATTERN "*.h")
diff --git a/include/config-auto.h.in b/include/config-auto.h.in
new file mode 100644
index 0000000..309e291
--- /dev/null
+++ b/include/config-auto.h.in
@@ -0,0 +1,147 @@
+//=============================================================================
+// CppUnit - The C++ Unit Test Library
+// Copyright (c) 2013 - The Document Foundation
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+//=============================================================================
+
+#ifndef _INCLUDE_CPPUNIT_CONFIG_AUTO_H
+#define _INCLUDE_CPPUNIT_CONFIG_AUTO_H
+
+/* include/cppunit/config-auto.h. Generated automatically at end of configure. */
+
+/* define if library uses std::string::compare(string,pos,n) */
+#cmakedefine CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST 1
+
+/* define if the library defines strstream */
+#cmakedefine CPPUNIT_HAVE_CLASS_STRSTREAM 1
+
+/* Define if you have the <cmath> header file. */
+#cmakedefine CPPUNIT_HAVE_CMATH 1
+
+/* Define if you have the GNU dld library. */
+#cmakedefine CPPUNIT_HAVE_DLD 1
+
+/* Define if you have the `dlerror' function. */
+#cmakedefine CPPUNIT_HAVE_DLERROR 1
+
+/* Define if you have the <dlfcn.h> header file. */
+#cmakedefine CPPUNIT_HAVE_DLFCN_H 1
+
+/* Define if you have the `finite' function. */
+#cmakedefine CPPUNIT_HAVE_FINITE 1
+
+/* define if the compiler supports GCC C++ ABI name demangling */
+#cmakedefine CPPUNIT_HAVE_GCC_ABI_DEMANGLE 1
+
+/* Define if you have the <ieeefp.h> header file. */
+#cmakedefine CPPUNIT_HAVE_IEEEFP_H 1
+
+/* Define if you have the <inttypes.h> header file. */
+#cmakedefine CPPUNIT_HAVE_INTTYPES_H 1
+
+/* define if compiler has isfinite */
+#cmakedefine CPPUNIT_HAVE_ISFINITE 1
+
+/* Define if you have the secure sprintf_s function */
+#cmakedefine CPPUNIT_HAVE_SPRINTF_S 1
+
+/* Define if you have the libdl library or equivalent. */
+#cmakedefine CPPUNIT_HAVE_LIBDL 1
+
+/* Define if you have the <memory.h> header file. */
+#cmakedefine CPPUNIT_HAVE_MEMORY_H 1
+
+/* Define if the compiler implements namespaces */
+#cmakedefine CPPUNIT_HAVE_NAMESPACES 1
+
+/* define if the compiler supports Run-Time Type Identification */
+#cmakedefine CPPUNIT_HAVE_RTTI 1
+
+/* define if the compiler supports C++ style casts */
+#cmakedefine CPPUNIT_HAVE_CPP_CAST 1
+
+/* Define if you have the shl_load function. */
+#cmakedefine CPPUNIT_HAVE_SHL_LOAD 1
+
+/* define if the compiler has stringstream */
+#cmakedefine CPPUNIT_HAVE_SSTREAM 1
+
+/* Define if you have the <stdint.h> header file. */
+#cmakedefine CPPUNIT_HAVE_STDINT_H 1
+
+/* Define if you have the <stdlib.h> header file. */
+#cmakedefine CPPUNIT_HAVE_STDLIB_H 1
+
+/* Define if you have the <strings.h> header file. */
+#cmakedefine CPPUNIT_HAVE_STRINGS_H 1
+
+/* Define if you have the <string.h> header file. */
+#cmakedefine CPPUNIT_HAVE_STRING_H 1
+
+/* Define if you have the <strstream> header file. */
+#cmakedefine CPPUNIT_HAVE_STRSTREAM 1
+
+/* Define if you have the <sys/stat.h> header file. */
+#cmakedefine CPPUNIT_HAVE_SYS_STAT_H 1
+
+/* Define if you have the <sys/types.h> header file. */
+#cmakedefine CPPUNIT_HAVE_SYS_TYPES_H 1
+
+/* Define if you have the <unistd.h> header file. */
+#cmakedefine CPPUNIT_HAVE_UNISTD_H 1
+
+/* Name of package */
+#cmakedefine CPPUNIT_PACKAGE "@CPPUNIT_PACKAGE@"
+
+/* Version number of package */
+#cmakedefine CPPUNIT_VERSION "@CPPUNIT_VERSION@"
+
+/* Define to the address where bug reports for this package should be sent. */
+#ifndef CPPUNIT_PACKAGE_BUGREPORT
+#define CPPUNIT_PACKAGE_BUGREPORT ""
+#endif
+
+/* Define to the full name of this package. */
+#ifndef CPPUNIT_PACKAGE_NAME
+#define CPPUNIT_PACKAGE_NAME ""
+#endif
+
+/* Define to the full name and version of this package. */
+#ifndef CPPUNIT_PACKAGE_STRING
+#define CPPUNIT_PACKAGE_STRING ""
+#endif
+
+/* Define to the one symbol short name of this package. */
+#ifndef CPPUNIT_PACKAGE_TARNAME
+#define CPPUNIT_PACKAGE_TARNAME ""
+#endif
+
+/* Define to the home page for this package. */
+#ifndef CPPUNIT_PACKAGE_URL
+#define CPPUNIT_PACKAGE_URL ""
+#endif
+
+/* Define to the version of this package. */
+#ifndef CPPUNIT_PACKAGE_VERSION
+#define CPPUNIT_PACKAGE_VERSION  ""
+#endif
+
+/* Define to use type_info::name() for class names */
+#ifndef CPPUNIT_USE_TYPEINFO_NAME
+#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI
+#endif
+
+#endif /* _INCLUDE_CPPUNIT_CONFIG_AUTO_H */
diff --git a/include/cppunit/TestAssert.h b/include/cppunit/TestAssert.h
index 851a444..0b39f2a 100644
--- a/include/cppunit/TestAssert.h
+++ b/include/cppunit/TestAssert.h
@@ -91,7 +91,7 @@ struct assertion_traits<double>
        const int precision = 15;
 #endif  // #ifdef DBL_DIG
        char buffer[128];
-#ifdef __STDC_SECURE_LIB__ // Use secure version with visual studio 2005 to avoid warning.
+#ifdef CPPUNIT_HAVE_SPRINTF_S // Use secure version with visual studio 2005 to avoid warning.
        sprintf_s(buffer, sizeof(buffer), "%.*g", precision, x); 
 #else  
        sprintf(buffer, "%.*g", precision, x); 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..6ac95fd
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,20 @@
+#=============================================================================
+# CppUnit - The C++ Unit Test Library
+# Copyright (c) 2013 - The Document Foundation
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#=============================================================================
+
+add_subdirectory(cppunit)
diff --git a/src/cppunit/CMakeLists.txt b/src/cppunit/CMakeLists.txt
new file mode 100644
index 0000000..1f0b058
--- /dev/null
+++ b/src/cppunit/CMakeLists.txt
@@ -0,0 +1,105 @@
+#=============================================================================
+# CppUnit - The C++ Unit Test Library
+# Copyright (c) 2013 - The Document Foundation
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#=============================================================================
+
+# Common source files
+set(cppunit_SOURCES
+    AdditionalMessage.cpp
+    Asserter.cpp
+    BriefTestProgressListener.cpp
+    CompilerOutputter.cpp
+    DefaultProtector.cpp
+    DynamicLibraryManager.cpp
+    DynamicLibraryManagerException.cpp
+    Exception.cpp
+    Message.cpp
+    PlugInManager.cpp
+    PlugInParameters.cpp
+    ProtectorChain.cpp
+    Protector.cpp
+    RepeatedTest.cpp
+    SourceLine.cpp
+    StringTools.cpp
+    SynchronizedObject.cpp
+    TestAssert.cpp
+    TestCase.cpp
+    TestCaseDecorator.cpp
+    TestComposite.cpp
+    Test.cpp
+    TestDecorator.cpp
+    TestFactoryRegistry.cpp
+    TestFailure.cpp
+    TestLeaf.cpp
+    TestNamer.cpp
+    TestPath.cpp
+    TestPlugInDefaultImpl.cpp
+    TestResultCollector.cpp
+    TestResult.cpp
+    TestRunner.cpp
+    TestSetUp.cpp
+    TestSuccessListener.cpp
+    TestSuiteBuilderContext.cpp
+    TestSuite.cpp
+    TextOutputter.cpp
+    TextTestProgressListener.cpp
+    TextTestResult.cpp
+    TextTestRunner.cpp
+    TypeInfoHelper.cpp
+    XmlDocument.cpp
+    XmlElement.cpp
+    XmlOutputter.cpp
+    XmlOutputterHook.cpp)
+
+# Platform specific source files
+# Microsoft Windows
+if(WIN32)
+    set(cppunit_SOURCES ${cppunit_SOURCES}
+        DllMain.cpp
+        Win32DynamicLibraryManager.cpp)
+# Unix based systems
+elseif(UNIX)
+    set(cppunit_SOURCES ${cppunit_SOURCES}
+        UnixDynamicLibraryManager.cpp)
+    if(CPPUNIT_HAVE_UNIX_SHL_LOADER)
+        set(cppunit_SOURCES ${cppunit_SOURCES}
+            ShlDynamicLibraryManager.cpp)
+    endif()
+# BeOS
+elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*")
+    set(cppunit_SOURCES ${cppunit_SOURCES}
+        BeOsDynamicLibraryManager.cpp)
+endif()
+
+# Create the library
+add_library(cppunit ${cppunit_SOURCES})
+target_link_libraries(cppunit ${CPPUNIT_COMMON_LIBS})
+
+set_target_properties(cppunit PROPERTIES
+    VERSION ${CPPUNIT_SOVERSION_MAJOR}.${CPPUNIT_SOVERSION_MINOR}.${CPPUNIT_SOVERSION_PATCH}
+    SOVERSION ${CPPUNIT_SOVERSION_MAJOR})
+
+# Append a debug postfix to the library filename on Windows
+if(WIN32)
+    set_target_properties(cppunit PROPERTIES DEBUG_POSTFIX "d")
+endif()
+
+# Create install target
+install(TARGETS cppunit
+    LIBRARY DESTINATION lib
+    ARCHIVE DESTINATION lib
+    RUNTIME DESTINATION bin)
-- 
1.8.3.2


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.