[CMake] How to specify out-of-source build/lib/bin directories

Alexander.Camek at elektrobit.com Alexander.Camek at elektrobit.com
Thu Jan 17 05:54:35 EST 2008


Hi Matthias,

> I'm a new cmake user and I'm having a little trouble. Perhaps 
> someone here can help me: I was wondering if it is possible 
> to specify a build path manually within the toplevel 
> CMakeLists.txt file? I did read the wiki about out-of-source 
> build environments, but the examples all used ccmake for 
> setting it up (or I missed it). The same applies to lib/bin 
> paths, i.e. I would like to specify an out-of-source lib 
> directory and an out-of-source bin directory to place the 
> executables in... what would be the appropriate command for this?


In order to get an own out-of source path to lib or bin directory you can use following variables:
# set destination paths
SET(LIBRARY_OUTPUT_PATH  ${<PORJECT>_BINARY_DIR}/lib CACHE PATH "Single directory for all libraries." )
SET( EXECUTABLE_OUTPUT_PATH ${<PORJECT>_BINARY_DIR}/bin CACHE PATH "Single directory for all executables." )
MARK_AS_ADVANCED( EXECUTABLE_OUTPUT_PATH )
MARK_AS_ADVANCED( LIBRARY_OUTPUT_PATH )

Where <PORJECT> is the name which was set by PROJECT()
 
Hope to help

Greetings

Alexander


----------------------------------------------------------------
Please note: This e-mail may contain confidential information
intended solely for the addressee. If you have received this
e-mail in error, please do not disclose it to anyone, notify
the sender promptly, and delete the message from your system.
Thank you.



More information about the CMake mailing list