Why toplevel Cmake can't clean custom project add by ExternProject_add

[Cmake 3.16.4] I use ExternalProject_Add command to add a custom project. The generate make file can build and link correctly. But when I use make clean to clean the project , the custom project cant not be cleaned.
The command is as follow:
include (ExternalProject)
ExternalProject_Add(ivptest
PREFIX ivptest
SOURCE_DIR “${CMAKE_CURRENT_LIST_DIR}/ivptest”
CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/Platform/xtensa-vq6p2.toolchain.cmake
INSTALL_COMMAND “”
)

It cant work correct and make correctly, the log is as follow:
[ 12%] Creating directories for ‘ivptest’
[ 25%] No download step for ‘ivptest’
[ 37%] No patch step for ‘ivptest’
[ 50%] No update step for ‘ivptest’
[ 62%] Performing configure step for ‘ivptest’
– The C compiler identification is GNU 4.2.0
– The CXX compiler identification is GNU 4.2.0
– Check for working C compiler: /home/l00175099/code/algorithms/Multimedia/cmake/Platform/…/…/Prebuilt/xtensa/XtDevTools/install/tools/RH-2017.4-linux/XtensaTools/bin/xt-xcc
– Check for working C compiler: /home/l00175099/code/algorithms/Multimedia/cmake/Platform/…/…/Prebuilt/xtensa/XtDevTools/install/tools/RH-2017.4-linux/XtensaTools/bin/xt-xcc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /home/l00175099/code/algorithms/Multimedia/cmake/Platform/…/…/Prebuilt/xtensa/XtDevTools/install/tools/RH-2017.4-linux/XtensaTools/bin/xt-xc++
– Check for working CXX compiler: /home/l00175099/code/algorithms/Multimedia/cmake/Platform/…/…/Prebuilt/xtensa/XtDevTools/install/tools/RH-2017.4-linux/XtensaTools/bin/xt-xc++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
– Configuring done
– Generating done
– Build files have been written to: /home/l00175099/code/algorithms/Multimedia/build/ivptest/src/ivptest-build
[ 75%] Performing build step for ‘ivptest’
Scanning dependencies of target msg
[ 25%] Building C object CMakeFiles/msg.dir/message.c.obj
[ 50%] Linking C static library libmsg.a
[ 50%] Built target msg
Scanning dependencies of target ivp_test
[ 75%] Building C object CMakeFiles/ivp_test.dir/main.c.obj
[100%] Linking C executable ivp_test
[100%] Built target ivp_test
[ 87%] No install step for ‘ivptest’
[100%] Completed ‘ivptest’
[100%] Built target ivptest

The make clean output no log.
Then i compile again, the custom project doesn’t compile object and library correctly:
[ 12%] Creating directories for ‘ivptest’
[ 25%] No download step for ‘ivptest’
[ 37%] No patch step for ‘ivptest’
[ 50%] No update step for ‘ivptest’
[ 62%] Performing configure step for ‘ivptest’
– Configuring done
– Generating done
– Build files have been written to: /home/l00175099/code/algorithms/Multimedia/build/ivptest/src/ivptest-build
[ 75%] Performing build step for ‘ivptest’
[ 50%] Built target msg
[100%] Built target ivp_test
[ 87%] No install step for ‘ivptest’
[100%] Completed ‘ivptest’
[100%] Built target ivptest

the CMakeFiles/ivptest.dir/cmake_clean.cmake 's content is as flow:
file(REMOVE_RECURSE
“CMakeFiles/ivptest”
“CMakeFiles/ivptest-complete”
“ivptest/src/ivptest-stamp/ivptest-build”
“ivptest/src/ivptest-stamp/ivptest-configure”
“ivptest/src/ivptest-stamp/ivptest-download”
“ivptest/src/ivptest-stamp/ivptest-install”
“ivptest/src/ivptest-stamp/ivptest-mkdir”
“ivptest/src/ivptest-stamp/ivptest-patch”
“ivptest/src/ivptest-stamp/ivptest-update”
)

It looks like ExternalProject could add some ADDITIONAL_CLEAN_FILES properties to the associated targets (or maybe directory; not sure which would be better here). Could you please file a new issue?

I don’t; know what you means fire a new issue.
For my understanding, the clean should remove totally the binary directory that ExternalProject_Add introduced.

“File”, not “fire” :slight_smile: . https://gitlab.kitware.com/cmake/cmake/issues