@@ -89,7 +89,6 @@ install(CODE "execute_process(COMMAND ${PYTHON} setup.py install --record instal
8989#
9090function (add_libuavcan_test name library flags ) # Adds GTest executable and creates target to execute it every build
9191 find_package (Threads REQUIRED)
92- include_directories (${GTEST_INCLUDE_DIRS} )
9392
9493 file (GLOB_RECURSE TEST_CXX_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "test/*.cpp" )
9594 add_executable (${name} ${TEST_CXX_FILES} )
@@ -99,9 +98,11 @@ function(add_libuavcan_test name library flags) # Adds GTest executable and crea
9998 set_target_properties (${name} PROPERTIES COMPILE_FLAGS ${flags} )
10099 endif ()
101100
102- target_link_libraries (${name} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
101+ target_link_libraries (${name} gmock_main )
103102 target_link_libraries (${name} ${library} )
104- target_link_libraries (${name} rt)
103+ if (${UAVCAN_PLATFORM} STREQUAL "linux" )
104+ target_link_libraries (${name} rt)
105+ endif ()
105106
106107 # Tests run automatically upon successful build
107108 # If failing tests need to be investigated with debugger, use 'make --ignore-errors'
@@ -145,10 +146,8 @@ if (DEBUG_BUILD)
145146 set_target_properties (uavcan_optim PROPERTIES COMPILE_FLAGS ${optim_flags} )
146147 add_dependencies (uavcan_optim libuavcan_dsdlc)
147148
148- # GTest executables
149- find_package (GTest)
150149 if (GTEST_FOUND)
151- message (STATUS "GTest found, tests will be built and run [ ${GTEST_INCLUDE_DIRS} ] [ ${GTEST_BOTH_LIBRARIES} ] " )
150+ message (STATUS "GTest found, tests will be built and run. " )
152151 add_libuavcan_test(libuavcan_test uavcan "" ) # Default
153152 add_libuavcan_test(libuavcan_test_cpp03 uavcan_cpp03 "${cpp03_flags} " ) # C++03
154153 add_libuavcan_test(libuavcan_test_optim uavcan_optim "${optim_flags} " ) # Max optimization
0 commit comments