[CMake] Setting the object file directory.

William A. Hoffman billlist at nycap.rr.com
Tue Oct 5 18:14:35 EDT 2004


I think it would have to be more general than just SRC_TO_OBJ.
I suppose you could provide a translation table from src to obj dir.
However, what happens when you do an in-source build?  It sounds like
a lot of complication, and I am not quite sure I see the pay off.

-Bill


At 05:02 PM 10/5/2004, Eric Bolz wrote:
>I'm confused.  Are you suggesting something like the following?  If the user creates a directory called "obj" inside the binary directory then cmake will notice it and put the object files there instead of  in src.  
>That would be fine.
>Remember, the goal is to not put object files in a directory called, src.
>
>A better solution could be a new variable called SRC_TO_OJB
>If I  SET( SRC_TO_OJB  TRUE) then cmake creates the obj directory for me and it will convert src to obj in the binary tree.
>If the source looks like this:
>src____dir1
>   |____dir2
>   |____dir3
>
>the binary side looks like this:
>obj____dir1
>   |____dir2
>   |____dir3
>
>
>
>William A. Hoffman wrote:
>
>>I don't think you would want to automatically do that.  What if
>>there already was an obj dir? 
>>At 03:06 PM 10/5/2004, you wrote:
>> 
>>
>>>Thanks for the fast reply.  I bought your book, Mastering CMake, and it is very helpful. How about adding a new feature in cmake to automatically rename any directory called "src" or "source"  to "obj" under the binary tree?
>>>Eric
>>>
>>>
>>>
>>>William A. Hoffman wrote:
>>>
>>>   
>>>
>>>>There is no way to change that name.
>>>>CMake creates an exact copy of the source tree in
>>>>the binary tree.   I suppose you could put the CMakeList file
>>>>in src, then create solaris/obj then run cmake ../../src instead
>>>>of cmake ...
>>>>
>>>>-Bill
>>>>
>>>>
>>>>At 02:26 PM 10/5/2004, Eric Bolz wrote:
>>>>
>>>>
>>>>     
>>>>
>>>>>My directory looks like this:
>>>>>There are several source directories under the "src" directory
>>>>>top ___ src____dir1
>>>>>|       |____dir2
>>>>>|       |____dir3
>>>>>|
>>>>>|___solaris
>>>>>|               |___linux
>>>>>
>>>>>My CMakeLists file lives at the top level and I specify the souce files as follows:
>>>>>SET( SOURCES src/dir1/file1.c  src/dir2/file2.c   src/dir3/file3.c )
>>>>>
>>>>>I'm doing out of source builds from within the solaris and linux directories by typing "cmake .."
>>>>>I want cmake to create a parallel directory tree (for the object files) under the name "obj", not "src"
>>>>>It should look like this:
>>>>>solaris___obj___dir1
>>>>>               |___dir2
>>>>>               |___dir3
>>>>>
>>>>>After all, it will contain object files, not source files.
>>>>>How can I get cmake to put the object files in a directory called "obj" under linux and solaris.
>>>>>
>>>>>_______________________________________________
>>>>>CMake mailing list
>>>>>CMake at www.cmake.org
>>>>>http://www.cmake.org/mailman/listinfo/cmake
>>>>> 
>>>>>       
>>>>     
>>
>> 



More information about the CMake mailing list