Imported Upstream version 2.8.10.2
[platform/upstream/cmake.git] / Modules / UseJavaSymlinks.cmake
1 #
2 # Helper script for UseJava.cmake
3 #
4
5 #=============================================================================
6 # Copyright 2010-2011 Andreas schneider <asn@redhat.com>
7 #
8 # Distributed under the OSI-approved BSD License (the "License");
9 # see accompanying file Copyright.txt for details.
10 #
11 # This software is distributed WITHOUT ANY WARRANTY; without even the
12 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 # See the License for more information.
14 #=============================================================================
15 # (To distribute this file outside of CMake, substitute the full
16 #  License text for the above reference.)
17
18 if (UNIX AND _JAVA_TARGET_OUTPUT_LINK)
19     if (_JAVA_TARGET_OUTPUT_NAME)
20         find_program(LN_EXECUTABLE
21             NAMES
22                 ln
23         )
24
25         execute_process(
26             COMMAND ${LN_EXECUTABLE} -sf "${_JAVA_TARGET_OUTPUT_NAME}" "${_JAVA_TARGET_OUTPUT_LINK}"
27             WORKING_DIRECTORY ${_JAVA_TARGET_DIR}
28         )
29     else ()
30         message(SEND_ERROR "FATAL: Can't find _JAVA_TARGET_OUTPUT_NAME")
31     endif ()
32 endif ()