[CMake] ADD_CUSTOM_COMMAND problem with cmake 2.4.3
Brad King
brad.king at kitware.com
Thu Oct 5 09:10:26 EDT 2006
Gregor Berginc wrote:
> Dear all,
>
> yesterday I faced wierd behaviour of the newest cmake. Before, I was
> using cmake version 2.4-patch 2 and the following command executed
> successfully:
> =
> ADD_CUSTOM_COMMAND(
> OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${cpp_class}.h
> COMMAND ${JAVAH_RUNTIME}
> ARGS -verbose -classpath ${OUTPUT}/classes -d
> ${CMAKE_CURRENT_SOURCE_DIR} ${jni_class}
> )
>
> The command should use javah executable to compile the ${jni_class}
> into ${cpp_class}.h. The output should be placed in
> <project_root>/src/c++/balt/jni directory. Now, when I use cmake
> version 2.4-patch 3, I get the following error during make:
>
> make[2]: *** No rule to make target
> `../src/c++/balt/jni/balt_jni_NativeProcessLauncher.h', needed by
> `src/c++/balt/jni/CMakeFiles/FrameworkJNI.dir/JNIProcessInterface.o'.
> Stop.
> make[1]: *** [src/c++/balt/jni/CMakeFiles/FrameworkJNI.dir/all] Error 2
> make: *** [all] Error 2
>
> Note, that I am using out-of-source build which is started from
> <project_root>/.debug. Now, I am not sure why the command is not
> executed. The path
> ../src/c++/balt/jni/balt_jni_NativeProcessLauncher.h is correct if it
> is relative to the <project_root>/.debug. The file needs to be created
> under the src directory!
>
> What has changed since patch 2 version? Is this a bug or just my bad
> interpretation of ADD_CUSTOM_COMMAND and cmake variables?
IIRC there was a change that had to do with the relative path
computation during dependency scanning to make sure .o file dependencies
and custom command outputs appeared with the same form in the makefiles.
Perhaps there were cached scan results that tricked this code into not
working. Does it still occur with a fresh build tree and source tree?
-Brad
More information about the CMake
mailing list