1+ --
2+ -- test_target_name.lua
3+ -- Test target names.
4+ -- Author: Nick Clark
5+ -- Copyright (c) 2026 Jess Perkins and the Premake project
6+ --
7+
8+ local p = premake
9+ local suite = test .declare (" vstudio_vs2010_target_name" )
10+ local vc2010 = p .vstudio .vc2010
11+
12+ --
13+ -- Setup
14+ --
15+
16+ local wks , prj
17+
18+ function suite .setup ()
19+ p .action .set (" vs2010" )
20+ wks , prj = test .createWorkspace ()
21+ end
22+
23+ local function prepare (platform )
24+ local cfg = test .getconfig (prj , " Debug" , platform )
25+ vc2010 .targetName (cfg )
26+ end
27+
28+
29+ --
30+ -- Default target name is the project name
31+ --
32+
33+ function suite .defaultTargetName ()
34+ prepare ()
35+ test .capture [[
36+ <TargetName>MyProject</TargetName>
37+ ]]
38+ end
39+
40+
41+ function suite .targetWithSuffix ()
42+ targetsuffix " _suffix"
43+
44+ prepare ()
45+ test .capture [[
46+ <TargetName>MyProject_suffix</TargetName>
47+ ]]
48+ end
49+
50+
51+ --
52+ -- Target name with targetsuffix with AARCH architecture
53+ --
54+
55+ function suite .targetWithAarch64FilterSuffix ()
56+ architecture " AARCH64"
57+
58+ filter { " architecture:AARCH64" } -- Fails if it is set to ARM64
59+ targetsuffix " _ARM64"
60+
61+ prepare ()
62+ test .capture [[
63+ <TargetName>MyProject_ARM64</TargetName>
64+ ]]
65+ end
66+
67+
68+ --
69+ -- Target name with targetsuffix with ARM64 architecture
70+ --
71+
72+ function suite .targetWithArm64FilterSuffix ()
73+ architecture " ARM64"
74+
75+ filter { " architecture:ARM64" } -- Should match when architecture is AARCH64
76+ targetsuffix " _ARM64"
77+
78+ prepare ()
79+ test .capture [[
80+ <TargetName>MyProject_ARM64</TargetName>
81+ ]]
82+ end
83+
84+
85+ --
86+ -- Target name with targetsuffix and x64 architecture
87+ --
88+
89+ function suite .targetWithX64FilterSuffix ()
90+ architecture " x64"
91+
92+ filter { " architecture:x64" }
93+ targetsuffix " _x64"
94+
95+ prepare ()
96+ test .capture [[
97+ <TargetName>MyProject_x64</TargetName>
98+ ]]
99+ end
100+
101+
102+ --
103+ -- Target name with targetprefix
104+ --
105+
106+ function suite .targetWithPrefix ()
107+ targetprefix " lib"
108+
109+ prepare ()
110+ test .capture [[
111+ <TargetName>libMyProject</TargetName>
112+ ]]
113+ end
114+
115+
116+ --
117+ -- Target name with targetprefix and targetsuffix
118+ --
119+
120+ function suite .targetWithPrefixAndSuffix ()
121+ targetprefix " lib"
122+ targetsuffix " _suffix"
123+
124+ prepare ()
125+ test .capture [[
126+ <TargetName>libMyProject_suffix</TargetName>
127+ ]]
128+ end
0 commit comments