Reformat existing LGPL copyright notices.
[alexxy/gromacs.git] / src / programs / CreateLinks.cmake.cmakein
1 #
2 # This file is part of the GROMACS molecular simulation package.
3 #
4 # Copyright (c) 2012,2013, by the GROMACS development team, led by
5 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 # and including many others, as listed in the AUTHORS file in the
7 # top-level source directory and at http://www.gromacs.org.
8 #
9 # GROMACS is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public License
11 # as published by the Free Software Foundation; either version 2.1
12 # of the License, or (at your option) any later version.
13 #
14 # GROMACS is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # Lesser General Public License for more details.
18 #
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with GROMACS; if not, see
21 # http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23 #
24 # If you want to redistribute modifications to GROMACS, please
25 # consider that scientific software is very special. Version
26 # control is crucial - bugs must be traceable. We will be happy to
27 # consider code for inclusion in the official distribution, but
28 # derived work must not be called official GROMACS. Details are found
29 # in the README & COPYING files - if they are missing, get the
30 # official version at http://www.gromacs.org.
31 #
32 # To help us fund GROMACS development, we humbly ask that you cite
33 # the research papers on the package. Check out http://www.gromacs.org.
34
35 # TODO: It would be nicer to have the list generated from the binary,
36 # but this has some complications.  As the same list is also needed for
37 # man page generation, this can wait for now.
38 set(SYMLINK_NAMES
39     mdrun
40     gmxcheck
41     gmxdump
42     grompp
43     pdb2gmx
44     tpbconv
45     g_protonate
46     g_x2top
47     do_dssp
48     editconf
49     eneconv
50     genbox
51     genconf
52     genion
53     genrestr
54     make_edi
55     make_ndx
56     mk_angndx
57     trjcat
58     trjconv
59     trjorder
60     xpm2ps
61     g_anadock
62     g_anaeig
63     g_analyze
64     g_angle
65     g_bar
66     g_bond
67     g_bundle
68     g_chi
69     g_cluster
70     g_clustsize
71     g_confrms
72     g_covar
73     g_current
74     g_density
75     g_densmap
76     g_densorder
77     g_dielectric
78     g_dipoles
79     g_disre
80     g_dist
81     g_dos
82     g_dyecoupl
83     g_dyndom
84     g_enemat
85     g_energy
86     g_filter
87     g_gyrate
88     g_h2order
89     g_hbond
90     g_helix
91     g_helixorient
92     g_hydorder
93     g_kinetics
94     g_lie
95     g_mdmat
96     g_mindist
97     g_morph
98     g_msd
99     g_nmeig
100     g_nmens
101     g_nmtraj
102     g_options
103     g_order
104     g_pme_error
105     g_polystat
106     g_potential
107     g_principal
108     g_rama
109     g_rdf
110     g_rms
111     g_rmsdist
112     g_rmsf
113     g_rotacf
114     g_rotmat
115     g_saltbr
116     g_sans
117     g_sas
118     g_saxs
119     g_select
120     g_sgangle
121     g_sham
122     g_sigeps
123     g_sorient
124     g_spatial
125     g_spol
126     g_tcaf
127     g_traj
128     g_tune_pme
129     g_vanhove
130     g_velacc
131     g_wham
132     g_wheel
133     )
134
135 if (NOT DEFINED BINARY_DIRECTORY)
136     set(BINARY_DIRECTORY "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/@BIN_INSTALL_DIR@")
137 endif ()
138 set(BINARY_SUFFIX "@GMX_BINARY_SUFFIX@@CMAKE_EXECUTABLE_SUFFIX@")
139 set(GMX_NATIVE_WINDOWS "@GMX_NATIVE_WINDOWS@")
140
141 foreach (linkname ${SYMLINK_NAMES})
142     set(linkpath ${BINARY_DIRECTORY}/${linkname}${BINARY_SUFFIX})
143     # Based on documentation, CMake only supports symbolic links on Unix,
144     # although NTFS also has those (since Windows Vista; they require admin
145     # permissions to create).
146     if (GMX_NATIVE_WINDOWS)
147         if (NOT QUIETLY)
148             message(STATUS "Installing: Creating alias binary ${linkpath}")
149         endif ()
150         execute_process(
151             COMMAND ${CMAKE_COMMAND} -E copy_if_different
152                 ${BINARY_DIRECTORY}/gmx${BINARY_SUFFIX} ${linkpath})
153     else()
154         if (NOT QUIETLY)
155             message(STATUS "Installing: Creating symbolic link ${linkpath}")
156         endif ()
157         if (EXISTS ${linkpath})
158             FILE(REMOVE ${linkpath})
159         endif ()
160         execute_process(
161             COMMAND ${CMAKE_COMMAND} -E create_symlink
162                 gmx${BINARY_SUFFIX} ${linkpath})
163     endif()
164 endforeach ()