Skip to content

Commit 5110fa6

Browse files
author
SSS-XPS-9530
committed
Tidy up CMakeLists
1 parent ff9d87f commit 5110fa6

File tree

4 files changed

+11
-51
lines changed

4 files changed

+11
-51
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@
1212
/CMakeCache.txt
1313
/src/benchmark/Makefile
1414
/src/benchmark/benchmark
15+
/src/test/CMakeFiles
16+
/Testing/Temporary
17+
/thirdparty/google/test/1.8.0/googletest/CMakeFiles
18+
*.lcov

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
cmake_minimum_required (VERSION 2.8.11)
2-
project (benchmark)
1+
cmake_minimum_required (VERSION 2.8.11)
2+
project (any_ptr)
33

44
foreach(p
55
CMP0054 # CMake 3.1

src/benchmark/CMakeLists.txt

-44
Original file line numberDiff line numberDiff line change
@@ -16,47 +16,3 @@ endmacro(compile_benchmark_test)
1616
# Demonstration executable
1717
compile_benchmark_test(benchmark)
1818
add_test(benchmark benchmark_any --benchmark_min_time=0.01)
19-
20-
# Add the coverage command(s)
21-
if(CMAKE_BUILD_TYPE)
22-
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
23-
endif()
24-
if (${CMAKE_BUILD_TYPE_LOWER} MATCHES "coverage")
25-
find_program(GCOV gcov)
26-
find_program(LCOV lcov)
27-
find_program(GENHTML genhtml)
28-
find_program(CTEST ctest)
29-
if (GCOV AND LCOV AND GENHTML AND CTEST AND HAVE_CXX_FLAG_COVERAGE)
30-
add_custom_command(
31-
OUTPUT ${CMAKE_BINARY_DIR}/lcov/index.html
32-
COMMAND ${LCOV} -q -z -d .
33-
COMMAND ${LCOV} -q --no-external -c -b "${CMAKE_SOURCE_DIR}" -d . -o before.lcov -i
34-
COMMAND ${CTEST} --force-new-ctest-process
35-
COMMAND ${LCOV} -q --no-external -c -b "${CMAKE_SOURCE_DIR}" -d . -o after.lcov
36-
COMMAND ${LCOV} -q -a before.lcov -a after.lcov --output-file final.lcov
37-
COMMAND ${LCOV} -q -r final.lcov "'${CMAKE_SOURCE_DIR}/test/*'" -o final.lcov
38-
COMMAND ${GENHTML} final.lcov -o lcov --demangle-cpp --sort -p "${CMAKE_BINARY_DIR}" -t benchmark
39-
DEPENDS any_ptr_benchmark
40-
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
41-
COMMENT "Running LCOV"
42-
)
43-
add_custom_target(coverage
44-
DEPENDS ${CMAKE_BINARY_DIR}/lcov/index.html
45-
COMMENT "LCOV report at lcov/index.html"
46-
)
47-
message(STATUS "Coverage command added")
48-
else()
49-
if (HAVE_CXX_FLAG_COVERAGE)
50-
set(CXX_FLAG_COVERAGE_MESSAGE supported)
51-
else()
52-
set(CXX_FLAG_COVERAGE_MESSAGE unavailable)
53-
endif()
54-
message(WARNING
55-
"Coverage not available:\n"
56-
" gcov: ${GCOV}\n"
57-
" lcov: ${LCOV}\n"
58-
" genhtml: ${GENHTML}\n"
59-
" ctest: ${CTEST}\n"
60-
" --coverage flag: ${CXX_FLAG_COVERAGE_MESSAGE}")
61-
endif()
62-
endif()

src/test/CMakeLists.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ if (DEFINED BENCHMARK_CXX_LINKER_FLAGS)
88
list(APPEND CMAKE_EXE_LINKER_FLAGS ${BENCHMARK_CXX_LINKER_FLAGS})
99
endif()
1010

11-
add_executable(test_any_ptr "main.cpp" "test_any_shared_ptr.cpp")
12-
target_link_libraries(test_any_ptr gtest ${CMAKE_THREAD_LIBS_INIT})
11+
add_executable(any_ptr_test "main.cpp" "test_any_shared_ptr.cpp")
12+
target_link_libraries(any_ptr_test gtest ${CMAKE_THREAD_LIBS_INIT})
1313

1414
# Demonstration executable
15-
add_test(test_any_ptr test_any_ptr --benchmark_min_time=0.01)
15+
add_test(any_ptr_test any_ptr_test)
1616

1717
# Add the coverage command(s)
1818
if(CMAKE_BUILD_TYPE)
@@ -32,8 +32,8 @@ if (${CMAKE_BUILD_TYPE_LOWER} MATCHES "coverage")
3232
COMMAND ${LCOV} -q --no-external -c -b "${CMAKE_SOURCE_DIR}" -d . -o after.lcov
3333
COMMAND ${LCOV} -q -a before.lcov -a after.lcov --output-file final.lcov
3434
COMMAND ${LCOV} -q -r final.lcov "'${CMAKE_SOURCE_DIR}/test/*'" -o final.lcov
35-
COMMAND ${GENHTML} final.lcov -o lcov --demangle-cpp --sort -p "${CMAKE_BINARY_DIR}" -t test_any_ptr
36-
DEPENDS any_ptr_benchmark
35+
COMMAND ${GENHTML} final.lcov -o lcov --demangle-cpp --sort -p "${CMAKE_BINARY_DIR}" -t any_ptr_test
36+
DEPENDS any_ptr_test
3737
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
3838
COMMENT "Running LCOV"
3939
)

0 commit comments

Comments
 (0)