[CMake] include_directories per target

Bill Hoffman bill.hoffman at kitware.com
Wed May 13 09:39:09 EDT 2009


Olivier Delannoy wrote:
> I have probably wrongly explained my issue. I have my source code
> located in several folders based on the component / library they are
> part of. But I don't want to have recursive make so I don't want to
> have my project relying on add_subdirectory(). Thus all my target are
> located in the main directory and refers to file located in different
> folders relative to the current hierarchy. I don't think there is
> anything wrong with that and I know how to do it. However, I would
> like to be able to ensure that only the library/component that use a
> library have access to the header file of that library.
> 

Why are you afraid of recursive make?  CMake does not generate makefiles 
like that anyway.   It does use some recursive make, but will use that 
regardless of add_subdirectory or not.  It is needed to get depend 
information to work correctly, and to make sure everything is up-to-date 
and in place before the build.   CMake will do the right thing if you 
use add_subdirectory.

-Bill


More information about the CMake mailing list