[CMake] Execution order

Michael Wild themiwi at gmail.com
Sat Sep 18 01:31:38 EDT 2010


On 17. Sep, 2010, at 16:49 , David Aldrich wrote:

> Hi Michael
> 
>> Ok, to clear things up:
> <snip>
>> I hope you get the idea.
> 
> Thanks very much, I think I get it now!  I have implemented an out-of-source build tree for our project, as you suggested, and it is building fine.

Good.

> 
> I'm wondering what my co-developers will think of it. It is usual for us to work in the source directory of a certain library, make modifications and then type make to build just that library.

You'll get used to having two shell windows open, one for coding, the other for building. This is even helping you as your "coding-shell" isn't cluttered with build output.

>  With this out-of-source build tree it will be necessary to hop from the source dir to the build tree, type make there and let the entire project build (i.e. other libraries and the executable as well). Am I understanding correctly?

You have to hop (or type "make -C /path/to/build/tree"). You don't have to build the whole project though, you can pass the library's target name to tell make to just build that target and all of its dependencies. Alternatively, jump to the sub-directory corresponding to the source directory containing the library's sources, and start the build process there.

> 
>> So, I usually have something like this:
>> 
>> ~/Projects/super_duper                   <--- source tree
>> ~/Projects/super_duper-build/debug       <--- debugging build tree
>> ~/Projects/super_duper-build/release     <--- release build tree
>> ~/Projects/super_duper-build/dashboards  <--- parent directory for dashboard builds
> 
> Do you usually let the libraries and executables live in the subdirectories where CMake would naturally put them? 
> 
> For example, some of my build artifacts would be:
> 
> super_duper-build/release/Kernel/libKernel.a
> super_duper-build/release/VersionInfo/versionInfo
> 
> Or would good practice me to put them somewhere more obvious?

That depends entirely on the needs of your project. In general, I'd recommend letting them be where CMake puts them. If that doesn't work for you (usually on Windows, where the DLL's must be in the same directory as the executables are in order to be able to run the executables without installing them), you can use the variables CMAKE_ARCHIVE_OUTPUT_DIRECTORY, CMAKE_LIBRARY_OUTPUT_DIRECTORY and CMAKE_RUNTIME_OUTPUT_DIRECTORY. For more fine-grained control, set like-named target properties (without the CMAKE_ prefix) using the set_target_properties() command.

Enjoy the weekend

Michael

--
There is always a well-known solution to every human problem -- neat, plausible, and wrong.
H. L. Mencken

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100918/90cfc835/attachment.pgp>


More information about the CMake mailing list