Sfoglia il codice sorgente

Merge topic 'rel-win-PATH'

7bd68cf381 Utilities/Release/WiX: Convert PATH modification preference to checkbox
d320c76257 Utilities/Release/WiX: Clarify UI options dialog name
cde0b7c131 Utilities/Release/WiX: Clarify UI dialog order
48d2a7ac62 Utilities/Release/WiX: Backport UI dialog condition fix from WiX 3.11
36ae046ed1 Utilities/Release/WiX: Simplify desktop shortcut condition
9e831a6211 Utilities/Release/WiX: Simplify specification of CMake registry value
68e9454abe Utilities/Release/WiX: Require Windows Installer 5.0

Acked-by: Kitware Robot <[email protected]>
Merge-request: !9381
Brad King 1 anno fa
parent
commit
8ffe1fd22c

+ 2 - 1
CMakeCPackOptions.cmake.in

@@ -265,7 +265,8 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX")
 
   set(CPACK_WIX_EXTRA_SOURCES
     "@CMake_SOURCE_DIR@/Utilities/Release/WiX/install_dir.wxs"
-    "@CMake_SOURCE_DIR@/Utilities/Release/WiX/cmake_extra_dialog.wxs"
+    "@CMake_SOURCE_DIR@/Utilities/Release/WiX/options.wxs"
+    "@CMake_SOURCE_DIR@/Utilities/Release/WiX/options_dlg.wxs"
   )
 
   set(_WIX_CUSTOM_ACTION_ENABLED "@CMake_BUILD_WIX_CUSTOM_ACTION@")

+ 4 - 7
Utilities/Release/WiX/WIX.template.in

@@ -12,7 +12,7 @@
         Manufacturer="$(var.CPACK_PACKAGE_VENDOR)"
         UpgradeCode="$(var.CPACK_WIX_UPGRADE_GUID)">
 
-        <Package InstallerVersion="301" Compressed="yes" InstallScope="perMachine"/>
+        <Package InstallerVersion="500" Compressed="yes" InstallScope="perMachine"/>
 
         <Media Id="1" Cabinet="media1.cab" EmbedCab="yes"/>
 
@@ -39,16 +39,13 @@
         <?endif?>
 
         <DirectoryRef Id="TARGETDIR">
-            <Component Id="CMakeRegistry">
-                <RegistryKey Root="HKLM" Key="Software\Kitware\CMake">
-                    <RegistryValue Type="string" Name="InstallDir"
-                        Value="[INSTALL_ROOT]" KeyPath="yes"/>
-                 </RegistryKey>
+            <Component Id="CMakeRegistry_InstallDir">
+                <RegistryValue Root="HKLM" Key="Software\Kitware\CMake" Name="InstallDir" Type="string" Value="[INSTALL_ROOT]" />
             </Component>
         </DirectoryRef>
 
         <FeatureRef Id="ProductFeature">
-            <ComponentRef Id="CMakeRegistry"/>
+            <ComponentRef Id="CMakeRegistry_InstallDir" />
         </FeatureRef>
 
         <UIRef Id="$(var.CPACK_WIX_UI_REF)" />

+ 7 - 7
Utilities/Release/WiX/install_dir.wxs

@@ -8,7 +8,7 @@
             <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
             <Property Id="WixUI_Mode" Value="InstallDir" />
 
-            <DialogRef Id="CMakeExtraDialog" />
+            <DialogRef Id="CMakeOptionsDlg" />
             <?ifdef CHECK_NSIS ?>
                 <DialogRef Id="CMakeNsisOverwriteDialog" />
             <?endif ?>
@@ -25,7 +25,7 @@
             <DialogRef Id="UserExit" />
 
             <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
-            <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
+            <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
 
             <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
 
@@ -33,9 +33,12 @@
             <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>
 
             <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
-            <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="CMakeExtraDialog">LicenseAccepted = "1"</Publish>
+            <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="CMakeOptionsDlg">LicenseAccepted = "1"</Publish>
 
-            <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="CMakeExtraDialog">1</Publish>
+            <Publish Dialog="CMakeOptionsDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
+            <Publish Dialog="CMakeOptionsDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">1</Publish>
+
+            <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="CMakeOptionsDlg">1</Publish>
             <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
             <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
             <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
@@ -47,9 +50,6 @@
             <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
             <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
 
-            <Publish Dialog="CMakeExtraDialog" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
-            <Publish Dialog="CMakeExtraDialog" Control="Next" Event="NewDialog" Value="InstallDirDlg">1</Publish>
-
             <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1">NOT Installed</Publish>
             <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
             <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>

+ 18 - 0
Utilities/Release/WiX/options.wxs

@@ -0,0 +1,18 @@
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+    <Fragment>
+        <!-- Hold the "CMAKE_IN_PATH" checkbox value in a public property to propagate to the InstallExecuteSequence. -->
+        <Property Id="CMAKE_IN_PATH" Value="Init" />
+
+        <!-- Always initialize the checkbox value so it cannot be directly overridden from the command line.  -->
+        <SetProperty Action="Set_CMAKE_IN_PATH_Init"       Id="CMAKE_IN_PATH" After="AppSearch"                    Sequence="first" Value="{}" />
+
+        <!-- Override the default "CMAKE_IN_PATH" checkbox with a value specified on the command line, if any.  -->
+        <SetProperty Action="Set_CMAKE_IN_PATH_CMD_0"      Id="CMAKE_IN_PATH" After="Set_CMAKE_IN_PATH_Init"       Sequence="first" Value="{}">  ADD_CMAKE_TO_PATH = "0"                     </SetProperty>
+        <SetProperty Action="Set_CMAKE_IN_PATH_CMD_1"      Id="CMAKE_IN_PATH" After="Set_CMAKE_IN_PATH_CMD_0"      Sequence="first" Value="1">   ADD_CMAKE_TO_PATH = "1"                     </SetProperty>
+        <!-- Support legacy values too.  -->
+        <SetProperty Action="Set_CMAKE_IN_PATH_CMD_None"   Id="CMAKE_IN_PATH" After="Set_CMAKE_IN_PATH_CMD_1"      Sequence="first" Value="{}">  ADD_CMAKE_TO_PATH = "None"                  </SetProperty>
+        <SetProperty Action="Set_CMAKE_IN_PATH_CMD_System" Id="CMAKE_IN_PATH" After="Set_CMAKE_IN_PATH_CMD_None"   Sequence="first" Value="1">   ADD_CMAKE_TO_PATH = "System" AND ALLUSERS   </SetProperty>
+        <!-- Per-user installation is not implemented, but reserve the old value for future use.  -->
+        <SetProperty Action="Set_CMAKE_IN_PATH_CMD_User"   Id="CMAKE_IN_PATH" After="Set_CMAKE_IN_PATH_CMD_System" Sequence="first" Value="1">   ADD_CMAKE_TO_PATH = "User" AND NOT ALLUSERS </SetProperty>
+    </Fragment>
+</Wix>

+ 4 - 12
Utilities/Release/WiX/cmake_extra_dialog.wxs → Utilities/Release/WiX/options_dlg.wxs

@@ -1,8 +1,8 @@
 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
     <Fragment>
         <UI>
-            <Property Id="ADD_CMAKE_TO_PATH" Value="None"/>
-            <Dialog Id="CMakeExtraDialog" Width="370" Height="270" Title="Install Options">
+            <PropertyRef Id="CMAKE_IN_PATH" />
+            <Dialog Id="CMakeOptionsDlg" Width="370" Height="270" Title="Install Options">
 
                 <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)"/>
                 <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)"/>
@@ -17,18 +17,10 @@
                 <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0"/>
                 <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0"/>
 
-                <Control Id="Hint" Type="Text" X="26" Y="60" Width="250" Height="16" Transparent="yes" Text="By default CMake does not add its directory to the system PATH."/>
-
-                <Control Id="ADD_CMAKE_TO_PATHOption" Type="RadioButtonGroup" X="26" Y="100" Width="305" Height="65" Property="ADD_CMAKE_TO_PATH">
-                    <RadioButtonGroup Property="ADD_CMAKE_TO_PATH">
-                        <RadioButton Value="None" X="0" Y="0" Width="295" Height="16" Text="Do not add CMake to the system PATH"/>
-                        <RadioButton Value="System" X="0" Y="20" Width="295" Height="16" Text="Add CMake to the system PATH for all users"/>
-                        <RadioButton Value="User" X="0" Y="40" Width="295" Height="16" Text="Add CMake to the system PATH for the current user"/>
-                    </RadioButtonGroup>
-                </Control>
+                <Control Id="CMAKE_IN_PATH_CheckBox" Type="CheckBox" X="20" Y="60" Width="330" Height="18" CheckBoxValue="1" Property="CMAKE_IN_PATH" Text="Add CMake to the PATH environment variable" />
 
                 <?ifdef BUILD_QtDialog ?>
-                    <Control Id="DesktopShortcutCheckBox" Type="CheckBox" X="20" Y="170" Width="330" Height="18" CheckBoxValue="1" Property="DESKTOP_SHORTCUT_REQUESTED" Text="Create CMake Desktop Icon"/>
+                <Control Id="DesktopShortcutCheckBox" Type="CheckBox" X="20" Y="80" Width="330" Height="18" CheckBoxValue="1" Property="DESKTOP_SHORTCUT_REQUESTED" Text="Add CMake shortcut to the Desktop" />
                 <?endif ?>
             </Dialog>
         </UI>

+ 1 - 1
Utilities/Release/WiX/patch_desktop_shortcut.xml

@@ -1,5 +1,5 @@
 <CPackWiXPatch>
   <CPackWiXFragment Id="CM_SHORTCUT_DESKTOP">
-    <Condition>DESKTOP_SHORTCUT_REQUESTED = 1</Condition>
+    <Condition>DESKTOP_SHORTCUT_REQUESTED</Condition>
   </CPackWiXFragment>
 </CPackWiXPatch>

+ 5 - 6
Utilities/Release/WiX/patch_path_env.xml

@@ -1,18 +1,17 @@
 <CPackWiXPatch>
   <CPackWiXFragment Id="CM_DP_bin">
+    <!-- Implement the "CMAKE_IN_PATH" checkbox when installing for all users.  -->
     <Component Id="CMakeSystemPathEntryCMP" KeyPath="yes" Guid="0E782367-5D68-4539-81D1-B9757AE496A1">
-
-      <Condition>ADD_CMAKE_TO_PATH = "System"</Condition>
-
+      <Condition>CMAKE_IN_PATH AND ALLUSERS</Condition>
       <Environment Id="CMakeSystemPathEntryENV" Action="set" Part="last"
         Name="PATH" Value="[INSTALL_ROOT]bin"
         System="yes"/>
     </Component>
 
+    <!-- Implement the "CMAKE_IN_PATH" checkbox when installing per-user.  -->
+    <!-- This is not currently reachable, but is reserved for future use.  -->
     <Component Id="CMakeUserPathEntryCMP" KeyPath="yes" Guid="392E524D-D5BF-4F16-A7AF-A82B07482CB9">
-
-      <Condition>ADD_CMAKE_TO_PATH = "User"</Condition>
-
+      <Condition>CMAKE_IN_PATH AND NOT ALLUSERS</Condition>
       <Environment Id="CMakeUserPathEntryENV" Action="set" Part="last"
         Name="PATH" Value="[INSTALL_ROOT]bin"
         System="no"/>