[CMake] Target dependencies

Boris Boesler baembel at gmx.de
Mon Aug 25 10:30:05 EDT 2008


> The DEPENDS of ADD_CUSTOM_TARGET expects file names, not target  
> names. So it can't find a file named foo...
>
> To set up inter-target dependencies, use ADD_DEPENDENCIES.

  Yeah, I just found that after sending the email, but that doesn't  
work either (cmake 2.6.1):

ADD_CUSTOM_TARGET(foo
  COMMAND echo "foo"
  COMMENT "Fooing ..")

ADD_CUSTOM_TARGET(bar
  COMMAND echo "bar"
  DEPENDS foo
  COMMENT "Bar-tender ..")
ADD_DEPENDENCIES(bar foo)

 > cmake ..

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/cmake-2.6.1

 > make bar

Scanning dependencies of target foo
[  0%] Fooing ..
foo
[ 50%] Built target foo
Scanning dependencies of target bar
make[3]: *** No rule to make target `foo', needed by `CMakeFiles/ 
bar'.  Stop.
make[2]: *** [CMakeFiles/bar.dir/all] Error 2
make[1]: *** [CMakeFiles/bar.dir/rule] Error 2
make: *** [bar] Error 2


Boris



More information about the CMake mailing list