From 3132bcb3732df51c08c8b2f34781e463cd94fe7f Mon Sep 17 00:00:00 2001
From: est31 <MTest31@outlook.com>
Date: Wed, 16 Mar 2016 13:21:34 +0100
Subject: [PATCH] Set EXAMPLE_CONF_DIR to DOCDIR if DOCDIR gets customized

Before, customisation of DOCDIR did not lead to
changes of the EXAMPLE_CONF_DIR default value.
This was inconsistent with expected behaviour
if you didn't know of the existence of the
EXAMPLE_CONF_DIR variable. The confusion is
very strong, as (for not in place builds) both
DOCDIR and EXAMPLE_CONF_DIR share the same
default value, it is unexpected that setting
CUSTOM_DOCDIR changes the location of all
documentation files but one.

The best meaning of EXAMPLE_CONF_DIR is to
further allow customization of the mt.conf.example
storage place, but otherwise keep defaulting to
whatever DOCDIR is set to, at least for not in
place builds. This patch implements that
behaviour.

Fixes #3863.
---
 CMakeLists.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f8278522e..3f853f4dd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,6 +113,9 @@ endif()
 set(CUSTOM_DOCDIR "" CACHE STRING "Directory to install documentation into")
 if(NOT CUSTOM_DOCDIR STREQUAL "")
 	set(DOCDIR "${CUSTOM_DOCDIR}")
+	if(NOT RUN_IN_PLACE)
+		set(EXAMPLE_CONF_DIR ${DOCDIR})
+	endif()
 	message(STATUS "Using DOCDIR=${DOCDIR}")
 endif()
 
-- 
GitLab