summaryrefslogtreecommitdiffstats
path: root/config/cmake/UseJavaSymlinks.cmake
blob: a4db5c19950c1964b593efdf1c042fec89ac6c69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Distributed under the OSI-approved BSD 3-Clause License.  See https://cmake.org/licensing for details.

#[=======================================================================[.rst:
UseJavaSymlinks
---------------





Helper script for UseJava.cmake
#]=======================================================================]

if (UNIX AND _JAVA_TARGET_OUTPUT_LINK)
    if (_JAVA_TARGET_OUTPUT_NAME)
        find_program(LN_EXECUTABLE
            NAMES
                ln
        )

        execute_process(
            COMMAND ${LN_EXECUTABLE} -sf "${_JAVA_TARGET_OUTPUT_NAME}" "${_JAVA_TARGET_OUTPUT_LINK}"
            WORKING_DIRECTORY ${_JAVA_TARGET_DIR}
        )
    else ()
        message(SEND_ERROR "FATAL: Can't find _JAVA_TARGET_OUTPUT_NAME")
    endif ()
endif ()