Skip to content

Commit 9d952ea

Browse files
authored
updated commands (#46)
add clean and build_dir tasks now only updating git submodule if building with testing enabled
1 parent 2bed08e commit 9d952ea

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,9 @@ set(CMAKE_CXX_STANDARD 20)
55
set(CMAKE_CXX_STANDARD_REQUIRED True)
66
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
77

8-
# Update submodules
9-
include(cmake/UpdateSubmodules.cmake)
10-
118
# Include directories
129
include_directories(${CMAKE_SOURCE_DIR}/src)
1310

14-
# CTest - GoogleTest
15-
include(CTest)
16-
add_subdirectory(external/googletest EXCLUDE_FROM_ALL)
17-
1811
# Main executable
1912
add_executable(taskr src/main.cpp)
2013

@@ -23,6 +16,13 @@ add_executable(taskr src/main.cpp)
2316
# Disable testing: cmake -B build -S . -DBUILD_TESTING=OFF
2417
# Enable testing: cmake -B build -S . -DBUILD_TESTING=ON
2518
if (BUILD_TESTING)
19+
# Update submodules
20+
include(cmake/UpdateSubmodules.cmake)
21+
# CTest - GoogleTest
22+
include(CTest)
23+
add_subdirectory(external/googletest EXCLUDE_FROM_ALL)
24+
25+
2626
add_executable(taskr_tests
2727
tests/test.cpp
2828
tests/test_errors.cpp

taskrfile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1+
task _build_dir:
2+
run = mkdir -p build
3+
4+
task clean:
5+
run = rm -rf build bin .cache
6+
desc = cleans directories
7+
18
task generate:
29
run = cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_TESTING=ON
310
desc = generates build files with testing
411
alias = g
12+
needs = clean, _build_dir
513

614
task generate_r:
715
run = cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF
816
desc = generates with release flag and without testing
17+
needs = clean, _build_dir
918

1019
task build:
1120
run = cmake --build build -j
@@ -19,13 +28,8 @@ task test:
1928
alias = t
2029

2130
task install:
22-
run = sudo cmake --install build
23-
desc = installs the taskr binary
24-
needs = generate, build
25-
alias = i
26-
27-
task install_r:
2831
run = sudo cmake --install build
2932
desc = installs the taskr release binary
3033
needs = generate_r, build
31-
alias = ir
34+
alias = i
35+

0 commit comments

Comments
 (0)