diff --git a/cmake/VISPUtils.cmake b/cmake/VISPUtils.cmake index 521ca00859..0b10ab4cec 100644 --- a/cmake/VISPUtils.cmake +++ b/cmake/VISPUtils.cmake @@ -1095,7 +1095,10 @@ macro(vp_add_subdirectories lst subdir) file(GLOB __subdirs RELATIVE "${__path}/${subdir}" "${__path}/${subdir}/*") foreach(__s ${__subdirs}) if(EXISTS "${__path}/${subdir}/${__s}/CMakeLists.txt") - add_subdirectory("${__path}/${subdir}/${__s}" "${CMAKE_BINARY_DIR}/${subdir}/${__s}") + # Add subdir only if ut doesn't exist + if(NOT EXISTS "${CMAKE_BINARY_DIR}/${subdir}/${__s}") + add_subdirectory("${__path}/${subdir}/${__s}" "${CMAKE_BINARY_DIR}/${subdir}/${__s}") + endif() endif() endforeach() endif()