[Libreoffice-commits] cppunit.git: Branch 'feature/cmake' - cmake/CheckCXXSourcefileCompiles.cmake cmake/CheckCXXTypeExists.cmake cmake/CheckCXXTypeExists.cpp.in cmake/have_casts.cpp cmake/have_namespaces.cpp cmake/have_rtti.cpp CMakeLists.txt cmake/PlatformChecks.cmake cmake/string_compare_signature.cpp cmake/Versioning.cmake include/CMakeLists.txt include/config-auto.h.in include/cppunit src/CMakeLists.txt src/cppunit
Bernhard Sessler
bernhard.sessler at corscience.de
Tue Dec 17 04:34:38 PST 2013
CMakeLists.txt | 27 ++++++
cmake/CheckCXXSourcefileCompiles.cmake | 80 ++++++++++++++++++++
cmake/CheckCXXTypeExists.cmake | 32 ++++++++
cmake/CheckCXXTypeExists.cpp.in | 6 +
cmake/PlatformChecks.cmake | 120 ++++++++++++++++++++++++++++++
cmake/Versioning.cmake | 29 +++++++
cmake/have_casts.cpp | 6 +
cmake/have_namespaces.cpp | 13 +++
cmake/have_rtti.cpp | 9 ++
cmake/string_compare_signature.cpp | 11 ++
include/CMakeLists.txt | 5 +
include/config-auto.h.in | 128 +++++++++++++++++++++++++++++++++
include/cppunit/TestAssert.h | 2
src/CMakeLists.txt | 1
src/cppunit/CMakeLists.txt | 86 ++++++++++++++++++++++
15 files changed, 554 insertions(+), 1 deletion(-)
New commits:
commit 5bccf02b2c4fd4fc3366d600f0eadbaa9f1d0b47
Author: Bernhard Sessler <bernhard.sessler at corscience.de>
Date: Fri Nov 29 08:44:04 2013 +0100
Add CMake build system for cppunit library
Change-Id: I2a4b0c1469509a7239b425ca133efd0d979f1d82
Signed-off-by: Bernhard Sessler <bernhard.sessler at corscience.de>
Reviewed-on: https://gerrit.libreoffice.org/7111
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..7b386ce
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,27 @@
+# Project setup
+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..254c1f3
--- /dev/null
+++ b/cmake/CheckCXXSourcefileCompiles.cmake
@@ -0,0 +1,80 @@
+# - 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
+
+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..d9bf7ec
--- /dev/null
+++ b/cmake/CheckCXXTypeExists.cmake
@@ -0,0 +1,32 @@
+# 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)
+
+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..65ab570
--- /dev/null
+++ b/cmake/PlatformChecks.cmake
@@ -0,0 +1,120 @@
+##########################
+# 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..341ffac
--- /dev/null
+++ b/cmake/Versioning.cmake
@@ -0,0 +1,29 @@
+# Set package name and soversion information
+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..b68d090
--- /dev/null
+++ b/cmake/have_casts.cpp
@@ -0,0 +1,6 @@
+// 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..9236594
--- /dev/null
+++ b/cmake/have_namespaces.cpp
@@ -0,0 +1,13 @@
+// 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..4603ff6
--- /dev/null
+++ b/cmake/have_rtti.cpp
@@ -0,0 +1,9 @@
+#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..90564b6
--- /dev/null
+++ b/cmake/string_compare_signature.cpp
@@ -0,0 +1,11 @@
+// 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..142eeda
--- /dev/null
+++ b/include/CMakeLists.txt
@@ -0,0 +1,5 @@
+# Auto-generate the configuration header
+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..1dc9d00
--- /dev/null
+++ b/include/config-auto.h.in
@@ -0,0 +1,128 @@
+#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..4a72b2e
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(cppunit)
diff --git a/src/cppunit/CMakeLists.txt b/src/cppunit/CMakeLists.txt
new file mode 100644
index 0000000..27a1e18
--- /dev/null
+++ b/src/cppunit/CMakeLists.txt
@@ -0,0 +1,86 @@
+# 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)
More information about the Libreoffice-commits
mailing list