project (test_units)

if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
	add_definitions ("-std=c++1z")
endif()

include_directories (SYSTEM ${CMAKE_SOURCE_DIR}/external/googletest/googletest/include)
include_directories (${CMAKE_SOURCE_DIR})

macro (units_add_test TEST_NAME SOURCE_FILE)
	set (TARGET_NAME ${TEST_NAME})
	add_executable (${TARGET_NAME} ${SOURCE_FILE})
	add_dependencies (${TARGET_NAME} gtest_main)

	target_link_libraries (${TARGET_NAME}
		-pthread
		gtest_main
	)

	add_test (${TARGET_NAME}
		${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET_NAME}
	)
endmacro ()

units_add_test (test_units test_units.cpp)
units_add_test (test_distance test_distance.cpp)
units_add_test (test_streams test_streams.cpp)


project (test_units)

if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
	add_definitions ("-std=c++1z")
endif()

include_directories (SYSTEM ${CMAKE_SOURCE_DIR}/external/googletest/googletest/include)
include_directories (${CMAKE_SOURCE_DIR})

if (UNITS_ENABLE_COVERAGE AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
	include (Coveralls)
	coveralls_turn_on_coverage ()
endif()

macro (units_add_test TEST_NAME SOURCE_FILE)
	set (TARGET_NAME ${TEST_NAME})
	add_executable (${TARGET_NAME} ${SOURCE_FILE})
	add_dependencies (${TARGET_NAME} gtest_main)

	target_link_libraries (${TARGET_NAME}
		-pthread
		gtest_main
	)

	add_test (${TARGET_NAME}
		${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TARGET_NAME}
	)
endmacro ()

units_add_test (test_units test_units.cpp)
units_add_test (test_distance test_distance.cpp)
units_add_test (test_streams test_streams.cpp)


Enable coverage for test project...
Enable coverage for test project...

Signed-off-by: David Brown <3eb4035e47bf510ef54544ee63f7ff38b3c2887e@bigdavedev.com>
