From 247f799746c7710bb335cbe622b454e3dbeccd90 Mon Sep 17 00:00:00 2001 From: Taylor Bockman Date: Thu, 19 Dec 2019 21:14:05 -0800 Subject: [PATCH] cgen.sh now writes a valid CMake C project --- dotfiles/bash/scripts/cgen.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) mode change 100644 => 100755 dotfiles/bash/scripts/cgen.sh diff --git a/dotfiles/bash/scripts/cgen.sh b/dotfiles/bash/scripts/cgen.sh old mode 100644 new mode 100755 index e7e3b48..ef4569b --- a/dotfiles/bash/scripts/cgen.sh +++ b/dotfiles/bash/scripts/cgen.sh @@ -15,12 +15,13 @@ fi if [ -z $cmake_version ] then echo "No CMake version supplied...defaulting to 3.15" - $cmake_version="3.15" + cmake_version="3.15" fi if [ -z $c_standard ] then echo "No C Standard supplied...defaulting to 99" + c_standard="99" fi mkdir $name @@ -32,16 +33,16 @@ cmake_config=$name/CMakeLists.txt touch $cmake_config -echo "cmake_minimum_required(VERSION $version)" >> $cmake_config +echo "cmake_minimum_required(VERSION $cmake_version)" >> $cmake_config echo "project($name)" >> $cmake_config echo "set (CMAKE_C_STANDARD $c_standard)" >> $cmake_config echo "" >> $cmake_config echo "" >> $cmake_config -echo "file(GLOB SOURCE \${PROJECT_SOURCE_DIR}/src/*.c)" -echo "file(GLOB INCLUDE \${PROJECT_SOURCE_DIR}/include/*.h)" +echo "file(GLOB SOURCE \${PROJECT_SOURCE_DIR}/src/*.c)" >> $cmake_config +echo "file(GLOB INCLUDE \${PROJECT_SOURCE_DIR}/include/*.h)" >> $cmake_config echo "" >> $cmake_config echo "" >> $cmake_config -echo "include_directories(\${PROJECT_SOURCE_DIR}/include)" +echo "include_directories(\${PROJECT_SOURCE_DIR}/include)" >> $cmake_config echo "" >> $cmake_config echo "" >> $cmake_config echo "# Controls debug printing based on the compiled binary mode - check with \#ifdef DEBUG_BUILD" >> $cmake_config @@ -59,7 +60,7 @@ echo "" echo "" echo "int main(int argc, char **argv)" >> $sample_file echo "{" >> $sample_file -echo " printf(\"Hello, world!\\n\")" >> $sample_file +echo " printf(\"Hello, world!\\n\");" >> $sample_file echo " return 0;" >> $sample_file echo "}" >> $sample_file echo "" >> $sample_file