blob: 6f0aa106dea9fef11dfcc3a7bbc8973b7e0da160 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
package CMakeWorkspaceCreator;
# ************************************************************
# Description : A CMake Workspace creator
# Author : Chad Elliott
# Create Date : 10/10/2022
# ************************************************************
# ************************************************************
# Pragmas
# ************************************************************
use strict;
use File::Basename;
use CMakeProjectCreator;
use WorkspaceCreator;
use vars qw(@ISA);
@ISA = qw(WorkspaceCreator);
# ************************************************************
# Subroutine Section
# ************************************************************
sub write_and_compare_file {
my($self, $outdir, $oname, $func, @params) = @_;
my $status = 1;
my $errorString = '';
## Rename the first (and hopefully the only) project in the directory to what
## CMake expects.
my %dirs;
foreach my $entry (@{$self->get_projects()}) {
my $dir = dirname($entry);
if (!exists $dirs{$dir}) {
## Keep track of the project existing in this directory
$dirs{$dir} = 1;
## Rename the project file to CMakeLists.txt and if it fails, we need to
## propagate that back to the caller.
if (rename($entry, "$dir/CMakeLists.txt") == 0) {
$status = 0;
$errorString = "Unable to rename $entry";
last;
}
}
else {
$self->warning("Multiple projects in the same workspace are not supported");
}
}
return $status, $errorString;
}
1;
|