refactored the cmake function
This commit is contained in:
parent
1788aa2dd7
commit
c430835855
15
otto.sh
15
otto.sh
|
@ -24,6 +24,13 @@ does_module_exist () {
|
|||
fi
|
||||
}
|
||||
|
||||
add_module_to_cmakes () {
|
||||
local basename="$1"
|
||||
|
||||
cat "add_subdirectory(${basename})" >> ./src/CmakeLists.txt
|
||||
cat "add_subdirectory(${basename})" >> ./tests/CmakeLists.txt
|
||||
}
|
||||
|
||||
add_new_module () {
|
||||
read -p "Enter the name of the module:" modname
|
||||
|
||||
|
@ -53,6 +60,9 @@ add_new_module () {
|
|||
sed "s/module_name/${modname}/" $MODULE_DIR/test_module_name.c > $modtest_dir/test_${modname}.c
|
||||
sed "s/module_name/${modname}/" $MODULE_DIR/TestCMakeLists.txt > $modtest_dir/CMakeLists.txt
|
||||
|
||||
# Add the module to the cmake lists files.
|
||||
add_module_to_cmakes "${modname}"
|
||||
|
||||
echo "Resulting files/dirs:"
|
||||
tree -L 2 $modsrc_dir
|
||||
tree -L 2 $modtest_dir
|
||||
|
@ -62,8 +72,11 @@ add_new_module () {
|
|||
git add ${modsrc_dir}
|
||||
git add ${modtest_dir}/*
|
||||
git add ${modtest_dir}
|
||||
git add ./src/CMakeLists.txt
|
||||
git add ./tests/CMakeLists.txt
|
||||
|
||||
#del_module
|
||||
|
||||
del_module
|
||||
}
|
||||
|
||||
del_module () {
|
||||
|
|
Loading…
Reference in New Issue