[cmake-developers] targets with the same name as their enclosing directory can't be built when in that directory.

Brad King brad.king at kitware.com
Mon Sep 5 08:42:27 EDT 2016


On 09/05/2016 04:22 AM, Steve Lorimer wrote:
> $ cat src/foo/foobar/CMakeLists.txt 
> add_executable(foobar main.cpp)
> However, if I am in the build/foo directory, then nothing happens
> if I "make foobar". 

That's because the foobar target is defined in build/foo/foobar.
The target names are only buildable in the top level or in the
subdirectory that defines a given target.

-Brad



More information about the cmake-developers mailing list