if(POLICY CMP0022)
cmake_policy(SET CMP0022 OLD)
endif()
+if(${CMAKE_VERSION} VERSION_LESS "3.4.0")
+ message(WARNING "CMake 3.4.0 or newer is required to get correct default installation paths")
+endif()
# Internal cmake modules
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
set(RCVERSION 1,10,80,0)
# Installation paths
-set(SYSCONF_DIR "${CMAKE_INSTALL_PREFIX}/etc")
-set(BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin")
-set(SBIN_DIR "${CMAKE_INSTALL_PREFIX}/sbin")
-set(DATA_DIR "${CMAKE_INSTALL_PREFIX}/share")
-set(LIBEXEC_DIR "${CMAKE_INSTALL_PREFIX}/libexec")
-set(MAN_DIR "${DATA_DIR}/man")
-set(LOCALE_DIR "${DATA_DIR}/locale")
-set(DOC_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/${CMAKE_PROJECT_NAME}-${VERSION}")
-set(UNIT_DIR "${CMAKE_INSTALL_PREFIX}/lib/systemd/system")
-
-if(WIN32)
-set(BIN_DIR "${CMAKE_INSTALL_PREFIX}")
-set(DOC_DIR "${CMAKE_INSTALL_PREFIX}")
+include(GNUInstallDirs)
+set(CMAKE_INSTALL_UNITDIR "lib/systemd/system" CACHE PATH "systemd unit files (lib/systemd/system)")
+if(IS_ABSOLUTE "${CMAKE_INSTALL_UNITDIR}")
+ set(CMAKE_INSTALL_FULL_UNITDIR "${CMAKE_INSTALL_UNITDIR}")
+else()
+ set(CMAKE_INSTALL_FULL_UNITDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_UNITDIR}")
endif()
option(INSTALL_SYSTEMD_UNITS "Install TigerVNC systemd units" ON)
# Common
#
-install(FILES ${CMAKE_SOURCE_DIR}/LICENCE.TXT DESTINATION ${DOC_DIR})
-install(FILES ${CMAKE_SOURCE_DIR}/README.rst DESTINATION ${DOC_DIR})
+install(FILES ${CMAKE_SOURCE_DIR}/LICENCE.TXT DESTINATION ${CMAKE_INSTALL_FULL_DOCDIR})
+install(FILES ${CMAKE_SOURCE_DIR}/README.rst DESTINATION ${CMAKE_INSTALL_FULL_DOCDIR})
#cmakedefine HAVE_ACTIVE_DESKTOP_L
#cmakedefine ENABLE_NLS 1
-#cmakedefine LIBEXEC_DIR "@LIBEXEC_DIR@"
-#cmakedefine DATA_DIR "@DATA_DIR@"
-#cmakedefine LOCALE_DIR "@LOCALE_DIR@"
+#cmakedefine CMAKE_INSTALL_FULL_LIBEXECDIR "@CMAKE_INSTALL_FULL_LIBEXECDIR@"
+#cmakedefine CMAKE_INSTALL_FULL_DATADIR "@CMAKE_INSTALL_FULL_DATADIR@"
+#cmakedefine CMAKE_INSTALL_FULL_LOCALEDIR "@CMAKE_INSTALL_FULL_LOCALEDIR@"
/* MS Visual Studio 2008 and newer doesn't know ssize_t */
#if defined(HAVE_GNUTLS) && defined(WIN32) && !defined(__MINGW32__)
cmake -G"Unix Makefiles" \
-DBUILD_STATIC=off \
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
- -DSYSCONF_DIR:PATH=/etc \
- -DLIBEXEC_DIR:PATH=/usr/lib/$(DEB_HOST_MULTIARCH) \
- -DUNIT_DIR:PATH=/lib/systemd/system
+ -DCMAKE_INSTALL_LIBEXECDIR:PATH=lib/$(DEB_HOST_MULTIARCH) \
+ -DCMAKE_INSTALL_UNITDIR:PATH=/lib/systemd/system
(cd unix/xserver; \
export PIXMANINCDIR=/usr/include/pixman-1; \
autoreconf -fiv; \
#(cd java; make install DESTDIR=$(CURDIR)/debian/tigervnc-java/usr/share)
# install additional license files
mkdir -p $(CURDIR)/debian/xtigervncviewer/usr/share/doc/xtigervncviewer
- cp $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc-*/* \
+ cp $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc/* \
$(CURDIR)/debian/xtigervncviewer/usr/share/doc/xtigervncviewer/
#mkdir -p $(CURDIR)/debian/tigervnc-java/usr/share/doc/tigervnc-java
- #cp $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc-*/* \
+ #cp $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc/* \
#$(CURDIR)/debian/tigervnc-java/usr/share/doc/tigervnc-java/
mkdir -p $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervncserver
- mv $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc-*/* \
- $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervncserver/
- rm -rf $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc-*/
+ mv $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc \
+ $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervncserver
# dh_movefiles
sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' \
debian/tigervncserver.postinst.in > debian/tigervncserver.postinst
cmake -G"Unix Makefiles" \
-DBUILD_STATIC=off \
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
- -DSYSCONF_DIR:PATH=/etc \
- -DLIBEXEC_DIR:PATH=/usr/lib/$(DEB_HOST_MULTIARCH) \
- -DUNIT_DIR:PATH=/lib/systemd/system
+ -DCMAKE_INSTALL_LIBEXECDIR:PATH=lib/$(DEB_HOST_MULTIARCH) \
+ -DCMAKE_INSTALL_UNITDIR:PATH=/lib/systemd/system
(cd unix/xserver; \
export PIXMANINCDIR=/usr/include/pixman-1; \
autoreconf -fiv; \
#(cd java; make install DESTDIR=$(CURDIR)/debian/tigervnc-java/usr/share)
# install additional license files
mkdir -p $(CURDIR)/debian/xtigervncviewer/usr/share/doc/xtigervncviewer
- cp $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc-*/* \
+ cp $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc/* \
$(CURDIR)/debian/xtigervncviewer/usr/share/doc/xtigervncviewer/
#mkdir -p $(CURDIR)/debian/tigervnc-java/usr/share/doc/tigervnc-java
- #cp $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc-*/* \
+ #cp $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc/* \
#$(CURDIR)/debian/tigervnc-java/usr/share/doc/tigervnc-java/
- mkdir -p $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervncserver
- mv $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc-*/* \
- $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervncserver/
- rm -rf $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc-*/
+ mv $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervnc \
+ $(CURDIR)/debian/tigervncserver/usr/share/doc/tigervncserver
# dh_movefiles
sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' \
debian/tigervncserver.postinst.in > debian/tigervncserver.postinst
export CMAKE_EXE_LINKER_FLAGS=$LDFLAGS
+# The cmake in RHEL is too old and doesn't set up
+# CMAKE_INSTALL_SYSCONFDIR properly
%{cmake} -G"Unix Makefiles" \
- -DBUILD_STATIC=off \
- -DCMAKE_INSTALL_PREFIX=%{_prefix} \
- -DSYSCONF_DIR=%{_sysconfdir}
+ -DCMAKE_INSTALL_SYSCONFDIR:PATH=%{_sysconfdir} \
+ -DBUILD_STATIC=off
make %{?_smp_mflags}
pushd unix/xserver
%files -f %{name}.lang
%defattr(-,root,root,-)
-%doc %{_docdir}/%{name}-%{version}/README.rst
+%doc %{_docdir}/%{name}/README.rst
%{_bindir}/vncviewer
%{_datadir}/applications/*
%{_mandir}/man1/vncviewer.1*
%endif
%files license
-%doc %{_docdir}/%{name}-%{version}/LICENCE.TXT
+%doc %{_docdir}/%{name}/LICENCE.TXT
%files icons
%defattr(-,root,root,-)
find_package(Java)
-set(DATA_DIR "${CMAKE_INSTALL_PREFIX}/share")
-
set(DEFAULT_JAVACFLAGS "-source 8 -target 8 -encoding UTF-8 -Xlint:all,-serial,-cast,-unchecked,-fallthrough,-dep-ann,-deprecation,-rawtypes")
set(JAVACFLAGS ${DEFAULT_JAVACFLAGS} CACHE STRING
"Java compiler flags (Default: ${DEFAULT_JAVACFLAGS})")
if(UNIX AND NOT APPLE)
foreach(SIZE 16 22 24 32 48)
install(FILES icons/tigervnc_${SIZE}.png
- DESTINATION ${DATA_DIR}/icons/hicolor/${SIZE}x${SIZE}/apps
+ DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/${SIZE}x${SIZE}/apps
RENAME tigervnc.png)
endforeach()
install(FILES icons/tigervnc.svg
- DESTINATION ${DATA_DIR}/icons/hicolor/scalable/apps)
+ DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/scalable/apps)
endif()
endif()
)
install(FILES ${mo}
- DESTINATION "${LOCALE_DIR}/${lang}/LC_MESSAGES"
+ DESTINATION "${CMAKE_INSTALL_FULL_LOCALEDIR}/${lang}/LC_MESSAGES"
RENAME tigervnc.mo
)
target_link_libraries(vncconfig tx rfb network rdr ${X11_LIBRARIES})
-install(TARGETS vncconfig DESTINATION ${BIN_DIR})
-install(FILES vncconfig.man DESTINATION ${MAN_DIR}/man1 RENAME vncconfig.1)
+install(TARGETS vncconfig DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
+install(FILES vncconfig.man DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man1 RENAME vncconfig.1)
target_link_libraries(vncpasswd tx rfb os)
-install(TARGETS vncpasswd DESTINATION ${BIN_DIR})
-install(FILES vncpasswd.man DESTINATION ${MAN_DIR}/man1 RENAME vncpasswd.1)
+install(TARGETS vncpasswd DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
+install(FILES vncpasswd.man DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man1 RENAME vncpasswd.1)
configure_file(vncsession-start.in vncsession-start @ONLY)
configure_file(vncserver.in vncserver @ONLY)
-install(TARGETS vncsession DESTINATION ${SBIN_DIR})
-install(FILES tigervnc.pam DESTINATION ${SYSCONF_DIR}/pam.d RENAME tigervnc)
-install(FILES vncsession.man DESTINATION ${MAN_DIR}/man8 RENAME vncsession.8)
-install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/vncserver DESTINATION ${LIBEXEC_DIR})
-install(FILES vncserver.man DESTINATION ${MAN_DIR}/man8 RENAME vncserver.8)
-install(FILES vncserver-config-defaults vncserver-config-mandatory DESTINATION ${SYSCONF_DIR}/tigervnc)
+install(TARGETS vncsession DESTINATION ${CMAKE_INSTALL_FULL_SBINDIR})
+install(FILES tigervnc.pam DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/pam.d RENAME tigervnc)
+install(FILES vncsession.man DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man8 RENAME vncsession.8)
+install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/vncserver DESTINATION ${CMAKE_INSTALL_FULL_LIBEXECDIR})
+install(FILES vncserver.man DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man8 RENAME vncserver.8)
+install(FILES vncserver-config-defaults vncserver-config-mandatory DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/tigervnc)
-install(FILES vncserver.users DESTINATION ${SYSCONF_DIR}/tigervnc)
+install(FILES vncserver.users DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/tigervnc)
if(INSTALL_SYSTEMD_UNITS)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/vncserver@.service DESTINATION ${UNIT_DIR})
- install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/vncsession-start DESTINATION ${LIBEXEC_DIR})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/vncserver@.service DESTINATION ${CMAKE_INSTALL_FULL_UNITDIR})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/vncsession-start DESTINATION ${CMAKE_INSTALL_FULL_LIBEXECDIR})
endif()
push(@cmd, '--');
# We build up our Xvnc command with options
-push(@cmd, "@BIN_DIR@/Xvnc", ":$displayNumber");
+push(@cmd, "@CMAKE_INSTALL_FULL_BINDIR@/Xvnc", ":$displayNumber");
foreach my $k (sort keys %config) {
push(@cmd, "-$k");
[Service]
Type=forking
-ExecStart=/usr/libexec/vncsession-start %i
+ExecStart=@CMAKE_INSTALL_FULL_LIBEXECDIR@/vncsession-start %i
PIDFile=/var/run/vncsession-%i.pid
SELinuxContext=system_u:system_r:vnc_session_t:s0
# USA.
#
-USERSFILE="@SYSCONF_DIR@/tigervnc/vncserver.users"
+USERSFILE="@CMAKE_INSTALL_FULL_SYSCONFDIR@/tigervnc/vncserver.users"
if [ $# -ne 1 ]; then
echo "Syntax:" >&2
exit 1
fi
-exec "@SBIN_DIR@/vncsession" "${USER}" "${DISPLAY}"
+exec "@CMAKE_INSTALL_FULL_SBINDIR@/vncsession" "${USER}" "${DISPLAY}"
setenv("USER", pwent->pw_name, 1);
setenv("USERNAME", pwent->pw_name, 1);
- child_argv[0] = LIBEXEC_DIR "/vncserver";
+ child_argv[0] = CMAKE_INSTALL_FULL_LIBEXECDIR "/vncserver";
child_argv[1] = display;
child_argv[2] = NULL;
target_link_libraries(x0vncserver ${X11_LIBRARIES})
-install(TARGETS x0vncserver DESTINATION ${BIN_DIR})
-install(FILES x0vncserver.man DESTINATION ${MAN_DIR}/man1 RENAME x0vncserver.1)
+install(TARGETS x0vncserver DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
+install(FILES x0vncserver.man DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man1 RENAME x0vncserver.1)
target_link_libraries(vncviewer "-framework IOKit")
endif()
-install(TARGETS vncviewer DESTINATION ${BIN_DIR})
+install(TARGETS vncviewer DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
if(UNIX)
- install(FILES vncviewer.man DESTINATION ${MAN_DIR}/man1 RENAME vncviewer.1)
+ install(FILES vncviewer.man DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man1 RENAME vncviewer.1)
configure_file(vncviewer.desktop.in.in vncviewer.desktop.in)
find_program(INTLTOOL_MERGE_EXECUTABLE intltool-merge)
)
endif()
add_custom_target(desktop ALL DEPENDS vncviewer.desktop)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/vncviewer.desktop DESTINATION ${DATA_DIR}/applications)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/vncviewer.desktop DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/applications)
foreach(res 16 22 24 32 48)
- install(FILES ../media/icons/tigervnc_${res}.png DESTINATION ${DATA_DIR}/icons/hicolor/${res}x${res}/apps RENAME tigervnc.png)
+ install(FILES ../media/icons/tigervnc_${res}.png DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/${res}x${res}/apps RENAME tigervnc.png)
endforeach()
- install(FILES ../media/icons/tigervnc.svg DESTINATION ${DATA_DIR}/icons/hicolor/scalable/apps)
+ install(FILES ../media/icons/tigervnc.svg DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/scalable/apps)
endif()
bool exists;
sprintf(icon_path, "%s/icons/hicolor/%dx%d/apps/tigervnc.png",
- DATA_DIR, icon_sizes[i], icon_sizes[i]);
+ CMAKE_INSTALL_FULL_DATADIR, icon_sizes[i], icon_sizes[i]);
#ifndef WIN32
struct stat st;
argv0 = argv[0];
setlocale(LC_ALL, "");
- bindtextdomain(PACKAGE_NAME, LOCALE_DIR);
+ bindtextdomain(PACKAGE_NAME, CMAKE_INSTALL_FULL_LOCALEDIR);
textdomain(PACKAGE_NAME);
rfb::SecurityClient::setDefaults();
Name=TigerVNC Viewer
GenericName=Remote Desktop Viewer
Comment=Connect to VNC server and display remote desktop
-Exec=@BIN_DIR@/vncviewer
+Exec=@CMAKE_INSTALL_FULL_BINDIR@/vncviewer
Icon=tigervnc
Terminal=false
Type=Application
target_link_libraries(vncconfig rfb_win32 rfb network rdr ws2_32.lib)
install(TARGETS vncconfig
- RUNTIME DESTINATION ${BIN_DIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
)
target_link_libraries(winvnc4 rfb rfb_win32 network rdr ws2_32.lib)
install(TARGETS winvnc4
- RUNTIME DESTINATION ${BIN_DIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
)
set_target_properties(wm_hooks PROPERTIES PREFIX "")
install(TARGETS wm_hooks
- RUNTIME DESTINATION ${BIN_DIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
)