diff --git a/CMakeLists.txt b/CMakeLists.txt index b4c75c9..fb10f47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 3.0) -project(UnitTest++ VERSION 2.1.0) +cmake_minimum_required(VERSION 2.8.1) +project(UnitTest++) option(UTPP_USE_PLUS_SIGN "Set this to OFF if you wish to use '-cpp' instead of '++' in lib/include paths" @@ -11,16 +11,8 @@ option(UTPP_AMPLIFY_WARNINGS "Set this to OFF if you wish to use CMake default warning levels; should generally only use to work around support issues for your specific compiler" ON) -set(LIB_SUFFIX "" CACHE STRING "Identifier to add to end of lib directory name e.g. 64 for lib64") - -if (MSVC) - # CHECK_CXX_COMPILER_FLAG could be used - # but MSVC version is preferred for feature requirements - if (MSVC14 OR MSVC12) - # has the support we need - else() - message(STATUS "The MSVC compiler version does not support UnitTest++ C++11 features.") - endif() +if(MSVC14 OR MSVC12) + # has the support we need else() include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14) @@ -30,7 +22,7 @@ else() elseif(COMPILER_SUPPORTS_CXX11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") else() - message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support.") + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") endif() endif() @@ -64,8 +56,6 @@ source_group(${platformDir_} FILES ${platformHeaders_} ${platformSources_}) # create the lib add_library(UnitTest++ STATIC ${headers_} ${sources_} ${platformHeaders_} ${platformSources_}) -add_library(UnitTest++::UnitTest++ ALIAS UnitTest++) - if(${UTPP_USE_PLUS_SIGN}) set_target_properties(UnitTest++ PROPERTIES OUTPUT_NAME UnitTest++) @@ -76,16 +66,13 @@ endif() file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} tests/*.cpp tests/*.h) source_group( "" FILES ${TEST_SRCS}) add_executable(TestUnitTest++ ${TEST_SRCS}) - +include_directories(.) if(${UTPP_USE_PLUS_SIGN}) set_target_properties(TestUnitTest++ PROPERTIES OUTPUT_NAME TestUnitTest++) endif() -target_link_libraries(TestUnitTest++ - PUBLIC - UnitTest++::UnitTest++ - ) +target_link_libraries(TestUnitTest++ UnitTest++) # run unit tests as post build step add_custom_command(TARGET TestUnitTest++ @@ -105,41 +92,19 @@ else() set (UTPP_INSTALL_DESTINATION "include/UnitTestPP") endif() -target_include_directories( UnitTest++ - PUBLIC - $ - $ - ) -set_target_properties(UnitTest++ PROPERTIES DEBUG_POSTFIX "-d") -set_target_properties(TestUnitTest++ PROPERTIES DEBUG_POSTFIX "-d") - -set(config_install_dir_ lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}) +set(config_install_dir_ lib/cmake/${PROJECT_NAME}) set(targets_export_name_ "${PROJECT_NAME}Targets") -include(CMakePackageConfigHelpers) -write_basic_package_version_file( - cmake/UnitTest++ConfigVersion.cmake - VERSION ${UnitTest++_VERSION} - COMPATIBILITY SameMajorVersion - ) -install(TARGETS UnitTest++ EXPORT "${targets_export_name_}" DESTINATION lib${LIB_SUFFIX}) +install(TARGETS UnitTest++ EXPORT "${targets_export_name_}" DESTINATION lib) install(FILES ${headers_} DESTINATION ${UTPP_INSTALL_DESTINATION}) install(FILES ${platformHeaders_} DESTINATION ${UTPP_INSTALL_DESTINATION}/${platformDir_}) -install(FILES - cmake/UnitTest++Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/cmake/UnitTest++ConfigVersion.cmake - DESTINATION "${config_install_dir_}") -install(EXPORT "${targets_export_name_}" NAMESPACE "UnitTest++::" DESTINATION "${config_install_dir_}") +install(FILES cmake/UnitTest++Config.cmake DESTINATION "${config_install_dir_}") +install(EXPORT "${targets_export_name_}" DESTINATION "${config_install_dir_}") set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin) -set(libdir ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}) +set(libdir ${CMAKE_INSTALL_PREFIX}/lib) set(includedir ${CMAKE_INSTALL_PREFIX}/include/UnitTest++) configure_file("UnitTest++.pc.in" "UnitTest++.pc" @ONLY) -if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") - set(pkgconfdir ${CMAKE_INSTALL_PREFIX}/libdata/pkgconfig) -else() - set(pkgconfdir ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig) -endif() install(FILES "${CMAKE_CURRENT_BINARY_DIR}/UnitTest++.pc" - DESTINATION "${pkgconfdir}") + DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig") diff --git a/README.md b/README.md index 6ece10e..7c138a8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,3 @@ -> ### Maintenance of UnitTest++, recently sporadic, is officially on hiatus until 26 November 2020. Subscribe to https://github.com/unittest-cpp/unittest-cpp/issues/180 for updates. - - [![Build Status](https://travis-ci.org/unittest-cpp/unittest-cpp.svg?branch=master)](https://travis-ci.org/unittest-cpp/unittest-cpp) [![Build status](https://ci.appveyor.com/api/projects/status/ffs2k8dddts5cyok/branch/master?svg=true)](https://ci.appveyor.com/project/pjohnmeyer/unittest-cpp/branch/master) diff --git a/UnitTest++/Config.h b/UnitTest++/Config.h index 14429ee..4bebf1a 100644 --- a/UnitTest++/Config.h +++ b/UnitTest++/Config.h @@ -22,7 +22,7 @@ #if defined(unix) || defined(__unix__) || defined(__unix) || defined(linux) || \ defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) \ - || defined (__HAIKU__) || defined(_AIX) + || defined (__HAIKU__) #define UNITTEST_POSIX #endif diff --git a/UnitTest++/TestMacros.h b/UnitTest++/TestMacros.h index 0c8e903..d6bc204 100644 --- a/UnitTest++/TestMacros.h +++ b/UnitTest++/TestMacros.h @@ -25,16 +25,16 @@ } \ namespace Suite ## Name -#define UNITTEST_IMPL_TEST(Name, List) \ +#define UNITTEST_IMPL_TEST(Name, List) \ class Test ## Name : public UnitTest::Test \ { \ public: \ Test ## Name() : Test(#Name, UnitTestSuite::GetSuiteName(), __FILE__, __LINE__) {} \ private: \ virtual void RunImpl() const; \ - } static test ## Name ## Instance; \ + } test ## Name ## Instance; \ \ - static UnitTest::ListAdder adder ## Name (List, &test ## Name ## Instance); \ + UnitTest::ListAdder adder ## Name (List, &test ## Name ## Instance); \ \ void Test ## Name::RunImpl() const @@ -49,12 +49,10 @@ explicit Fixture ## Name ## Helper(UnitTest::TestDetails const& details) : m_details(details) {} \ void RunImpl(); \ UnitTest::TestDetails const& m_details; \ - virtual ~Fixture ## Name ## Helper(); \ private: \ Fixture ## Name ## Helper(Fixture ## Name ## Helper const&); \ Fixture ## Name ## Helper& operator =(Fixture ## Name ## Helper const&); \ }; \ - Fixture ## Name ## Helper::~Fixture ## Name ## Helper(){} \ \ class Test ## Fixture ## Name : public UnitTest::Test \ { \ @@ -62,9 +60,9 @@ Test ## Fixture ## Name() : Test(#Name, UnitTestSuite::GetSuiteName(), __FILE__, __LINE__) {} \ private: \ virtual void RunImpl() const; \ - } static test ## Fixture ## Name ## Instance; \ + } test ## Fixture ## Name ## Instance; \ \ - static UnitTest::ListAdder adder ## Fixture ## Name (List, &test ## Fixture ## Name ## Instance); \ + UnitTest::ListAdder adder ## Fixture ## Name (List, &test ## Fixture ## Name ## Instance); \ \ void Test ## Fixture ## Name::RunImpl() const \ { \ diff --git a/appveyor.yml b/appveyor.yml index 3a4637d..bebe4f5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 2.1.0.{build} +version: 2.0.0.{build} os: - Windows Server 2012 R2 diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 347366d..0000000 --- a/autogen.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -test -e ./.autotools_aux || mkdir .autotools_aux - -libtoolize -cq -aclocal -I m4 --install # Generate aclocal -autoconf # Generate configure script -autoheader # Generate config.h -automake --add-missing --copy # Generate Makefile.in and other scripts diff --git a/configure.ac b/configure.ac index 372f576..56300a6 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ AM_CONDITIONAL([WINDOWS], LT_INIT() -AC_SUBST([LIBUNITTEST_SO_VERSION], [2:1:0]) +AC_SUBST([LIBUNITTEST_SO_VERSION], [2:0:0]) # Checks for programs. AC_PROG_CXX diff --git a/tests/TestTest.cpp b/tests/TestTest.cpp index 0db0650..5a4e1ca 100644 --- a/tests/TestTest.cpp +++ b/tests/TestTest.cpp @@ -72,7 +72,7 @@ namespace { CHECK_EQUAL(1, results.GetFailureCount()); } -#if !defined(UNITTEST_MINGW) && !defined(UNITTEST_WIN32) && !defined(__clang__) +#if !defined(UNITTEST_MINGW) && !defined(UNITTEST_WIN32) // Skip this test in debug because some debuggers don't like it. #if defined(NDEBUG) TEST(CrashingTestsAreReportedAsFailures)