File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -264,10 +264,18 @@ endfunction()
264
264
# OFF by default
265
265
#
266
266
function (mo2_configure_tests TARGET )
267
+ cmake_parse_arguments (MO2 "NO_MOCK;NO_MAIN" "" "" ${ARGN} )
267
268
mo2_configure_target(${TARGET} TRANSLATIONS OFF AUTOMOC OFF ${ARGN} )
268
269
269
270
find_package (GTest REQUIRED)
270
- target_link_libraries (${TARGET} PRIVATE GTest::gtest GTest::gmock GTest::gtest_main)
271
+ target_link_libraries (${TARGET} PRIVATE GTest::gtest)
272
+
273
+ if (NOT MO2_NO_MOCK)
274
+ target_link_libraries (${TARGET} GTest::gmock)
275
+ endif ()
276
+ if (NOT MO2_NO_MAIN)
277
+ target_link_libraries (${TARGET} GTest::gtest_main)
278
+ endif ()
271
279
272
280
# gtest_discover_tests would be nice but it requires Qt DLL, uibase, etc., in the
273
281
# path, etc., and is not working right now
@@ -281,7 +289,10 @@ function(mo2_configure_tests TARGET)
281
289
# )
282
290
#
283
291
284
- gtest_add_tests(TARGET ${TARGET} TEST_LIST ${TARGET} _gtests)
292
+ gtest_add_tests(
293
+ TARGET ${TARGET}
294
+ TEST_LIST ${TARGET} _gtests
295
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} )
285
296
set (${TARGET} _gtests ${${TARGET} _gtests} PARENT_SCOPE)
286
297
287
298
mo2_deploy_qt_for_tests(
You can’t perform that action at this time.
0 commit comments