mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-24 09:25:01 +00:00
Add support for USES=cmake:testing
CMake-based ports have a "standard" way of controlling whether testing should be built, by passing -DBUILD_TESTING=ON at the configure stage (with some footnotes). Add a :testing modifier for USES=cmake that enables a boilerplate do-test target that rebuilds with testing enabled, and then runs the tests. Individual ports need to buy in to this explicitly (because tests might not be non-destructive). Submitted and explained well by yuri@ PR: 249024 Submitted by: yuri
This commit is contained in:
parent
a097a9d779
commit
d8d8554725
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=569551
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Feature: cmake
|
||||
# Usage: USES=cmake or USES=cmake:ARGS
|
||||
# Valid ARGS: insource, run, noninja
|
||||
# Valid ARGS: insource, run, noninja, testing
|
||||
# ARGS description:
|
||||
# insource do not perform an out-of-source build
|
||||
# noninja don't use ninja instead of make
|
||||
@ -16,6 +16,9 @@
|
||||
# 2) ports that set BUILD_- or INSTALL_WRKSRC to
|
||||
# something different than CONFIGURE_WRKSRC
|
||||
# run add a runtime dependency on cmake
|
||||
# testing add the test target based on ctest
|
||||
# Additionally, CMAKE_TESTING_ON, CMAKE_TESTING_OFF, CMAKE_TESTING_ARGS, CMAKE_TESTING_TARGET
|
||||
# can be defined to override the default values.
|
||||
#
|
||||
#
|
||||
# Additional variables that affect cmake behaviour:
|
||||
@ -46,7 +49,7 @@
|
||||
.if !defined(_INCLUDE_USES_CMAKE_MK)
|
||||
_INCLUDE_USES_CMAKE_MK= yes
|
||||
|
||||
_valid_ARGS= insource run noninja
|
||||
_valid_ARGS= insource run noninja testing
|
||||
|
||||
# Sanity check
|
||||
.for arg in ${cmake_ARGS}
|
||||
@ -140,4 +143,22 @@ do-configure:
|
||||
@cd ${CONFIGURE_WRKSRC}; ${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} ${CMAKE_SOURCE_PATH}
|
||||
.endif
|
||||
|
||||
.if !target(do-test) && ${cmake_ARGS:Mtesting}
|
||||
CMAKE_TESTING_ON?= BUILD_TESTING
|
||||
CMAKE_TESTING_TARGET?= test
|
||||
|
||||
# Handle the option-like CMAKE_TESTING_ON and CMAKE_TESTING_OFF lists.
|
||||
.for _bool_kind in ON OFF
|
||||
. if defined(CMAKE_TESTING_${_bool_kind})
|
||||
CMAKE_TESTING_ARGS+= ${CMAKE_TESTING_${_bool_kind}:C/.*/-D&:BOOL=${_bool_kind}/}
|
||||
. endif
|
||||
.endfor
|
||||
|
||||
do-test:
|
||||
@cd ${BUILD_WRKSRC} && \
|
||||
${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} ${CMAKE_TESTING_ARGS} ${CMAKE_SOURCE_PATH} && \
|
||||
${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${ALL_TARGET} && \
|
||||
${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${CMAKE_TESTING_TARGET}
|
||||
.endif
|
||||
|
||||
.endif #!defined(_INCLUDE_USES_CMAKE_MK)
|
||||
|
Loading…
Reference in New Issue
Block a user