Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c8aa76a

Browse files
CMake - tests
1 parent 8f03129 commit c8aa76a

File tree

3 files changed

+37
-4
lines changed

3 files changed

+37
-4
lines changed

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@ _deps
4040
test/Makefile
4141
test/lib
4242
runTests
43+
build
4344

4445
!dist/*

‎CMakeLists.txt‎

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.17)
1+
cmake_minimum_required(VERSION 3.16)
22

33
project(string_utils)
44

@@ -8,6 +8,10 @@ set (CMAKE_CXX_FLAGS "--coverage")
88
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
99
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
1010
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
11+
set(DIST ${PROJECT_SOURCE_DIR}/dist)
12+
set(BINARY ${PROJECT_SOURCE_DIR}/bin)
13+
set(INCLUDE ${PROJECT_SOURCE_DIR}/include)
14+
set(TESTDIR ${PROJECT_SOURCE_DIR}/test)
1115

1216
# Google testing framework
1317
include(FetchContent)
@@ -27,8 +31,35 @@ include_directories("${PROJECT_SOURCE_DIR}/test")
2731
set(string_utils_sources
2832
src/wniemiec/util/cpp/StringUtils.cpp
2933
)
34+
file(GLOB test_files
35+
"test/wniemiec/util/cpp/*.cpp"
36+
)
37+
add_executable(string_utils ${string_utils_sources} ${test_files})
3038

31-
add_executable(string_utils ${string_utils_sources})
39+
add_custom_target(dist
40+
COMMAND rm -rf ${DIST};
41+
mkdir ${DIST};
42+
cp ${BINARY}/StringUtils.o ${DIST};
43+
cp ${INCLUDE}/wniemiec/util/cpp/StringUtils.hpp ${DIST};
44+
)
45+
add_custom_target(clean-all
46+
COMMAND rm -rf CMakeFiles;
47+
rm -rf CMakeCache.txt;
48+
rm -rf *.cmake;
49+
rm -rf bin;
50+
rm -rf Makefile;
51+
rm -rf lib;
52+
rm -rf build;
53+
rm -rf _deps;
54+
rm -rf test/CMakeFiles;
55+
rm -rf test/CMakeCache.txt;
56+
rm -rf test/*.cmake;
57+
rm -rf test/bin;
58+
rm -rf test/Makefile;
59+
rm -rf test/lib;
60+
rm -rf test/_deps;
61+
rm -rf test/runTests;
62+
)
3263

3364
# Google testing framework
3465
enable_testing()

‎test/CMakeLists.txt‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ include_directories(${GTEST_INCLUDE_DIRS})
1414
# Link runTests with what we want to test and the GTest and pthread library
1515
file(GLOB object_files
1616
"../bin/*.o"
17+
"../*/*.o"
1718
)
1819
list(FILTER object_files EXCLUDE REGEX ".*main.o.*$")
1920
file(GLOB test_files
2021
"wniemiec/util/cpp/*.cpp"
2122
)
2223
add_executable(runTests ${test_files})
2324
target_link_libraries(runTests gtest_main pthread ${object_files})
24-
ADD_CUSTOM_TARGET(clean-all
25+
ADD_CUSTOM_TARGET(clean-all-test
2526
COMMAND rm -rf CMakeFiles;
2627
rm -rf CMakeCache.txt;
2728
rm -rf cmake_install.cmake;
@@ -30,4 +31,4 @@ ADD_CUSTOM_TARGET(clean-all
3031
rm -rf lib;
3132
rm -rf _deps;
3233
rm -rf runTests;
33-
)
34+
)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /