[CMake] Set Policy CMP0048 to NEW
authorChris Bieneman <beanz@apple.com>
Wed, 14 Oct 2015 07:37:00 +0000 (07:37 +0000)
committerChris Bieneman <beanz@apple.com>
Wed, 14 Oct 2015 07:37:00 +0000 (07:37 +0000)
commit4bf6258b01ea77d8d8f89a7ca7c22bbab19ca2ae
tree7610c836eac99ebb8504870d095842620f35e911
parent69cda669632c0c8f594957afca8f9e1a600c662f
[CMake] Set Policy CMP0048 to NEW

CMake 3.0 introduced the VERSION option for the project() command. If you don't specify the VERSION in the function it will clear out variables matching ${PROJECT_NAME}_VERSION_${MAJOR|MINOR|PATCH|TWEAK}.

This makes overriding LLVM_VERSION_* not work properly with newer versions of CMake. To make this work properly we need to:

(1) Optionally set the policy to NEW
(2) Move default versions and setting PACKAGE_VERSION to before the call to project()
(3) If the policy is set, pass the VERSION and LANGUAGES options in the new format

This change should have no behavioral change for CMake versions before 3.0, and it makes the behavior of later versions match the earlier versions.

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