[CMake] add dependencies to clean target ?

frederic heem frederic.heem at telsey.it
Mon Oct 9 09:59:51 EDT 2006


Hi,
It seems that it's not possible to add dependencies to implicit target such as 
clean and package_source. The user defined target FsmCompilerClean must be 
called whenever the target clean is used.
Here is the CMakeLists.txt

PROJECT(FSMCOMPILER)
#Find ant
FIND_PACKAGE(ANT REQUIRED)

#build FsmCompiler.jar
ADD_CUSTOM_TARGET(FsmCompiler ALL
                  ${ANT_EXECUTABLE} FsmCompiler 
                  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

#clean FsmCompiler
ADD_CUSTOM_TARGET(FsmCompilerClean
                  ${ANT_EXECUTABLE} clean 
                  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
# fails here
ADD_DEPENDENCIES(clean FsmCompilerClean)

cmake replies : ADD_DEPENDENCIES Adding dependency to non-existent target: 
clean
	
Another problem is that the target package_source doesn't depends on clean. 
Also, when using the target package_source, the build directory must be 
outside the source directory, otherwise, the archive will contain the build 
directory.
Cheers
Frederic Heem





More information about the CMake mailing list