diff --git a/dotfiles/bash/scripts/cgen.sh b/dotfiles/bash/scripts/cgen.sh index 0b9b7e1..42d4548 100755 --- a/dotfiles/bash/scripts/cgen.sh +++ b/dotfiles/bash/scripts/cgen.sh @@ -40,18 +40,24 @@ echo "project($name)" >> $cmake_config echo "" >> $cmake_config echo "set (CMAKE_C_STANDARD $c_standard)" >> $cmake_config echo "" >> $cmake_config +echo "# Output to bin and lib" >> $cmake_config +echo "set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY \${CMAKE_BINARY_DIR}/lib)" >> $cmake_config +echo "set(CMAKE_LIBRARY_OUTPUT_DIRECTORY \${CMAKE_BINARY_DIR}/lib)" >> $cmake_config +echo "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \${CMAKE_BINARY_DIR}/bin)" >> $cmake_config +echo "" >> $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 "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 "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 "endif()" >> $cmake_config echo "#-------- END YOUCOMPLETEME SECTION --------#" >> $cmake_config echo "" >> $cmake_config echo "" >> $cmake_config