 CMakeLists.txt | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 29d66f3..1c08cdd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -244,19 +244,21 @@ else()
 endif()
 
 #SHARE - use the default on Apple as TAG_VERSION is empty
-if(WIN32 OR OS2)
-	set(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/")
-else()
-	if(TAG_VERSION OR BUILD_OSX_BUNDLE)
-		set(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${MAIN_DIR_NAME}${TAG_VERSION}/")
-	else()
-		if(NOT WANT_VERSIONING)
-			set(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${MAIN_DIR_NAME}/")
-		else()
-			set(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${MAIN_DIR_NAME}-${VERSION}/")
-		endif()
-	endif()
-endif()
+if(NOT DOCDIR)
+	if(WIN32 OR OS2)
+		set(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/")
+	else()
+		if(TAG_VERSION OR BUILD_OSX_BUNDLE)
+			set(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${MAIN_DIR_NAME}${TAG_VERSION}/")
+		else()
+			if(NOT WANT_VERSIONING)
+				set(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${MAIN_DIR_NAME}/")
+			else()
+				set(DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${MAIN_DIR_NAME}-${VERSION}/")
+			endif()
+		endif()
+	endif()
+endif()
 if(NOT IS_ABSOLUTE ${DOCDIR})
 	add_definitions("-DDOCDIR=\\\"${CMAKE_INSTALL_PREFIX}/${DOCDIR}\\\"")
 else()
