[vtkusers] Creating different named dll's for debug and release - possible?

Michael Jackson mike.jackson at bluequartz.net
Mon Feb 13 16:04:51 EST 2012


On Feb 13, 2012, at 2:09 PM, Marcus D. Hanwell wrote:

> On Mon, Feb 13, 2012 at 7:26 AM, Jon Payne <jpayne at hgl-dynamics.com> wrote:
>> Hi all,
>> 
>> At when building VTK shared libraries (DLL's on windows specifically) the
>> debug and release mode dll's are given the same name. Does anyone know if it
>> is possible to give them different names e.g. add a _debug or _release
>> suffix?
>> 
>> I know you can't _currently_ but is it possible using CMake? And if so how?
>> :)
>> 
>> This would really help us because at the moment when we're developing (and
>> deploying) and switching between debug/release mode the wrong version of the
>> DLL's can get loaded causing crashes and sometimes hard to diagnose
>> problems.
>> 
> It is possible to do with CMake, and we have discussed this briefly
> internally. Many projects use a d suffix for the debug versions of
> their library, and this seems reasonable. It would require changes to
> VTK's build system and the VTKConfig file, along with logic to build
> two versions of the library in one build. I am not sure how it would
> interact with the Visual Studio generators either, but see the Boost
> CMake project for an example where CMake builds multiple versions of a
> library with suffixes indicating type and even compiler.
> 
> Marcus

I currently use this in my own projects:

#-- Set the Debug Suffix for the application
    SET_TARGET_PROPERTIES( ${QAB_TARGET} 
                PROPERTIES
                DEBUG_OUTPUT_NAME ${QAB_TARGET}${QAB_DEBUG_EXTENSION}
                RELEASE_OUTPUT_NAME ${QAB_TARGET}
    )

where QAB_DEBUG_EXTENSION is "_debug" for my own projects. Set it to what you want. Qt uses "d". I don't believe there is a need to build BOTH debug and release in a single pass and here is why. 

   For Visual Studio you automatically get both configurations. Click Build and Install for each and you are done. For Makefile based do the normal thing and create 2 build directories, one for debug and one for release, and do a "make; make install" for both build directories.

 No need to over think the problem. Personally the Boost-CMake project went TOO far in trying to be like bjam which it was supposed to replace. Building both Debug and Release in a single pass was a BJam feature. I think staying with established CMake conventions is what VTK should try to do.

___________________________________________________________
Mike Jackson                    Principal Software Engineer
BlueQuartz Software                            Dayton, Ohio
mike.jackson at bluequartz.net              www.bluequartz.net



More information about the vtkusers mailing list