19695bd28SJagpal Singh Gillgtest_dep = dependency('gtest', main: true, disabler: true, required: false) 29695bd28SJagpal Singh Gillgmock_dep = dependency('gmock', disabler: true, required: false) 39695bd28SJagpal Singh Gillif not gtest_dep.found() or not gmock_dep.found() 49695bd28SJagpal Singh Gill gtest_proj = import('cmake').subproject('googletest', required: false) 59695bd28SJagpal Singh Gill if gtest_proj.found() 69695bd28SJagpal Singh Gill gtest_dep = declare_dependency( 79695bd28SJagpal Singh Gill dependencies: [ 89695bd28SJagpal Singh Gill dependency('threads'), 99695bd28SJagpal Singh Gill gtest_proj.dependency('gtest'), 109695bd28SJagpal Singh Gill gtest_proj.dependency('gtest_main'), 119695bd28SJagpal Singh Gill ], 129695bd28SJagpal Singh Gill ) 139695bd28SJagpal Singh Gill gmock_dep = gtest_proj.dependency('gmock') 149695bd28SJagpal Singh Gill else 159695bd28SJagpal Singh Gill assert( 169695bd28SJagpal Singh Gill not get_option('tests').enabled(), 179695bd28SJagpal Singh Gill 'Googletest is required if tests are enabled', 189695bd28SJagpal Singh Gill ) 199695bd28SJagpal Singh Gill endif 209695bd28SJagpal Singh Gillendif 210fffb59bSJagpal Singh Gill 229695bd28SJagpal Singh Gilltest( 239695bd28SJagpal Singh Gill 'test_modbus_commands', 249695bd28SJagpal Singh Gill executable( 259695bd28SJagpal Singh Gill 'test_modbus_commands', 269695bd28SJagpal Singh Gill 'test_modbus_commands.cpp', 279695bd28SJagpal Singh Gill dependencies: [gtest_dep, gmock_dep, default_deps, modbus_rtu_dep], 289695bd28SJagpal Singh Gill include_directories: ['.'], 299695bd28SJagpal Singh Gill ), 309695bd28SJagpal Singh Gill) 31a32d241bSJagpal Singh Gill 32a32d241bSJagpal Singh Gilltest( 33a32d241bSJagpal Singh Gill 'test_modbus', 34a32d241bSJagpal Singh Gill executable( 35a32d241bSJagpal Singh Gill 'test_modbus', 36a32d241bSJagpal Singh Gill 'test_modbus.cpp', 37a32d241bSJagpal Singh Gill 'modbus_server_tester.cpp', 38a32d241bSJagpal Singh Gill dependencies: [gtest_dep, gmock_dep, default_deps, modbus_rtu_dep], 39a32d241bSJagpal Singh Gill include_directories: ['.'], 40a32d241bSJagpal Singh Gill ), 41a32d241bSJagpal Singh Gill) 427f9d41ddSJagpal Singh Gill 437f9d41ddSJagpal Singh Gilltest( 447f9d41ddSJagpal Singh Gill 'test_port', 457f9d41ddSJagpal Singh Gill executable( 467f9d41ddSJagpal Singh Gill 'test_port', 477f9d41ddSJagpal Singh Gill 'test_port.cpp', 487f9d41ddSJagpal Singh Gill 'modbus_server_tester.cpp', 497f9d41ddSJagpal Singh Gill dependencies: [gtest_dep, gmock_dep, default_deps, modbus_rtu_dep], 507f9d41ddSJagpal Singh Gill include_directories: ['.', common_include], 517f9d41ddSJagpal Singh Gill ), 527f9d41ddSJagpal Singh Gill) 53cad9ecf6SJagpal Singh Gill 54cad9ecf6SJagpal Singh Gilltest( 55cad9ecf6SJagpal Singh Gill 'test_inventory', 56cad9ecf6SJagpal Singh Gill executable( 57cad9ecf6SJagpal Singh Gill 'test_inventory', 58cad9ecf6SJagpal Singh Gill 'test_inventory.cpp', 59cad9ecf6SJagpal Singh Gill 'modbus_server_tester.cpp', 60cad9ecf6SJagpal Singh Gill inventory_src, 61cad9ecf6SJagpal Singh Gill dependencies: [gtest_dep, gmock_dep, default_deps, modbus_rtu_dep], 62cad9ecf6SJagpal Singh Gill include_directories: ['.', common_include], 63cad9ecf6SJagpal Singh Gill ), 64cad9ecf6SJagpal Singh Gill) 65*e92aba45SJagpal Singh Gill 66*e92aba45SJagpal Singh Gilltest( 67*e92aba45SJagpal Singh Gill 'test_sensors', 68*e92aba45SJagpal Singh Gill executable( 69*e92aba45SJagpal Singh Gill 'test_sensors', 70*e92aba45SJagpal Singh Gill 'test_sensors.cpp', 71*e92aba45SJagpal Singh Gill 'modbus_server_tester.cpp', 72*e92aba45SJagpal Singh Gill device_src, 73*e92aba45SJagpal Singh Gill dependencies: [gtest_dep, gmock_dep, default_deps, modbus_rtu_dep], 74*e92aba45SJagpal Singh Gill include_directories: ['.', common_include], 75*e92aba45SJagpal Singh Gill ), 76*e92aba45SJagpal Singh Gill) 77