--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -258,6 +258,15 @@
 SET(HUGINDATADIR share/hugin)
 SET(DATADIR share)
 SET(BINDIR  bin)
+
+IF("$ENV{MANDIR}")
+	SET (MANDIR "$ENV{MANDIR}")
+ELSEIF(CMAKE_SYSTEM_NAME=="FreeBSD")
+	SET (MANDIR "man")
+ELSE("$ENV{MANDIR}")
+	SET (MANDIR "share/man")
+ENDIF("$ENV{MANDIR}")
+
 SET(LOCALEDIR share/locale) 
 SET(ICONDIR share/icons) 
 SET(LINKDIR share/applications)