ziptool_regress also needs getopt.
diff --git a/regress/CMakeLists.txt b/regress/CMakeLists.txt
index 099bdee..8bdce6d 100644
--- a/regress/CMakeLists.txt
+++ b/regress/CMakeLists.txt
@@ -38,7 +38,8 @@
   target_link_libraries(${PROGRAM} ${CMAKE_DL_LIBS})
 endforeach()
 
-foreach(PROGRAM IN LISTS GETOPT_USERS)
+# both programs using source_hole.c also use getopt
+foreach(PROGRAM IN LISTS GETOPT_USERS HOLE_USERS)
   add_executable(${PROGRAM} ${PROGRAM}.c)
   target_link_libraries(${PROGRAM} zip)
   if(NOT HAVE_GETOPT)
@@ -50,10 +51,6 @@
   add_executable(${PROGRAM} ${PROGRAM}.c source_hole.c)
   target_link_libraries(${PROGRAM} zip)
 endforeach()
-# hole needs getopt() too.
-if(NOT HAVE_GETOPT)
-  target_sources(hole PRIVATE ../src/getopt.c)
-endif(NOT HAVE_GETOPT)
 
 foreach(PROGRAM IN LISTS ALL_PROGRAMS)
   target_include_directories(${PROGRAM} PRIVATE BEFORE ${PROJECT_SOURCE_DIR}/lib ${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR})