File: HowToCreateTheCMakeCaseConversion.txt

package info (click to toggle)
insighttoolkit4 4.13.3withdata-dfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 489,260 kB
  • sloc: cpp: 557,342; ansic: 146,850; fortran: 34,788; python: 16,572; sh: 2,187; lisp: 2,070; tcl: 993; java: 362; perl: 200; makefile: 129; csh: 81; pascal: 69; xml: 19; ruby: 10
file content (39 lines) | stat: -rw-r--r-- 1,189 bytes parent folder | download | duplicates (9)
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
This is documentation for the process to convert all
CMakeLists.txt files to lower case format (as seems
to be the default style in all recent documentation).



Step #1:

Determine all the cmake commands:
TMP_DIR=/tmp
cmake --help-command-list > ${TMP_DIR}/firstpass_script.vi

Step #2:
Use vim to convert the list into a vim compliant script file that can be
applied to each file:

Open firstpass_script.vi in vim, and issue the following substitution:
vim ${TMP_DIR}/firstpass_script.vi
:%s/^\(.*\)/:%s#\\<\U\1\\> *(#\l\1(#\ge/ge
<<< Add ":%s/  *$//ge" to remove end of line spaces.
<<< Add ":wqa" to end of the vim script >>>
<<< Add ":%s#\<SUBDIRS\> *(#add_subdirectory(#ge" >>>
:w! /tmp/convert_cmake_to_lowercase.vim

This will create a file that is suitable for using as
a vim batch script.

Step #3:  Make list of files to convert

cd ITK
FILESTOCONVERT=/tmp/FileToConvert
find . -name CMakeLists.txt |grep -v Utilities > ${FILESTOCONVERT}
find . -name "*.cmake*"     |grep -v Utilities >>${FILESTOCONVERT}
ls Utilities/CMakeLists.txt >> ${FILESTOCONVERT}

for ff in $(cat ${FILESTOCONVERT}); do
  echo "PROCESSING $ff"
  vim -S ${TMP_DIR}/convert_cmake_to_lowercase.vim $ff
done