Skip to content

Commit e480913

Browse files
committed
cmake
1 parent 3f9ca1d commit e480913

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

.github/workflows/test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v4
1616
- run: |
17-
g++ -Wall -Wextra -o test source.cpp > compilation.log 2>&1
17+
cmake -S . -B build
18+
cmake --build build > compilation.log 2>&1
1819
- uses: actions/upload-artifact@v4
1920
with:
2021
name: compilation_log
2122
path: compilation.log
22-
- run: ./test
23+
- run: ./build/hello_world
2324

2425
run-notifier:
2526
needs:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
node_modules
22

33
dist/*
4+
5+
build/*

CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cmake_minimum_required(VERSION 3.28)
2+
3+
project(HelloWorld)
4+
5+
set(WARNING_OPTIONS
6+
$<$<CXX_COMPILER_ID:MSVC>:/W4
7+
/WX>
8+
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Wall
9+
-Wextra
10+
-pedantic>
11+
)
12+
13+
add_executable(hello_world source.cpp)
14+
target_compile_options(hello_world PRIVATE ${WARNING_OPTIONS})

0 commit comments

Comments
 (0)