add helloworld-cpp-cmake

This commit is contained in:
Simon From Jakobsen 2024-08-02 13:41:53 +00:00
parent ceffdfb561
commit 2d29797403
5 changed files with 53 additions and 0 deletions

View File

@ -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

3
helloworld-cpp-cmake/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
build/
.cache/

View File

@ -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)

View File

@ -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
```

View File

@ -0,0 +1,3 @@
#include <iostream>
int main() { std::cout << "Hello, world!\n"; }