[CMake] install( TARGETS module ...)
Michael Hertling
mhertling at online.de
Sun Jul 3 02:29:39 EDT 2011
On 07/01/2011 03:32 PM, Mathieu Malaterre wrote:
> Dear all,
>
> I am trying to change the default behavior of cmake which installs
> MODULE to the LIBRARY destination. For example:
>
> ...
> add_library(test MODULE test.c)
> install(TARGETS test
> RUNTIME DESTINATION bin
> LIBRARY DESTINATION lib
> ARCHIVE DESTINATION lib/static
> )
> ...
>
> Will install test.dll to lib, while a SHARED target would have been
> installed to bin. Is there an easy work around ? I cannot change
> MODULE to SHARED in add_library().
> I would also like to keep installation to lib, in case of UNIX
> system (basically I want the SHARED behavior for install() but with
> MODULE).
>
> Thanks for suggestion,
The only solution I'm aware of is a Windows-selective destination, e.g.:
ADD_LIBRARY(test MODULE ...)
IF(WIN32)
SET(MODDST bin CACHE STRING "...")
ELSE()
SET(MODDST lib CACHE STRING "...")
ENDIF()
INSTALL(TARGETS test
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${MODDST}
ARCHIVE DESTINATION lib/static
...
)
Regards,
Michael
More information about the CMake
mailing list