[CMake] Make LLVM_VERSION_* variables user definable
authorChris Bieneman <beanz@apple.com>
Wed, 14 Oct 2015 21:50:09 +0000 (21:50 +0000)
committerChris Bieneman <beanz@apple.com>
Wed, 14 Oct 2015 21:50:09 +0000 (21:50 +0000)
CMake's set command overwrites existing values. Package maintainers may want or need to set the version variables manually, so we need to only set them if they are not already defined. Note I use the "if(NOT DEFINED ...)" syntax deliberately in the last case because empty string is a valid value for the suffx, but not the other variables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250333 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt

index a1713fbb8f99435d837ed0f21fb816b7e30f108e..82e937e7adecec4befe7ed277c4f7f8c1131606f 100644 (file)
@@ -26,10 +26,18 @@ else()
   set(cmake_3_2_USES_TERMINAL USES_TERMINAL)
 endif()
 
-set(LLVM_VERSION_MAJOR 3)
-set(LLVM_VERSION_MINOR 8)
-set(LLVM_VERSION_PATCH 0)
-set(LLVM_VERSION_SUFFIX svn)
+if(NOT LLVM_VERSION_MAJOR)
+  set(LLVM_VERSION_MAJOR 3)
+endif()
+if(NOT LLVM_VERSION_MINOR)
+  set(LLVM_VERSION_MINOR 8)
+endif()
+if(NOT LLVM_VERSION_PATCH)
+  set(LLVM_VERSION_PATCH 0)
+endif()
+if(NOT DEFINED LLVM_VERSION_SUFFIX)
+  set(LLVM_VERSION_SUFFIX svn)
+endif()
 
 if (POLICY CMP0048)
   cmake_policy(SET CMP0048 NEW)