Closed PhilippvK closed 4 years ago
I would say that a clean that removes the cmake related files is relevant. I commonly stumble across weird build problems because my cmake cache is being weird and throwing errors. Not a standard make clean
which should just remove object files and binaries to force a complete recompile etc but something like clean all
. I would do a clean hierarchy like all
->lib
->standard clean
.
@alxhoff The problem is that I do not get the Hierarchy set up because I can not create a dependency on the clean target. Try it out yourself and you will see...
@PhilippvK i'll give it a shot now
@PhilippvK also why is the second executable required?
I explained it above. It makes make clean
also remove the BIN file. But this way of doing this is meh. set(ADDITIONAL_CLEAN_FILES ...)
would be better but it did not work for me
@PhilippvK I solved the issues with a few things.
The flash target now manually removes the .bin
after flashing such that we don't build a second binary. Also clean dependencies are tricky as you can run into problems where you remove the cmake file the clean target actually calls, see this post. I also made use of git to implement clean_cmake
and clean_all
, clean all removes libs.
ops
I just wanted to let you know that you have used the -f
Parameter two times in line 142 of your CmakeList.txt @alxhoff
Sorry, i am at my mobile phone and was not able to annotate the code.
This is what I ment: COMMAND git clean -d ${PROJECT_SOURCE_DIR} -f -f -x
ahh yes I already had a second -f
on the root dir to remove the lib repos
Ahh I thought it was a typo that you used a second one. Sorry my fault, I do understand now.
No worries. Double options are a very rare thing.
Beside a small documentation fix this should implement 2 features:
*.bin
file onmake clean
clean_lib
target to remove downloaded libraries.I do not see any reason in cleaning Cmake-related files, too.
I am unfortunately very dissatisfied with both of my implementation and as I was not able to find ways to implement the features properly.
here is a list of things, that should actually be improved:
ADDITIONAL_CLEAN_FILES
but for whatever reason to did not have an effect.clean_all
depending onclean
but was not able to do this asDEPENDS clean
resulted in an error.lib
directory to created an additional filecmake/cleanall.cmake
with is loaded when the corresponding make target is called. This has the problem that the path to the CMake file as well as the path for the library is hardcoded. Using a simplerm
command instead offile(REMOVE_RECURSE ...
could be a better option...