[cmocka] Update to 2020-08-01 (#12828)

This commit is contained in:
myd7349 2020-08-20 12:20:03 +08:00 committed by GitHub
parent a51f392b52
commit fb8b20f460
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 12 additions and 101 deletions

View File

@ -1,4 +0,0 @@
Source: cmocka
Version: 1.1.5
Port-Version: 3
Description: An elegant unit testing framework for C with support for mock objects

View File

@ -1,13 +0,0 @@
diff --git a/src/cmocka.c b/src/cmocka.c
index 6bfc831..4c1c04b 100644
--- a/src/cmocka.c
+++ b/src/cmocka.c
@@ -3356,7 +3356,7 @@ int _run_tests(const UnitTest * const tests, const size_t number_of_tests) {
int _run_group_tests(const UnitTest * const tests, const size_t number_of_tests)
{
UnitTestFunction setup = NULL;
- const char *setup_name;
+ const char *setup_name = NULL;
size_t num_setups = 0;
UnitTestFunction teardown = NULL;
const char *teardown_name = NULL;

View File

@ -1,28 +1,20 @@
include(vcpkg_common_functions)
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.com
OUT_SOURCE_PATH SOURCE_PATH
REPO cmocka/cmocka
REF cmocka-1.1.5
SHA512 4e305e500f448676be5503972c49089c51f38b47d8129add2205608ed73f9de8b911aee83c00da4ef52c0179a5b5ba0e3386f3bca839f18e7ab21787184d9990
REF 672c5cee79eb412025c3dd8b034e611c1f119055
SHA512 e02ffe780698ce3930aceb1b927f7d48c932c6bb251a32b1f4ab44ecb4ff6bfe5c2a6b9e2dfede49cd4cc1d68a8bb903ef1d26c28536abf3581a9d803287aa0a
HEAD_REF master
PATCHES
shared-lib.patch
static-lib.patch
fix-uwp.patch
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIB)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DWITH_CMOCKERY_SUPPORT=ON
-DUNIT_TESTING=OFF
-DWITH_EXAMPLES=OFF
-DBUILD_STATIC_LIB=${BUILD_STATIC_LIB}
-DWITH_STATIC_LIB=${BUILD_STATIC_LIB}
-DPICKY_DEVELOPER=OFF
)
vcpkg_install_cmake()
@ -31,18 +23,6 @@ vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT})
file(COPY
${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake
DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}
)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
configure_file(${SOURCE_PATH}/COPYING ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
# Install usage
configure_file(${CMAKE_CURRENT_LIST_DIR}/usage ${CURRENT_PACKAGES_DIR}/share/${PORT}/usage @ONLY)
# CMake integration test
#vcpkg_test_cmake(PACKAGE_NAME ${PORT})
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

View File

@ -1,22 +0,0 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5684685..8555169 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -30,7 +30,7 @@ if (WIN32)
cmocka.def
)
endif (WIN32)
-
+if (BUILD_SHARED_LIBS)
add_library(${CMOCKA_SHARED_LIBRARY} SHARED ${cmocka_SRCS})
target_include_directories(${CMOCKA_SHARED_LIBRARY}
@@ -82,7 +82,7 @@ install(TARGETS
${CMAKE_INSTALL_BINDIR}
COMPONENT
${PROJECT_NAME})
-
+endif (BUILD_SHARED_LIBS)
if (BUILD_STATIC_LIB)
add_library(${CMOCKA_STATIC_LIBRARY} STATIC ${cmocka_SRCS})

View File

@ -1,22 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00e568e..6e3489a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -77,9 +77,17 @@ install(
# cmake config files
if (WIN32)
+ if (BUILD_SHARED_LIBS)
set(CMOCKA_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX})
+ else()
+ set(CMOCKA_LIBRARY_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}${CMOCKA_STATIC_LIBRARY}${CMAKE_IMPORT_LIBRARY_SUFFIX})
+ endif()
else()
+ if (BUILD_SHARED_LIBS)
set(CMOCKA_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
+ else()
+ set(CMOCKA_LIBRARY_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}${CMOCKA_STATIC_LIBRARY}${CMAKE_STATIC_LIBRARY_SUFFIX})
+ endif()
endif()
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE INTERNAL "")

View File

@ -1,5 +0,0 @@
The package @PORT@:@TARGET_TRIPLET@ provides CMake targets:
find_package(@PORT@ CONFIG REQUIRED)
target_include_directories(main PRIVATE ${CMOCKA_INCLUDE_DIR})
target_link_libraries(main PRIVATE ${CMOCKA_LIBRARIES})

View File

@ -1,10 +0,0 @@
_find_package(${ARGS})
get_filename_component(_cmocka_lib_name ${CMOCKA_LIBRARY} NAME)
set(CMOCKA_LIBRARY
debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/${_cmocka_lib_name}
optimized ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/${_cmocka_lib_name}
)
set(CMOCKA_LIBRARIES ${CMOCKA_LIBRARY})

7
ports/cmocka/vcpkg.json Normal file
View File

@ -0,0 +1,7 @@
{
"name": "cmocka",
"version-string": "2020-08-01",
"description": "An elegant unit testing framework for C with support for mock objects",
"homepage": "https://cmocka.org/",
"license": "Apache-2.0"
}