-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmake-clean
executable file
·44 lines (35 loc) · 1.01 KB
/
cmake-clean
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
#!/usr/bin/tclsh
# Start with the current directory and see if you have CMakeCache.txt
set cmakefiles {
CMakeCache.txt
CMakeFiles
cmake_install.cmake
Makefile
}
set topdir ""
if { [file exists CMakeCache.txt] } {
# Load the cache and look for the toplevel directory.
set fd [open CMakeCache.txt r]
#CMAKE_HOME_DIRECTORY:INTERNAL=/home/sektor/repos/srt.stable
set lines [split [read $fd] \n]
close $fd
foreach l $lines {
set value [join [lassign [split $l =] key] =]
if { $key == "CMAKE_HOME_DIRECTORY:INTERNAL" } {
set topdir $value
break
}
}
}
if { $topdir != "" && $topdir != [pwd] && [file exists $topdir/CMakeCache.txt] } {
puts " ****** WARNING ********* "
puts "*** Found cmake build files in toplevel directory: $topdir"
puts "*** Your cmake call here will reuse it, instead of recreating the build files here."
puts "*** Do clean also in there, if necessary."
}
if { [file exists Makefile] } {
catch {exec >@stdout 2>@stderr make clean}
}
foreach e $cmakefiles {
file delete -force $e
}