[CMake] Out-of-source build

Mike Jackson imikejackson at gmail.com
Sun Nov 11 13:49:17 EST 2007


To further expound upon the last posting:

# ---------- Setup output Directories -------------------------
SET (LIBRARY_OUTPUT_PATH
   ${PROJECT_BINARY_DIR}/Bin
   CACHE PATH
   "Single Directory for all Libraries"
   )

# --------- Setup the Executable output Directory -------------
SET (EXECUTABLE_OUTPUT_PATH
   ${PROJECT_BINARY_DIR}/Bin
   CACHE PATH
   "Single Directory for all Executables."
   )


also, trying to simply set the build directory to 'bin' inside your  
source directory will give some interesting
results as CMake generates lots of support files and it may be  
difficult to find all your build outputs.

Take a look at http://titanium.imts.us/viewvc/Task_7/MXADataModel/ as  
an example of how I have setup my projects. The basics are:
    Top level CMakeLists.txt file that also references some  
subprojects such as a Boost Unit Test based test suite and some  
examples. There are also some "support scripts" that are located in / 
Resources that might be useful.

Hope this helps.
-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services


On Nov 11, 2007, at 11:36 AM, Andreas Pakulat wrote:

> On 11.11.07 17:25:38, Yinon Ehrlich wrote:
>> Hi,
>>
>> * I'm new to CMake, trying to convert our existing GNU Makefiles  
>> to CMake.
>> * I need the out-of-source feature, and I want to make sure I do  
>> it the
>> right way:
>>    SET(TOPLEVEL "../../..")
>>    SET(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/${TOPLEVEL}/bin)
>>   ... is this the "right" way to do this ?
>
> That doesn't really work, because it makes assumptions as to where the
> builddir is, relative to the source dir.
>
> If you want your binaries all put into <builddir>/bin you should  
> use the
> EXECUTABLE_OUTPUT_PATH and set it to ${CMAKE_BINARY_DIR}/bin. The same
> can be done for LIBRARY_OUTPUT_PATH to have libs in <builddir>/lib.
>
> Andreas
>
> -- 
> Afternoon very favorable for romance.  Try a single person for a  
> change.
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list