diff --git a/scripts/fish-completion/dub.fish b/scripts/fish-completion/dub.fish
index bda55ed..1ed8fb8 100644
--- a/scripts/fish-completion/dub.fish
+++ b/scripts/fish-completion/dub.fish
@@ -48,6 +48,7 @@
 	complete -c dub -n "contains '$cmd' (commandline -poc)" -s c -l config             -r -d "Build configuration"
 	complete -c dub -n "contains '$cmd' (commandline -poc)" -s a -l arch               -r -d "Force architecture"
 	complete -c dub -n "contains '$cmd' (commandline -poc)" -s d -l debug              -r -d "Debug identifier"
+	complete -c dub -n "contains '$cmd' (commandline -poc)" -s d -l d-version          -r -d "Version identifier"
 	complete -c dub -n "contains '$cmd' (commandline -poc)"      -l nodeps                -d "No dependency check"
 	complete -c dub -n "contains '$cmd' (commandline -poc)" -s b -l build           -u -x -d "Build type"                        -a "debug plain release release-debug release-nobounds unittest profile profile-gc docs ddox cov cov-ctfe unittest-cov unittest-cov-ctfe syntax"
 	complete -c dub -n "contains '$cmd' (commandline -poc)"      -l build-mode         -x -d "How compiler & linker are invoked" -a "separate allAtOnce singleFile"
diff --git a/scripts/zsh-completion/_dub b/scripts/zsh-completion/_dub
index 21457f0..4550cd8 100644
--- a/scripts/zsh-completion/_dub
+++ b/scripts/zsh-completion/_dub
@@ -153,6 +153,7 @@
     '--compiler=[Specifies the compiler binary to use (can be a path)]:compiler:(dmd gdc ldc gdmd ldmd)' \
     '(-a --arch)'{-a,--arch=}'[Force a different architecture (e.g. x86 or x86_64)]:architecture: ' \
     '(-d --debug)*'{-d,--debug=}'[Define the specified debug version identifier when building]:Debug version: ' \
+    '--d-version=[Define the specified version identifier when building]:Version identifier: ' \
     '--nodeps[Do not resolve missing dependencies before building]' \
     '--build-mode=[Specifies the way the compiler and linker are invoked]:build mode:("separate (default)" allAtOnce singleFile)' \
     '--single[Treats the package name as a filename. The file must contain a package recipe comment]:file:_files -g "*.d"' \
diff --git a/source/dub/commandline.d b/source/dub/commandline.d
index ca5a552..56edc9d 100644
--- a/source/dub/commandline.d
+++ b/source/dub/commandline.d
@@ -1041,6 +1041,7 @@
 		string m_compilerName;
 		string m_arch;
 		string[] m_debugVersions;
+		string[] m_dVersions;
 		string[] m_overrideConfigs;
 		GeneratorSettings baseSettings;
 		string m_defaultConfig;
@@ -1071,7 +1072,12 @@
 			"Force a different architecture (e.g. x86 or x86_64)"
 		]);
 		args.getopt("d|debug", &m_debugVersions, [
-			"Define the specified debug version identifier when building - can be used multiple times"
+			"Define the specified `debug` version identifier when building - can be used multiple times"
+		]);
+		args.getopt("d-version", &m_dVersions, [
+			"Define the specified `version` identifier when building - can be used multiple times.",
+			"Use sparingly, with great power comes great responsibility! For commonly used or combined versions "
+				~ "and versions that dependees should be able to use, create configurations in your package."
 		]);
 		args.getopt("nodeps", &m_nodeps, [
 			"Do not resolve missing dependencies before building"
@@ -1114,6 +1120,7 @@
 		this.baseSettings.compiler = getCompiler(m_compilerName);
 		this.baseSettings.platform = this.baseSettings.compiler.determinePlatform(this.baseSettings.buildSettings, m_compilerName, m_arch);
 		this.baseSettings.buildSettings.addDebugVersions(m_debugVersions);
+		this.baseSettings.buildSettings.addVersions(m_dVersions);
 
 		m_defaultConfig = null;
 		enforce (loadSpecificPackage(dub, package_name, ver), "Failed to load package.");
diff --git a/test/d-versions.sh b/test/d-versions.sh
new file mode 100755
index 0000000..f9e7da8
--- /dev/null
+++ b/test/d-versions.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+. $(dirname "${BASH_SOURCE[0]}")/common.sh
+cd ${CURR_DIR}/d-versions
+${DUB} build --d-version=FromCli1 --d-version=FromCli2
diff --git a/test/d-versions/.gitignore b/test/d-versions/.gitignore
new file mode 100644
index 0000000..d4b51c6
--- /dev/null
+++ b/test/d-versions/.gitignore
@@ -0,0 +1 @@
+d-versions
diff --git a/test/d-versions/.no_build b/test/d-versions/.no_build
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/d-versions/.no_build
diff --git a/test/d-versions/.no_run b/test/d-versions/.no_run
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/d-versions/.no_run
diff --git a/test/d-versions/.no_test b/test/d-versions/.no_test
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/d-versions/.no_test
diff --git a/test/d-versions/dub.sdl b/test/d-versions/dub.sdl
new file mode 100644
index 0000000..28fc0c9
--- /dev/null
+++ b/test/d-versions/dub.sdl
@@ -0,0 +1 @@
+name "d-versions"
diff --git a/test/d-versions/source/app.d b/test/d-versions/source/app.d
new file mode 100644
index 0000000..d9bd605
--- /dev/null
+++ b/test/d-versions/source/app.d
@@ -0,0 +1,16 @@
+version (FromCli1)
+	enum has1 = true;
+else
+	enum has1 = false;
+
+version (FromCli2)
+	enum has2 = true;
+else
+	enum has2 = false;
+
+static assert(has1);
+static assert(has2);
+
+void main()
+{
+}