Substitute LLVM's version into the msbuild property file at config time
authorReid Kleckner <reid@kleckner.net>
Thu, 29 Aug 2013 22:09:43 +0000 (22:09 +0000)
committerReid Kleckner <reid@kleckner.net>
Thu, 29 Aug 2013 22:09:43 +0000 (22:09 +0000)
Requires shuffling the CPack code up before add_subdirectory(tools), but
that's where the version settings are anyway.

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

CMakeLists.txt
tools/msbuild/CMakeLists.txt
tools/msbuild/Microsoft.Cpp.Win32.llvm.props [deleted file]
tools/msbuild/Microsoft.Cpp.Win32.llvm.props.in [new file with mode: 0644]

index 56adcf335d4b8b004ac74e663582c776d5ad5e3a..ee7a70236518e9c0ba1a7018875c45a5a7866e18 100644 (file)
@@ -35,6 +35,27 @@ set(PACKAGE_NAME LLVM)
 set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
 set(PACKAGE_BUGREPORT "http://llvm.org/bugs/")
 
+# Configure CPack.
+set(CPACK_PACKAGE_VENDOR "LLVM")
+set(CPACK_PACKAGE_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
+set(CPACK_PACKAGE_VERSION_MINOR ${LLVM_VERSION_MINOR})
+if( LLVM_APPEND_VC_REV )
+  add_version_info_from_vcs(CPACK_PACKAGE_VERSION_PATCH)
+else()
+  set(CPACK_PACKAGE_VERSION_PATCH "svn")
+endif()
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.TXT")
+if(WIN32 AND NOT UNIX)
+  set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\nsis_logo.bmp")
+  set(CPACK_NSIS_MODIFY_PATH "ON")
+  set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON")
+  set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
+    "ExecWait '$INSTDIR/tools/msbuild/install.bat'")
+  set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
+    "ExecWait '$INSTDIR/tools/msbuild/uninstall.bat'")
+endif()
+include(CPack)
+
 # Sanity check our source directory to make sure that we are not trying to
 # generate an in-tree build (unless on MSVC_IDE, where it is ok), and to make
 # sure that we don't have any stray generated files lying around in the tree
@@ -500,26 +521,6 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
     )
 endif()
 
-set(CPACK_PACKAGE_VENDOR "LLVM")
-set(CPACK_PACKAGE_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
-set(CPACK_PACKAGE_VERSION_MINOR ${LLVM_VERSION_MINOR})
-if( LLVM_APPEND_VC_REV )
-  add_version_info_from_vcs(CPACK_PACKAGE_VERSION_PATCH)
-else()
-  set(CPACK_PACKAGE_VERSION_PATCH "svn")
-endif()
-set(CPACK_RESOURCE_FILE_LICENSE "${LLVM_MAIN_SRC_DIR}/LICENSE.TXT")
-if(WIN32 AND NOT UNIX)
-  set(CPACK_PACKAGE_ICON "${LLVM_MAIN_SRC_DIR}\\\\cmake\\\\nsis_logo.bmp")
-  set(CPACK_NSIS_MODIFY_PATH "ON")
-  set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON")
-  set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
-    "ExecWait '$INSTDIR/tools/msbuild/install.bat'")
-  set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
-    "ExecWait '$INSTDIR/tools/msbuild/uninstall.bat'")
-endif()
-include(CPack)
-
 # Workaround for MSVS10 to avoid the Dialog Hell
 # FIXME: This could be removed with future version of CMake.
 if(MSVC_VERSION EQUAL 1600)
index a1dca8aca8db3b20d021631a3fe1ab76db491109..393b22a72cc640b2b93a787af5df1f2fc2521d12 100644 (file)
@@ -1,9 +1,15 @@
 if (WIN32)
+  set(prop_file "Microsoft.Cpp.Win32.llvm.props")
+
+  # CPack will install a registry key in this format that we wish to reference.
+  set(REG_KEY "${CMAKE_PROJECT_NAME} ${CPACK_PACKAGE_VERSION}")
+  configure_file(${prop_file}.in ${prop_file})
+  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${prop_file}" DESTINATION tools/msbuild)
+
   install(DIRECTORY .
     DESTINATION tools/msbuild
     FILES_MATCHING
     PATTERN "*.targets"
-    PATTERN "*.props"
     PATTERN "*.bat"
     PATTERN ".svn" EXCLUDE
     )
diff --git a/tools/msbuild/Microsoft.Cpp.Win32.llvm.props b/tools/msbuild/Microsoft.Cpp.Win32.llvm.props
deleted file mode 100644 (file)
index 12938f4..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  \r
-  <Import Project="$(VCTargetsPath)\Platforms\$(Platform)\PlatformToolsets\v100\Microsoft.Cpp.$(Platform).v100.props"/>\r
-\r
-  <PropertyGroup>\r
-    <ClangInstallDir>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\LLVM\LLVM 3.4.svn)</ClangInstallDir>\r
-    <ClangInstallDir Condition="'$(ClangInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\LLVM\LLVM 3.4.svn)</ClangInstallDir>\r
-    <ExecutablePath>$(ClangInstallDir)\msbuild-bin;$(ExecutablePath)</ExecutablePath>\r
-  </PropertyGroup>\r
-</Project>\r
diff --git a/tools/msbuild/Microsoft.Cpp.Win32.llvm.props.in b/tools/msbuild/Microsoft.Cpp.Win32.llvm.props.in
new file mode 100644 (file)
index 0000000..0f474c0
--- /dev/null
@@ -0,0 +1,9 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  \r
+  <Import Project="$(VCTargetsPath)\Platforms\$(Platform)\PlatformToolsets\v100\Microsoft.Cpp.$(Platform).v100.props"/>\r
+\r
+  <PropertyGroup>\r
+    <LLVMInstallDir>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\LLVM\@REG_KEY@)</LLVMInstallDir>\r
+    <LLVMInstallDir Condition="'$(LLVMInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\LLVM\@REG_KEY@)</LLVMInstallDir>\r
+    <ExecutablePath>$(LLVMInstallDir)\msbuild-bin;$(ExecutablePath)</ExecutablePath>\r
+  </PropertyGroup>\r
+</Project>\r