[CMake] Install command incorrectly installing archive libraries
Michael Wild
themiwi at gmail.com
Fri Nov 18 16:49:23 EST 2011
Sorry, I misread the documentation myself. You need multiple install()
commands, for each configuration one, but after each DESTINATION option
you also need the COMPONENTS option. So, this would be something like this:
install(TARGETS first
ARCHIVE DESTINATION lib/release CONFIGURATIONS Release
LIBRARY DESTINATION lib/release CONFIGURATIONS Release
RUNTIME DESTINATION lib/release CONFIGURATIONS Release)
install(TARGETS first
ARCHIVE DESTINATION lib/debug CONFIGURATIONS Debug
LIBRARY DESTINATION lib/debug CONFIGURATIONS Debug
RUNTIME DESTINATION lib/debug CONFIGURATIONS Debug)
HTH
Michael
On 11/18/2011 05:13 PM, Stephen Torri wrote:
> Using the single command will place the release libraries into the
> lib/release directory when using the -C Release flag with CPack. If I
> do -C Debug flag with CPack then the PDB files are installed to
> lib/debug but the libraries are installed to lib/release. Any reason
> why this single command would behave that way?
>
> Stephen
>
> On 11/18/11, Michael Wild <themiwi at gmail.com> wrote:
>> On 11/17/2011 06:12 PM, Stephen Torri wrote:
>>> CMake Version: 2.8
>>>
>>> Generator: Visual Studio 2008
>>>
>>> Problem: Two install commands are used per library. First command
>>> should only install libraries to lib/debug when the build type is
>>> Debug. The second command should only install libraries to the
>>> lib/release directory. When the build type is Debug than three
>>> libraries .lib files are being installed to the lib\release directory.
>>>
>>> For example I have the following entries for a library:
>>>
>>> INSTALL ( TARGETS first
>>> ARCHIVE DESTINATION lib/debug
>>> LIBRARY DESTINATION lib/debug
>>> RUNTIME DESTINATION lib/debug
>>> CONFIGURATIONS Debug )
>>>
>>> INSTALL ( TARGETS first
>>> ARCHIVE DESTINATION lib/release
>>> LIBRARY DESTINATION lib/release
>>> RUNTIME DESTINATION lib/release
>>> CONFIGURATIONS Release )
>>>
>>> So when I run cpack -C Debug and use the installer I find first.lib in
>>> both lib/debug and lib/release. I am not sure why this is the case.
>>> Any ideas?
>>>
>>> Stephen
>>
>> I think you mis-read the install() documentation. Granted, it is a bit
>> confusing and matching up the brackets is a bit tedious, but the
>> CONFIGURATIONS option applies only to the preceeding DESTINATION option.
>> So you could write everything in one single command:
>>
>> install(TARGETS first
>> ARCHIVE DESTINATION lib/debug CONFIGURATIONS Debug
>> LIBRARY DESTINATION lib/debug CONFIGURATIONS Debug
>> RUNTIME DESTINATION lib/debug CONFIGURATIONS Debug
>> ARCHIVE DESTINATION lib/release CONFIGURATIONS Release
>> LIBRARY DESTINATION lib/release CONFIGURATIONS Release
>> RUNTIME DESTINATION lib/release CONFIGURATIONS Release)
>>
>> HTH
>>
>> Michael
More information about the CMake
mailing list