[CMake] Windows library target names

Michael Jackson mike.jackson at bluequartz.net
Thu Jul 22 17:50:33 EDT 2010


On Jul 22, 2010, at 5:42 PM, Olaf van der Spek wrote:

> On Thu, Jul 22, 2010 at 11:36 PM, Michael Jackson
> <mike.jackson at bluequartz.net> wrote:
>>> How does the loader find the DLL?
>>
>> Because when Visual Studio launches an executable it will look in  
>> the same
>> directory that the executable resides in for libraries to load.  
>> Now, if you
>> have 2 completely separate projects where one builds libraries and  
>> the other
>> builds the executables OR you have set the various CMAKE_RUNTIME_DIR,
>> CMAKE_ARCHIVE_DIR and CMAKE_EXECUTABLE_DIR to different directories  
>> then you
>> are going to have to setup your PATH accordingly for each solution/ 
>> project.
>> Most people set all three of those CMake variables to the same output
>> directory.
>
> Of course I have separate projects. I didn't write libz... Did you?
> DLLs should be *shared*. There shouldn't be a need for me to copy them
> to my app dir.

Well,
    Actually I _did_ put a CMake wrapper on LibZ that _does_ in fact  
decorate the library names. I did the same thing for expat, libTiff  
and HDF5 because I ran into all of these same issues a few years back.  
I then wrote custom FindXXX.cmake files to find the libraries in both  
the debug and release variants which all happen to be in the same  
build directory. My project then knows which library to link against,  
which ones to "install" or put into a NSIS installer package. So maybe  
that is the answer that you are looking for.
   The straight up answer is: CMake does not do this. If you want it  
put it into your cmake files. If you feel strongly enough then put in  
a feature request at the CMake bug tracker. If you _really_ feel  
strongly then add a patch to the feature request.

  Not sure what else to say. All my projects are open source and there  
are lots of others that you can take a look at that do exactly this.  
I'll plug my own: http://gitorious.bluequartz.net/MXA

Mike Jackson


More information about the CMake mailing list