summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-02-03 16:10:58 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-02-03 16:10:58 (GMT)
commita7f5a6ee12872135ef9b153ba5bce54012d4b926 (patch)
tree91ae36e0985872672f51e0c66e5dbf5023da95c1 /Modules
parentee8e63d0c46f687e320796a851c9696770739df4 (diff)
parent41d2f2c4cbf41bfe3ba7118c1fea0ed5e2f5f683 (diff)
downloadCMake-a7f5a6ee12872135ef9b153ba5bce54012d4b926.zip
CMake-a7f5a6ee12872135ef9b153ba5bce54012d4b926.tar.gz
CMake-a7f5a6ee12872135ef9b153ba5bce54012d4b926.tar.bz2
Merge topic 'project-version-variables'
41d2f2c4 write_basic_package_version_file: use PROJECT_VERSION 7e142c5a project: Manage VERSION variables 16d040c9 project: Add optional LANGUAGES keyword 00007dcc Help: Format project command and variable documentation
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake5
-rw-r--r--Modules/WriteBasicConfigVersionFile.cmake8
2 files changed, 10 insertions, 3 deletions
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index f388fe0..473bbe5 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -99,7 +99,7 @@
#
# ::
#
-# WRITE_BASIC_PACKAGE_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) )
+# WRITE_BASIC_PACKAGE_VERSION_FILE( filename [VERSION major.minor.patch] COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) )
#
#
#
@@ -112,6 +112,9 @@
# filename is the output filename, it should be in the build tree.
# major.minor.patch is the version number of the project to be installed
#
+# If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable
+# is used. If this hasn't been set, it errors out.
+#
# The COMPATIBILITY mode AnyNewerVersion means that the installed
# package version will be considered compatible if it is newer or
# exactly the same as the requested version. This mode should be used
diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake
index 95187b4..7d28e95 100644
--- a/Modules/WriteBasicConfigVersionFile.cmake
+++ b/Modules/WriteBasicConfigVersionFile.cmake
@@ -6,7 +6,7 @@
#
# ::
#
-# WRITE_BASIC_CONFIG_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion) )
+# WRITE_BASIC_CONFIG_VERSION_FILE( filename [VERSION major.minor.patch] COMPATIBILITY (AnyNewerVersion|SameMajorVersion) )
#
#
#
@@ -46,7 +46,11 @@ function(WRITE_BASIC_CONFIG_VERSION_FILE _filename)
endif()
if("${CVF_VERSION}" STREQUAL "")
- message(FATAL_ERROR "No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()")
+ if ("${PROJECT_VERSION}" STREQUAL "")
+ message(FATAL_ERROR "No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()")
+ else()
+ set(CVF_VERSION "${PROJECT_VERSION}")
+ endif()
endif()
configure_file("${versionTemplateFile}" "${_filename}" @ONLY)