[CMake] MACOSX_BUNDLE targets fail as custom target dependencies
Brad King
brad.king at kitware.com
Tue May 27 09:56:14 EDT 2008
Allan Odgaard wrote:
> I have the following CMakeLists.txt file:
>
> project(foo)
> add_executable(foo MACOSX_BUNDLE main.cc)
> add_custom_target(run_foo echo running foo DEPENDS foo)
>
> This is what I get (Mac OS X Leopard, CMake 2.6.0 and 2.7 from CVS):
>
> % make run_foo
> Scanning dependencies of target foo
> [100%] Building CXX object CMakeFiles/foo.dir/main.o
> Linking CXX executable foo.app/Contents/MacOS/foo
> [100%] Built target foo
> Scanning dependencies of target run_foo
> make[3]: *** No rule to make target `foo', needed by
> `CMakeFiles/run_foo'. Stop.
> make[2]: *** [CMakeFiles/run_foo.dir/all] Error 2
> make[1]: *** [CMakeFiles/run_foo.dir/rule] Error 2
> make: *** [run_foo] Error 2
>
> Without the MACOSX_BUNDLE setting of the target, or trying to build the
> same project on Linux, it works.
If it works on any platform it is purely by accident. That is not the
syntax to add a target-level dependency. Try this:
project(foo)
add_executable(foo MACOSX_BUNDLE main.cc)
add_custom_target(run_foo echo running foo)
add_dependencies(run_foo foo)
The DEPENDS option to add_custom_target adds file-level dependencies
(for example could list the output of an add_custom_command).
Target-level dependencies are added by add_dependencies.
-Brad
More information about the CMake
mailing list