Update CMake files after switch from CppUnit to Catch
Don't look for CppUnit library nor build it any longer, but just use the Catch headers under 3rdparty/catch.
This commit is contained in:
parent
d37f758ae9
commit
82b92c6d8f
@ -693,11 +693,8 @@ function(wx_add_test name)
|
||||
list(INSERT test_src 0 "${wxSOURCE_DIR}/tests/dummy.cpp")
|
||||
endif()
|
||||
add_executable(${name} ${test_src})
|
||||
target_include_directories(${name} PRIVATE "${wxSOURCE_DIR}/tests" ${CPPUNIT_INCLUDE_DIR})
|
||||
target_include_directories(${name} PRIVATE "${wxSOURCE_DIR}/tests" "${wxSOURCE_DIR}/3rdparty/catch/include")
|
||||
wx_exe_link_libraries(${name} base net)
|
||||
target_link_libraries(${name}
|
||||
${CPPUNIT_LIBRARIES}
|
||||
)
|
||||
if(wxBUILD_SHARED)
|
||||
target_compile_definitions(${name} PRIVATE WXUSINGDLL)
|
||||
endif()
|
||||
|
@ -1,77 +0,0 @@
|
||||
# - try to find cppunit library
|
||||
#
|
||||
# Cache Variables: (probably not for direct use in your scripts)
|
||||
# CPPUNIT_INCLUDE_DIR
|
||||
# CPPUNIT_LIBRARY
|
||||
#
|
||||
# Non-cache variables you might use in your CMakeLists.txt:
|
||||
# CPPUNIT_FOUND
|
||||
# CPPUNIT_INCLUDE_DIRS
|
||||
# CPPUNIT_LIBRARIES
|
||||
#
|
||||
# Requires these CMake modules:
|
||||
# SelectLibraryConfigurations (included with CMake >= 2.8.0)
|
||||
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2011 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2011.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
set(CPPUNIT_ROOT_DIR
|
||||
"${CPPUNIT_ROOT_DIR}"
|
||||
CACHE
|
||||
PATH
|
||||
"Directory to search")
|
||||
|
||||
find_library(CPPUNIT_LIBRARY_RELEASE
|
||||
NAMES
|
||||
cppunit
|
||||
HINTS
|
||||
"${CPPUNIT_ROOT_DIR}"
|
||||
"${CPPUNIT_ROOT_DIR}/lib")
|
||||
|
||||
find_library(CPPUNIT_LIBRARY_DEBUG
|
||||
NAMES
|
||||
cppunitd
|
||||
HINTS
|
||||
"${CPPUNIT_ROOT_DIR}"
|
||||
"${CPPUNIT_ROOT_DIR}/lib")
|
||||
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(CPPUNIT)
|
||||
|
||||
# Might want to look close to the library first for the includes.
|
||||
get_filename_component(_libdir "${CPPUNIT_LIBRARY_RELEASE}" PATH)
|
||||
|
||||
find_path(CPPUNIT_INCLUDE_DIR
|
||||
NAMES
|
||||
cppunit/TestCase.h
|
||||
HINTS
|
||||
"${_libdir}/.."
|
||||
PATHS
|
||||
"${CPPUNIT_ROOT_DIR}"
|
||||
PATH_SUFFIXES
|
||||
include/)
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(cppunit
|
||||
DEFAULT_MSG
|
||||
CPPUNIT_LIBRARY
|
||||
CPPUNIT_INCLUDE_DIR)
|
||||
|
||||
if(CPPUNIT_FOUND)
|
||||
set(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY} ${CMAKE_DL_LIBS})
|
||||
set(CPPUNIT_INCLUDE_DIRS "${CPPUNIT_INCLUDE_DIR}")
|
||||
mark_as_advanced(CPPUNIT_ROOT_DIR)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CPPUNIT_INCLUDE_DIR
|
||||
CPPUNIT_LIBRARY_RELEASE
|
||||
CPPUNIT_LIBRARY_DEBUG)
|
@ -7,81 +7,6 @@
|
||||
# Licence: wxWindows licence
|
||||
#############################################################################
|
||||
|
||||
# Find CPPUnit
|
||||
wx_add_thirdparty_library(wxUSE_CPPUNIT cppunit
|
||||
"use cppunit (Used for unit tests)" DEFAULT sys)
|
||||
|
||||
if(wxUSE_CPPUNIT STREQUAL "builtin")
|
||||
# Build our own private copy if it could not be found in the system
|
||||
message(STATUS "Could not find cppunit. Downloading and building local copy")
|
||||
set(CPPUNIT_URL http://dev-www.libreoffice.org/src/cppunit-1.13.2.tar.gz)
|
||||
set(CPPUNIT_MD5 d1c6bdd5a76c66d2c38331e2d287bc01)
|
||||
add_library(cppunit STATIC IMPORTED)
|
||||
if(MSVC AND DEFINED CMAKE_VS_MSBUILD_COMMAND)
|
||||
# Build with VS 2010+
|
||||
if(CMAKE_VS_PLATFORM_TOOLSET)
|
||||
set(build_param_toolset /p:PlatformToolset=${CMAKE_VS_PLATFORM_TOOLSET})
|
||||
if(MSVC_VERSION EQUAL 1700)
|
||||
# VS11 requires an additional parameter to build VS10 project files
|
||||
set(build_param_toolset ${build_param_toolset} /p:VisualStudioVersion=11.0)
|
||||
endif()
|
||||
else()
|
||||
# Maybe empty with VS10, but that should be fine
|
||||
# because the vcxproj is VS10
|
||||
set(build_param_toolset)
|
||||
endif()
|
||||
ExternalProject_Add(cppunitlib
|
||||
URL ${CPPUNIT_URL}
|
||||
URL_MD5 ${CPPUNIT_MD5}
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_IN_SOURCE 1
|
||||
BUILD_COMMAND
|
||||
${CMAKE_VS_MSBUILD_COMMAND}
|
||||
src/cppunit/cppunit.vcxproj
|
||||
/p:Configuration=$<CONFIGURATION>
|
||||
/p:Platform=${CMAKE_VS_PLATFORM_NAME}
|
||||
${build_param_toolset}
|
||||
INSTALL_COMMAND
|
||||
${CMAKE_COMMAND} -E copy <SOURCE_DIR>/lib/cppunit$<$<CONFIG:Debug>:d>.lib <INSTALL_DIR>
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/include <INSTALL_DIR>/include
|
||||
)
|
||||
ExternalProject_Get_Property(cppunitlib INSTALL_DIR)
|
||||
set_target_properties(cppunit PROPERTIES
|
||||
IMPORTED_LOCATION "${INSTALL_DIR}/cppunit.lib"
|
||||
IMPORTED_LOCATION_DEBUG "${INSTALL_DIR}/cppunitd.lib"
|
||||
)
|
||||
elseif(UNIX)
|
||||
# TODO: forward CC and CCFLAGS
|
||||
ExternalProject_Add(cppunitlib
|
||||
URL ${CPPUNIT_URL}
|
||||
URL_MD5 ${CPPUNIT_MD5}
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure
|
||||
--prefix=<INSTALL_DIR>
|
||||
--disable-shared
|
||||
--disable-doxygen
|
||||
--disable-html-docs
|
||||
BUILD_COMMAND make
|
||||
INSTALL_COMMAND make install
|
||||
)
|
||||
ExternalProject_Get_Property(cppunitlib INSTALL_DIR)
|
||||
set_target_properties(cppunit PROPERTIES IMPORTED_LOCATION
|
||||
"${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}cppunit${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
else()
|
||||
set(wxUSE_CPPUNIT OFF)
|
||||
endif()
|
||||
|
||||
set(CPPUNIT_INCLUDE_DIR "${INSTALL_DIR}/include")
|
||||
set(CPPUNIT_LIBRARIES cppunit)
|
||||
add_dependencies(cppunit cppunitlib)
|
||||
elseif(wxUSE_CPPUNIT)
|
||||
find_package(cppunit REQUIRED)
|
||||
endif()
|
||||
|
||||
if(NOT wxUSE_CPPUNIT)
|
||||
message(FATAL_ERROR "cppunit is required for tests. Please install cppunit or set wxBUILD_TESTS=OFF")
|
||||
endif()
|
||||
|
||||
add_subdirectory(base)
|
||||
|
||||
# Build GUI tests
|
||||
|
Loading…
Reference in New Issue
Block a user