On 06/03/2017 12:43, Bernhard Seckinger wrote:
Hi all,

I've got a project where meanwhile everything works, using cmake, but a tiny
detail. I've got a frontend which consists of several php files. I copy them
into a subfolder of share/ with the install command. Now I need a symlink from
bin/croco to share/croco/main.php that is, after installing everything else "ln
-s share/croco/main.php bin/croco" should be executed.

I know, that symlinks are not available in some other OSs, but for the time
being, I only need a solution, that works using linux.

What I found so far is:

add_custom_command(OUTPUT bin/croco
                   COMMAND ln -s share/croco/main.php bin/croco
                   DEPENDS share/croco/main.php)

But that seems to be ignored by "make install". Can you help me?

bzip2 example (from https://github.com/ome/ome-cmake-superbuild/blob/master/packages/bzip2/patches/cmake.diff#L163)

# Copy or symlink bunzip2 and bzcat to bzip2
if (WIN32)
    install(CODE "configure_file(\"${CMAKE_INSTALL_FULL_BINDIR}/bzip2.exe\"

\"${CMAKE_INSTALL_FULL_BINDIR}/bunzip2.exe\"
                                 COPYONLY)"
            COMPONENT "runtime")
    install(CODE "configure_file(\"${CMAKE_INSTALL_FULL_BINDIR}/bzip2.exe\"
                                 \"${CMAKE_INSTALL_FULL_BINDIR}/bzcat.exe\"
                                 COPYONLY)"
            COMPONENT "runtime")
else()
    install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E
            create_symlink bzip2
            \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/bunzip2\")"
            COMPONENT "runtime")
    install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E
            create_symlink bzip2
            \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/bzcat\")"
            COMPONENT "runtime")
endif()


Hope that's useful as an example,
Roger
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to