Skip to content

Commit

Permalink
Do not build coverage or valgrind for MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
AzothAmmo committed Feb 6, 2017
1 parent a2d5a15 commit fb6606d
Showing 1 changed file with 29 additions and 27 deletions.
56 changes: 29 additions & 27 deletions unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,33 +57,35 @@ foreach(TEST_SOURCE ${TESTS})
endforeach()

# Add the valgrind target
add_custom_target(valgrind
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/run_valgrind.sh")

# Add the coverage target
add_custom_target(coverage)
add_custom_command(TARGET coverage
COMMAND "${CMAKE_SOURCE_DIR}/scripts/updatecoverage.sh" ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/coverage")

# add tests to coverage
foreach(TEST_SOURCE ${TESTS})
string(REPLACE ".cpp" "" COVERAGE_TARGET "${TEST_SOURCE}")
set(COVERAGE_TARGET "coverage_${COVERAGE_TARGET}")

# Check to see if our target is listed in "SPECIAL_TESTS"
list(FIND SPECIAL_TESTS "${TEST_SOURCE}" IS_SPECIAL_TEST)

if(IS_SPECIAL_TEST EQUAL -1)
add_dependencies(coverage ${COVERAGE_TARGET})

add_executable(${COVERAGE_TARGET} EXCLUDE_FROM_ALL ${TEST_SOURCE})
set_target_properties(${COVERAGE_TARGET} PROPERTIES COMPILE_FLAGS "-coverage")
set_target_properties(${COVERAGE_TARGET} PROPERTIES LINK_FLAGS "-coverage")
set_target_properties(${COVERAGE_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/coverage")
target_link_libraries(${COVERAGE_TARGET} ${CEREAL_THREAD_LIBS})
endif()
endforeach()
if(NOT MSVC)
add_custom_target(valgrind
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/run_valgrind.sh")

# Add the coverage target
add_custom_target(coverage)
add_custom_command(TARGET coverage
COMMAND "${CMAKE_SOURCE_DIR}/scripts/updatecoverage.sh" ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/coverage")

# add tests to coverage
foreach(TEST_SOURCE ${TESTS})
string(REPLACE ".cpp" "" COVERAGE_TARGET "${TEST_SOURCE}")
set(COVERAGE_TARGET "coverage_${COVERAGE_TARGET}")

# Check to see if our target is listed in "SPECIAL_TESTS"
list(FIND SPECIAL_TESTS "${TEST_SOURCE}" IS_SPECIAL_TEST)

if(IS_SPECIAL_TEST EQUAL -1)
add_dependencies(coverage ${COVERAGE_TARGET})

add_executable(${COVERAGE_TARGET} EXCLUDE_FROM_ALL ${TEST_SOURCE})
set_target_properties(${COVERAGE_TARGET} PROPERTIES COMPILE_FLAGS "-coverage")
set_target_properties(${COVERAGE_TARGET} PROPERTIES LINK_FLAGS "-coverage")
set_target_properties(${COVERAGE_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/coverage")
target_link_libraries(${COVERAGE_TARGET} ${CEREAL_THREAD_LIBS})
endif()
endforeach()
endif(NOT MSVC)

if(NOT CMAKE_VERSION VERSION_LESS 3.0)
add_test(test_cmake_config_module ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake-config-module.cmake)
Expand Down

0 comments on commit fb6606d

Please sign in to comment.