mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 19:59:06 +08:00
[cunit] Fix Linux library name and export CMake (#26047)
* [cunit] Fix Linux library name and export CMake * format vcpkg.json * x-add-version * [cunit] Define VERSION/RELEASE Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
This commit is contained in:
parent
768379e8d9
commit
c9ab969f8e
@ -1,9 +1,8 @@
|
||||
cmake_minimum_required (VERSION 3.8.0)
|
||||
project (libcunit C)
|
||||
project (cunit C)
|
||||
|
||||
set(HEADERS_DIR "${PROJECT_SOURCE_DIR}/CUnit/Headers")
|
||||
set(SOURCES_DIR "${PROJECT_SOURCE_DIR}/CUnit/Sources")
|
||||
set(EXAMPLES_DIR "${PROJECT_SOURCE_DIR}/Examples")
|
||||
|
||||
if(MSVC)
|
||||
add_compile_options(/W3 /wd4005 /wd4996 -D_CRT_SECURE_NO_WARNINGS)
|
||||
@ -12,6 +11,7 @@ endif()
|
||||
configure_file(
|
||||
"${HEADERS_DIR}/CUnit.h.in"
|
||||
"${PROJECT_BINARY_DIR}/CUnit.h"
|
||||
@ONLY
|
||||
)
|
||||
|
||||
file(READ "${PROJECT_BINARY_DIR}/CUnit.h" CUNIT_H)
|
||||
@ -25,7 +25,7 @@ file(WRITE "${PROJECT_BINARY_DIR}/CUnit.h" "${CUNIT_H}")
|
||||
include_directories("${PROJECT_BINARY_DIR}")
|
||||
include_directories(${HEADERS_DIR})
|
||||
|
||||
add_library(libcunit
|
||||
add_library(cunit
|
||||
"${SOURCES_DIR}/Automated/Automated.c"
|
||||
"${SOURCES_DIR}/Basic/Basic.c"
|
||||
"${SOURCES_DIR}/Console/Console.c"
|
||||
@ -35,27 +35,18 @@ add_library(libcunit
|
||||
"${SOURCES_DIR}/Framework/TestRun.c"
|
||||
"${SOURCES_DIR}/Framework/Util.c"
|
||||
)
|
||||
target_compile_definitions(libcunit PRIVATE -DCU_BUILD_DLL)
|
||||
target_compile_definitions(cunit PRIVATE -DCU_BUILD_DLL)
|
||||
target_include_directories(cunit INTERFACE $<INSTALL_INTERFACE:include>)
|
||||
|
||||
if(BUILD_EXAMPLES)
|
||||
include_directories(${EXAMPLES_DIR})
|
||||
add_executable(AutomatedTest ${EXAMPLES_DIR}/AutomatedTest/AutomatedTest.c "${EXAMPLES_DIR}/ExampleTests.c")
|
||||
add_executable(BasicTest ${EXAMPLES_DIR}/BasicTest/BasicTest.c "${EXAMPLES_DIR}/ExampleTests.c")
|
||||
add_executable(ConsoleTest ${EXAMPLES_DIR}/ConsoleTest/ConsoleTest.c "${EXAMPLES_DIR}/ExampleTests.c")
|
||||
install(TARGETS cunit EXPORT unofficial-cunit-config)
|
||||
|
||||
target_link_libraries(AutomatedTest libcunit)
|
||||
target_link_libraries(BasicTest libcunit)
|
||||
target_link_libraries(ConsoleTest libcunit)
|
||||
endif()
|
||||
|
||||
install(
|
||||
TARGETS libcunit
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
install(EXPORT unofficial-cunit-config
|
||||
NAMESPACE unofficial::cunit::
|
||||
DESTINATION share/unofficial-cunit
|
||||
FILE unofficial-cunit-config.cmake
|
||||
)
|
||||
|
||||
if(NOT DISABLE_INSTALL_HEADERS)
|
||||
install(DIRECTORY "${HEADERS_DIR}/" DESTINATION include/cunit FILES_MATCHING PATTERN "*.h")
|
||||
install(FILES "${PROJECT_BINARY_DIR}/CUnit.h" DESTINATION include/cunit)
|
||||
install(DIRECTORY "${HEADERS_DIR}/" DESTINATION include/CUnit FILES_MATCHING PATTERN "*.h")
|
||||
install(FILES "${PROJECT_BINARY_DIR}/CUnit.h" DESTINATION include/CUnit)
|
||||
endif()
|
||||
|
@ -1,21 +1,27 @@
|
||||
set(VERSION 2.1)
|
||||
set(RELEASE 3)
|
||||
|
||||
vcpkg_from_sourceforge(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO cunit/CUnit
|
||||
REF 2.1-3
|
||||
FILENAME "CUnit-2.1-3.tar.bz2"
|
||||
REF "${VERSION}-${RELEASE}"
|
||||
FILENAME "CUnit-${VERSION}-${RELEASE}.tar.bz2"
|
||||
SHA512 547b417109332446dfab8fda17bf4ccd2da841dc93f824dc90a20635bcf1fb80fb2176500d8a0906940f3f3d3e2f77b2d70a71090c9ab84ad9af43f3582bc487
|
||||
)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
"-DVERSION=${VERSION}"
|
||||
"-DRELEASE=${RELEASE}"
|
||||
OPTIONS_DEBUG
|
||||
-DDISABLE_INSTALL_HEADERS=ON
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-cunit)
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
|
@ -1,7 +1,18 @@
|
||||
{
|
||||
"name": "cunit",
|
||||
"version-string": "2.1.3",
|
||||
"port-version": 7,
|
||||
"version": "2.1.3",
|
||||
"port-version": 8,
|
||||
"description": "CUnit is a lightweight system for writing, administering, and running unit tests in C. It provides C programmers a basic testing functionality with a flexible variety of user interfaces",
|
||||
"homepage": "https://sourceforge.net/projects/cunit/"
|
||||
"homepage": "https://sourceforge.net/projects/cunit/",
|
||||
"license": "LGPL-2.0-only",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1766,7 +1766,7 @@
|
||||
},
|
||||
"cunit": {
|
||||
"baseline": "2.1.3",
|
||||
"port-version": 7
|
||||
"port-version": 8
|
||||
},
|
||||
"curl": {
|
||||
"baseline": "7.84.0",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "7c467d95806ab2016c73520e249b5d82645fda3c",
|
||||
"version": "2.1.3",
|
||||
"port-version": 8
|
||||
},
|
||||
{
|
||||
"git-tree": "b108b8daeb1695db997a7ebc1b341e27d4d84ce7",
|
||||
"version-string": "2.1.3",
|
||||
|
Loading…
Reference in New Issue
Block a user