[CMake] Installing OSX Frameworks

Mike Arthur mike at mikearthur.co.uk
Thu Jul 24 06:52:03 EDT 2008


On Wednesday 23 July 2008 21:45:34 Shead, Timothy wrote:
> On 7/23/08 1:45 PM, "Bill Hoffman" <bill.hoffman at kitware.com> wrote:
> While I'm at it, is there a good way to install an external shared library
> that handles its' symlinks?  I've been doing the following, which is
> less-than-satisfying:
I've got a slightly more cross-platform module I wrote to do this, based off 
yours:

# Takes a name of a variable containing a library location and returns the
# ${LIBRARY}_AND_SYMLINKS variable which contains a list of the library and
# all its symlinks.
macro(get_library_and_symlinks LIBRARY)
    get_filename_component(_LIBRARY_DIR "${${LIBRARY}}" PATH)
    get_filename_component(_LIBRARY_NAME "${${LIBRARY}}" NAME_WE)
    file(GLOB ${LIBRARY}_AND_SYMLINKS
        ${_LIBRARY_DIR}/${_LIBRARY_NAME}*${CMAKE_SHARED_LIBRARY_SUFFIX}*
    )
endmacro(get_library_and_symlinks LIBRARY)

So to use it you might do e.g.:
    get_library_and_symlinks(CLUCENE_LIBRARY)
    install(FILES ${CLUCENE_LIBRARY_AND_SYMLINKS}
        DESTINATION "${LIBRARY_INSTALL_DIRECTORY}"
    )

-- 
Cheers,
Mike Arthur


More information about the CMake mailing list