Skip to content

Commit aa8d553

Browse files
committed
Allow disabling autodetection of subunit library
It can be useful to avoid linking to subunit when we are building the check library for the host, e.g. in a buildroot recipe, where the built check is linked into other applications which are used on the host to build images. These applications are built with the host's cross-compiler and can use the host's pkgconfig to determine if libraries are available. When check is linked against other libraries, it can fail this check for subunit. Allow disabling the autodetection of subunit with a configure flag -DENABLE_SUBUNIT_EXT=OFF Signed-off-by: Christopher Obbard <[email protected]>
1 parent 455005d commit aa8d553

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,13 @@ if (HAVE_LIBRT)
393393
ADD_DEFINITIONS(-DHAVE_LIBRT=1)
394394
endif (HAVE_LIBRT)
395395

396-
check_library_exists(subunit subunit_test_start "" HAVE_SUBUNIT)
396+
# Allow disabling subunit
397+
IF(ENABLE_SUBUNIT_EXT)
398+
check_library_exists(subunit subunit_test_start "" HAVE_SUBUNIT)
399+
ELSE(ENABLE_SUBUNIT_EXT)
400+
set(HAVE_SUBUNIT, false)
401+
ENDIF(ENABLE_SUBUNIT_EXT)
402+
397403
if (HAVE_SUBUNIT)
398404
set(SUBUNIT "subunit")
399405
set(ENABLE_SUBUNIT 1)

0 commit comments

Comments
 (0)