[CMake] add_subdirectory and build directory

Marcel Loose loose at astron.nl
Fri Sep 11 10:30:04 EDT 2009


Hi Pierre-Julien,

Are you sure it's rebuilding? CMake (or 'make' actually), prints a lot
of messages "Built target ..." even if no compilation was needed.
However, if you also see messages like "Building ..." then it is
actually rebuilding.

Without an example of the output of your build, it is hard to judge
what, if anything, is going wrong.

Best regards,
Marcel Loose.

On Fri, 2009-09-11 at 15:12 +0200, Pierre-Julien Villoud wrote:
> Hi everyone, 
> 
>  
> 
> After unsuccessfully looking for an answer on Google, I contact you.
> 
> I have a question regarding the use of add_subdirectory. When a
> project A is depending on a project B, I add the following in A’s
> CMakeLists.txt : 
> 
>  
> 
> Add_subdirectory(B Path/To/B/Build/Directory)
> 
>  
> 
> It does build B before A. But when I build B in its build directory
> and I build A after, it builds B again whereas it should not since B
> is up to date.
> 
>  
> 
> Anyone sees what’s wrong ?
> 
>  
> 
> Thanks in advance
> 
>  
> 
> Pierre-Julien VILLOUD
> 
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list