diff --git a/dotfiles/bash/scripts/cgen.sh b/dotfiles/bash/scripts/cgen.sh index 6f40b8b..f611dd1 100755 --- a/dotfiles/bash/scripts/cgen.sh +++ b/dotfiles/bash/scripts/cgen.sh @@ -35,8 +35,23 @@ touch $cmake_config echo "cmake_minimum_required(VERSION $cmake_version)" >> $cmake_config echo "project($name)" >> $cmake_config +echo "" >> $cmake_config echo "set (CMAKE_C_STANDARD $c_standard)" >> $cmake_config echo "" >> $cmake_config +echo "# The following lines enable compile_commands.json and dump it in the root of the project" >> $cmake_config +echo "# in order to allow YouCompleteMe to provide completion. You can delete these lines if your" >> $cmake_config +echo "# editor does not need/use \`compile_commands.json\`" >> $cmake_config +echo "" >> $cmake_config +echo "SET(CMAKE_EXPORT_COMPILE_COMMANDS ON)" >> $cmake_config +echo "" >> $cmake_config +echo "IF(EXISTS \"\${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json\")" >> $cmake_config +echo " EXECUTE_PROCESS(COMMAND \${CMAKE_COMMAND} -E copy_if_different" >> $cmake_config +echo " \${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json" >> $cmake_config +echo " \${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json" >> $cmake_config +echo " )" >> $cmake_config +echo "ENDIF()" >> $cmake_config +echo "#-------- END YOUCOMPLETEME SECTION --------#" >> $cmake_config +echo "" >> $cmake_config echo "" >> $cmake_config echo "file(GLOB SOURCE \${PROJECT_SOURCE_DIR}/src/*.c)" >> $cmake_config echo "file(GLOB INCLUDE \${PROJECT_SOURCE_DIR}/include/*.h)" >> $cmake_config @@ -45,7 +60,7 @@ echo "" >> $cmake_config 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 +echo "# Controls debug printing based on the compiled binary mode - check with #ifdef DEBUG_BUILD" >> $cmake_config echo "IF(CMAKE_BUILD_TYPE MATCHES DEBUG)" >> $cmake_config echo "message(\"-- Configuring debug build...\")" >> $cmake_config echo "add_compile_definitions(DEBUG_BUILD)" >> $cmake_config