diff --git a/helloworld-cpp-cmake/.clang-format b/helloworld-cpp-cmake/.clang-format new file mode 100644 index 0000000..8ae9b75 --- /dev/null +++ b/helloworld-cpp-cmake/.clang-format @@ -0,0 +1,14 @@ +BasedOnStyle: WebKit +IndentWidth: 4 +ColumnLimit: 80 +IndentCaseLabels: true +BreakBeforeBraces: Custom +BraceWrapping: + AfterFunction: true + SplitEmptyFunction: false +AlignAfterOpenBracket: BlockIndent +AlignOperands: AlignAfterOperator +BreakBeforeBinaryOperators: true +BinPackArguments: false +BinPackParameters: false + diff --git a/helloworld-cpp-cmake/.gitignore b/helloworld-cpp-cmake/.gitignore new file mode 100644 index 0000000..1be61f5 --- /dev/null +++ b/helloworld-cpp-cmake/.gitignore @@ -0,0 +1,3 @@ +build/ +.cache/ + diff --git a/helloworld-cpp-cmake/CMakeLists.txt b/helloworld-cpp-cmake/CMakeLists.txt new file mode 100644 index 0000000..9f13196 --- /dev/null +++ b/helloworld-cpp-cmake/CMakeLists.txt @@ -0,0 +1,13 @@ + +cmake_minimum_required(VERSION 3.29) +project(MyProject VERSION 1.0.0 LANGUAGES C CXX) + +set(CMAKE_EXPORT_COMPILE_COMMANDS true) + +add_executable( + helloworld-cpp-cmake + src/main.cpp +) + +install(TARGETS helloworld-cpp-cmake) + diff --git a/helloworld-cpp-cmake/README.md b/helloworld-cpp-cmake/README.md new file mode 100644 index 0000000..5afb6c3 --- /dev/null +++ b/helloworld-cpp-cmake/README.md @@ -0,0 +1,20 @@ + +# helloworld-cpp-cmake + +``` +mkdir build +cd build +cmake .. +make +./helloworld-cpp-cmake +``` + +``` +mkdir build +cd build +cmake .. -CMAKE_BUILD_TYPE=Release +make +sudo make install +./helloworld-cpp-cmake +``` + diff --git a/helloworld-cpp-cmake/src/main.cpp b/helloworld-cpp-cmake/src/main.cpp new file mode 100644 index 0000000..158c8d0 --- /dev/null +++ b/helloworld-cpp-cmake/src/main.cpp @@ -0,0 +1,3 @@ +#include + +int main() { std::cout << "Hello, world!\n"; }