[CMake] custom commands and dependenciy problems

Bradley Lowekamp blowekamp at mail.nih.gov
Thu Jun 16 12:11:21 EDT 2005


So maybe this previous post doesn't work because the OBJECT_DEPENDS 
option must be a file or something. So I changed it to a custom command 
which trivial generates a file. That did work. But it did not work in 
my full project. So I added another layer of complexity, a 
subdirectory, to my little test and the test stopped working the way I 
expected. So here is my new test:

PROJECT(TEST4)


ADD_CUSTOM_COMMAND( OUTPUT ${TEST4_BINARY_DIR}/GeneratedCode
   COMMAND ${CMAKE_COMMAND}
   ARGS -E copy ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt 
${TEST4_BINARY_DIR}/GeneratedCode
   )


ADD_SUBDIRECTORY(foo)

#### in subdirectory foo ####

SET_SOURCE_FILES_PROPERTIES(foo.cpp PROPERTIES OBJECT_DEPENDS 
${TEST4_BINARY_DIR}/GeneratedCode)

ADD_LIBRARY(foo foo.cpp)


I am still working on linux, with a version of cmake from a couple of 
days ago and last week. Both with the same behavior. This is the error 
message I am getting:


"No rule to make target `GeneratedCode`, neeeded by 
foo/foo.dir/foo.o.depend'. Stop."

I find this odd that is says GeneeratedCode and not the expanded 
version of  ${TEST4_BINARY_DIR}/GeneratedCode Perhaps the is the 
problem there

Thanks,
Brad

========================================================
Bradley Lowekamp
Management Systems Designers Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
'blowekamp at mail.nih.gov

On Jun 14, 2005, at 11:40 AM, Bradley Lowekamp wrote:

> I have code similar to this and I don't under stand why it is not 
> working:
>
>
> ADD_CUSTOM_TARGET(gen DEPENDS ${SOME_GENERATED_FILES})
>
> SET_SOURCE_FILES_PROPERTIES(${SOME_SRC_FILES} PROPERTIES 
> OBJECT_DEPENDS gen)
>
> ADD_LIBRARY(my ${SOME_SRC_FILES})
>
>
> I am using make files on linux, a recent CVS version (last week). 
> There make error message I am getting is "No rule to make target 
> 'gen', needed by 'mysrc.cpp'. Stop. " Am I not under standing 
> something or have I encountered a bug or something?
>
> Thanks,
> Brad
>
>
> ========================================================
> Bradley Lowekamp
> Management Systems Designers Contractor for
> Office of High Performance Computing and Communications
> National Library of Medicine
> 'blowekamp at mail.nih.gov
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>



More information about the CMake mailing list