[CMake] How to place .dll and .lib in different places?

Luigi Calori l.calori at cineca.it
Mon Aug 27 13:15:14 EDT 2007


Alexander Neundorf wrote:

>On Monday 27 August 2007 09:00, Luigi Calori wrote:
>  
>
>>Alexander Neundorf wrote:
>>    
>>
>>>On Monday 27 August 2007 06:08, Luigi Calori wrote:
>>>      
>>>
>>>>I have the problem of placing, at build time .lib in one folder (lib)
>>>>and .dll in another (bin)
>>>>One solution is to add POST_BUILD copy commands, but i would prefer not.
>>>>I have also been suggested to use
>>>>SET_TARGET_PROPERTIES ...  PROPERTIES PREFIX
>>>>being lib and bin sibling, this hack seem to work:
>>>>
>>>>SET(LIBRARY_OUTPUT_PATH <lib>)
>>>>SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/")
>>>>
>>>>
>>>>Is it "supported" or works by chances?
>>>>
>>>>I ask, because, I have also tried
>>>>SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/lib")
>>>>
>>>>to being able to have
>>>><lib_name>.lib in lib/Release
>>>><lib_name>d.lib in lib/Debug
>>>>
>>>>and
>>>>
>>>>lib<lib_name>.dll and lib<lib_name>d.dll both in bin
>>>>
>>>>Unfortunately this is working in debug but not in release mode.
>>>>        
>>>>
>>>Do you really need this in the build tree or only in the install tree ?
>>>Then you should use something like this:
>>>      
>>>
>>We already have it in the install tree, and is working properly.
>>I was trying to have the same structure on the build tree without
>>installing, and possibly without adding POST_BUILD custom commands
>>    
>>
>
>This is not supported.
>Do you really need this ?
>  
>
 I' ve been asked by the main developer to assemble a build layout that 
was resembling the install layout, so to being able to let users to test 
and play without installing.
I found on the docs that there is a TARGET property called IMPORT_PREFIX 
that can direct the placement of .lib files.
I have found that is possible to use the ../ to specify placement 
outside Debug and Release
The problem comes when I want  to use the library created with something 
like
        TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${LINKLIB}" debug 
"${LINKLIB}${CMAKE_DEBUG_POSTFIX}")
It seems that in debug mode, the names are expanded based on the target 
name while in release they are taken fron the .dll stuff (PREFIX)

Is it possible that this is related to me using .. in PREFIX?

Thanks
               Luigi

>Alex
>
>
>  
>



More information about the CMake mailing list