diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 4ce2cb62d..b7a769be4 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -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)