MantisBT - CMake
View Issue Details
0014819CMakeCMakepublic2014-03-20 04:442014-11-03 08:38
Richard Ulrich 
 
normalminoralways
closedno change required 
CMake 2.8.12.2 
 
0014819: excluding ARCHIVE part of library target from install
When building shared libraries on windows, I can specify the install location for the dll and lib file like this:

INSTALL(TARGETS MyLib
    RUNTIME DESTINATION bin # -> dll
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION lib # -> lib
    COMPONENT base
)

Now I should exclude the lib files from the generated installer.
As long as we used an external installer builder that I invoked with ADD_CUSTOM_TARGET(), I just executed an ADD_CUSTOM_COMMAND() just before, that deleted the lib files from the install directory.

But now that we use cpack to generate the installer, there is no suc interception point anymore.
So the next thing I tried was what I found in http://stackoverflow.com/questions/8636479/postpone-making-custom-target-until-install [^] :
INSTALL(CODE "EXECUTE_PROCESS(
    COMMAND del /F /Q ${TEMP2_CMAKE_INSTALL_PREFIX}\\\\bin\\\\*.lib
)")
But that doesn't work, as it is executed too early.

I also searched if there are cpack options to exclude certain files, but the only thing I found were filters for source files, but nothing for target files.

Anyway, I think the option to exclude the import libraries from target installs should exist without such hacks.

No tags attached.
Issue History
2014-03-20 04:44Richard UlrichNew Issue
2014-03-20 05:16Richard UlrichNote Added: 0035447
2014-03-20 08:30Brad KingNote Added: 0035448
2014-05-22 04:00Richard UlrichNote Added: 0035905
2014-05-22 08:49Brad KingStatusnew => resolved
2014-05-22 08:49Brad KingResolutionopen => no change required
2014-11-03 08:38Robert MaynardNote Added: 0037139
2014-11-03 08:38Robert MaynardStatusresolved => closed

Notes
(0035447)
Richard Ulrich   
2014-03-20 05:16   
It appears that if I set the archive destination to an empty string, the lib files are not installed. Now the question that remains is if this is the intended behavior, and should be documented, or it's just coincidence.

INSTALL(TARGETS MyLib
    RUNTIME DESTINATION bin # -> dll
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION "" # -> lib
    COMPONENT base
)
(0035448)
Brad King   
2014-03-20 08:30   
Just leave "ARCHIVE DESTINATION" out completely:

  install(TARGETS MyLib
    RUNTIME DESTINATION bin # -> dll
    LIBRARY DESTINATION lib # -> so
    COMPONENT base
    )
(0035905)
Richard Ulrich   
2014-05-22 04:00   
Thanks for clarifying.
You can close the issue.
(0037139)
Robert Maynard   
2014-11-03 08:38   
Closing resolved issues that have not been updated in more than 4 months.