Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CMake
CMake
Commits
279605f5
Commit
279605f5
authored
Feb 21, 2015
by
Nils Gladitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CPackWIX: Add installed file properties for the creation of shortcuts.
parent
53d7daff
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
83 additions
and
12 deletions
+83
-12
Help/manual/cmake-properties.7.rst
Help/manual/cmake-properties.7.rst
+2
-0
Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst
Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst
+7
-0
Help/prop_inst/CPACK_START_MENU_SHORTCUTS.rst
Help/prop_inst/CPACK_START_MENU_SHORTCUTS.rst
+7
-0
Source/CPack/WiX/cmCPackWIXGenerator.cxx
Source/CPack/WiX/cmCPackWIXGenerator.cxx
+7
-2
Source/CPack/WiX/cmCPackWIXGenerator.h
Source/CPack/WiX/cmCPackWIXGenerator.h
+1
-1
Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
+9
-4
Source/CPack/WiX/cmWIXFilesSourceWriter.h
Source/CPack/WiX/cmWIXFilesSourceWriter.h
+2
-1
Source/CPack/WiX/cmWIXShortcut.cxx
Source/CPack/WiX/cmWIXShortcut.cxx
+36
-4
Source/CPack/WiX/cmWIXShortcut.h
Source/CPack/WiX/cmWIXShortcut.h
+12
-0
No files found.
Help/manual/cmake-properties.7.rst
View file @
279605f5
...
...
@@ -320,8 +320,10 @@ Properties on Installed Files
.. toctree::
:maxdepth: 1
/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst
/prop_inst/CPACK_NEVER_OVERWRITE.rst
/prop_inst/CPACK_PERMANENT.rst
/prop_inst/CPACK_START_MENU_SHORTCUTS.rst
/prop_inst/CPACK_WIX_ACL.rst
...
...
Help/prop_inst/CPACK_DESKTOP_SHORTCUTS.rst
0 → 100644
View file @
279605f5
CPACK_DESKTOP_SHORTCUTS
-----------------------
Species a list of shortcut names that should be created on the Desktop
for this file.
The property is currently only supported by the WIX generator.
Help/prop_inst/CPACK_START_MENU_SHORTCUTS.rst
0 → 100644
View file @
279605f5
CPACK_START_MENU_SHORTCUTS
--------------------------
Species a list of shortcut names that should be created in the Start Menu
for this file.
The property is currently only supported by the WIX generator.
Source/CPack/WiX/cmCPackWIXGenerator.cxx
View file @
279605f5
...
...
@@ -856,8 +856,8 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
cmWIXDirectoriesSourceWriter
&
directoryDefinitions
,
cmWIXFilesSourceWriter
&
fileDefinitions
,
cmWIXFeaturesSourceWriter
&
featureDefinitions
,
const
std
::
vector
<
std
::
string
>&
packageExecutables
,
const
std
::
vector
<
std
::
string
>&
desktopExecutables
,
std
::
vector
<
std
::
string
>
const
&
packageExecutables
,
std
::
vector
<
std
::
string
>
const
&
desktopExecutables
,
cmWIXShortcuts
&
shortcuts
)
{
cmsys
::
Directory
dir
;
...
...
@@ -943,6 +943,11 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
cmInstalledFile
const
*
installedFile
=
this
->
GetInstalledFile
(
relativePath
);
if
(
installedFile
)
{
shortcuts
.
CreateFromProperties
(
id
,
directoryId
,
*
installedFile
);
}
std
::
string
componentId
=
fileDefinitions
.
EmitComponentFile
(
directoryId
,
id
,
fullPath
,
*
(
this
->
Patch
),
installedFile
);
...
...
Source/CPack/WiX/cmCPackWIXGenerator.h
View file @
279605f5
...
...
@@ -136,7 +136,7 @@ private:
cmWIXDirectoriesSourceWriter
&
directoryDefinitions
,
cmWIXFilesSourceWriter
&
fileDefinitions
,
cmWIXFeaturesSourceWriter
&
featureDefinitions
,
std
::
vector
<
std
::
string
>
const
&
p
kg
Executables
,
std
::
vector
<
std
::
string
>
const
&
p
ackage
Executables
,
std
::
vector
<
std
::
string
>
const
&
desktopExecutables
,
cmWIXShortcuts
&
shortcuts
);
...
...
Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
View file @
279605f5
...
...
@@ -28,16 +28,21 @@ cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger,
void
cmWIXFilesSourceWriter
::
EmitShortcut
(
std
::
string
const
&
id
,
cmWIXShortcut
const
&
shortcut
,
std
::
string
const
&
shortcutPrefix
)
std
::
string
const
&
shortcutPrefix
,
size_t
shortcutIndex
)
{
std
::
string
shortcutId
=
shortcutPrefix
;
std
::
stringstream
shortcutId
;
shortcutId
<<
shortcutPrefix
<<
id
;
shortcutId
+=
id
;
if
(
shortcutIndex
>
0
)
{
shortcutId
<<
"_"
<<
shortcutIndex
;
}
std
::
string
fileId
=
std
::
string
(
"CM_F"
)
+
id
;
BeginElement
(
"Shortcut"
);
AddAttribute
(
"Id"
,
shortcutId
);
AddAttribute
(
"Id"
,
shortcutId
.
str
()
);
AddAttribute
(
"Name"
,
shortcut
.
label
);
std
::
string
target
=
"[#"
+
fileId
+
"]"
;
AddAttribute
(
"Target"
,
target
);
...
...
Source/CPack/WiX/cmWIXFilesSourceWriter.h
View file @
279605f5
...
...
@@ -31,7 +31,8 @@ public:
void
EmitShortcut
(
std
::
string
const
&
id
,
cmWIXShortcut
const
&
shortcut
,
std
::
string
const
&
shortcutPrefix
);
std
::
string
const
&
shortcutPrefix
,
size_t
shortcutIndex
);
void
EmitRemoveFolder
(
std
::
string
const
&
id
);
...
...
Source/CPack/WiX/cmWIXShortcut.cxx
View file @
279605f5
...
...
@@ -62,11 +62,12 @@ bool cmWIXShortcuts::EmitShortcuts(
std
::
string
const
&
id
=
j
->
first
;
shortcut_list_t
const
&
shortcutList
=
j
->
second
;
for
(
s
hortcut_list_t
::
const_iterator
k
=
shortcutList
.
begin
()
;
k
!=
shortcutList
.
end
();
++
k
)
for
(
s
ize_t
shortcutList
Index
=
0
;
shortcutListIndex
<
shortcutList
.
size
();
++
shortcutListIndex
)
{
cmWIXShortcut
const
&
shortcut
=
*
k
;
fileDefinitions
.
EmitShortcut
(
id
,
shortcut
,
shortcutPrefix
);
cmWIXShortcut
const
&
shortcut
=
shortcutList
[
shortcutListIndex
];
fileDefinitions
.
EmitShortcut
(
id
,
shortcut
,
shortcutPrefix
,
shortcutListIndex
);
}
}
...
...
@@ -84,3 +85,34 @@ void cmWIXShortcuts::AddShortcutTypes(std::set<Type>& types)
types
.
insert
(
i
->
first
);
}
}
void
cmWIXShortcuts
::
CreateFromProperties
(
std
::
string
const
&
id
,
std
::
string
const
&
directoryId
,
cmInstalledFile
const
&
installedFile
)
{
CreateFromProperty
(
"CPACK_START_MENU_SHORTCUTS"
,
START_MENU
,
id
,
directoryId
,
installedFile
);
CreateFromProperty
(
"CPACK_DESKTOP_SHORTCUTS"
,
DESKTOP
,
id
,
directoryId
,
installedFile
);
}
void
cmWIXShortcuts
::
CreateFromProperty
(
std
::
string
const
&
propertyName
,
Type
type
,
std
::
string
const
&
id
,
std
::
string
const
&
directoryId
,
cmInstalledFile
const
&
installedFile
)
{
std
::
vector
<
std
::
string
>
list
;
installedFile
.
GetPropertyAsList
(
propertyName
,
list
);
for
(
size_t
i
=
0
;
i
<
list
.
size
();
++
i
)
{
cmWIXShortcut
shortcut
;
shortcut
.
label
=
list
[
i
];
shortcut
.
workingDirectoryId
=
directoryId
;
insert
(
type
,
id
,
shortcut
);
}
}
Source/CPack/WiX/cmWIXShortcut.h
View file @
279605f5
...
...
@@ -18,6 +18,8 @@
#include <set>
#include <vector>
#include <cmInstalledFile.h>
class
cmWIXFilesSourceWriter
;
struct
cmWIXShortcut
...
...
@@ -50,9 +52,19 @@ public:
void
AddShortcutTypes
(
std
::
set
<
Type
>&
types
);
void
CreateFromProperties
(
std
::
string
const
&
id
,
std
::
string
const
&
directoryId
,
cmInstalledFile
const
&
installedFile
);
private:
typedef
std
::
map
<
Type
,
shortcut_id_map_t
>
shortcut_type_map_t
;
void
CreateFromProperty
(
std
::
string
const
&
propertyName
,
Type
type
,
std
::
string
const
&
id
,
std
::
string
const
&
directoryId
,
cmInstalledFile
const
&
installedFile
);
shortcut_type_map_t
Shortcuts
;
shortcut_id_map_t
EmptyIdMap
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment