CONFIGURE_COMPONENTS globs components/* and components/test/* and adds every directory it finds, so the test-only components are built even when the build is configured with -DWITH_UNIT_TESTS=OFF. Most of that is some fifty translation units compiled and then discarded, but two of the six also install a binary: mysql_test_event_tracking and mysql_keyring_encryption_test, neither of which a server installation has any use for. Neither is claimed by a mysql_select slot, so dropping them does not disturb `port select`. Follow WITH_UNIT_TESTS. Note that components/test has to be dropped from the first glob as well as the second: components/* matches the directory itself, whose CMakeLists.txt declares the components, while components/test/* matches the subdirectories beneath it. --- a/cmake/component.cmake +++ b/cmake/component.cmake @@ -146,7 +146,12 @@ # Add all CMake projects under components MACRO(CONFIGURE_COMPONENTS) FILE(GLOB dirs_components ${CMAKE_SOURCE_DIR}/components/*) - FILE(GLOB dirs_components_test ${CMAKE_SOURCE_DIR}/components/test/*) + IF(WITH_UNIT_TESTS) + FILE(GLOB dirs_components_test ${CMAKE_SOURCE_DIR}/components/test/*) + ELSE() + LIST(REMOVE_ITEM dirs_components ${CMAKE_SOURCE_DIR}/components/test) + SET(dirs_components_test) + ENDIF() FOREACH(dir ${dirs_components} ${dirs_components_test}) IF (EXISTS ${dir}/CMakeLists.txt) ADD_SUBDIRECTORY(${dir})