File tree Expand file tree Collapse file tree 6 files changed +13
-24
lines changed Expand file tree Collapse file tree 6 files changed +13
-24
lines changed Original file line number Diff line number Diff line change @@ -98,19 +98,6 @@ if(NOT CUKE_DISABLE_GTEST)
98
98
set (GMOCK_ROOT "${CMAKE_CURRENT_BINARY_DIR} /gmock" )
99
99
endif ()
100
100
find_package (GMock REQUIRED )
101
-
102
- if (GTEST_FOUND )
103
- set (CUKE_GTEST_LIBRARIES
104
- GTest::GTest
105
- )
106
- endif ()
107
- if (GMOCK_FOUND )
108
- set (CUKE_GMOCK_LIBRARIES
109
- GTest::GTest
110
- GMock::GMock
111
- GMock::Main
112
- )
113
- endif ()
114
101
endif ()
115
102
116
103
#
Original file line number Diff line number Diff line change @@ -3,14 +3,14 @@ project(Calc)
3
3
add_library (Calc src/Calculator )
4
4
target_include_directories (Calc PUBLIC src )
5
5
6
- if (GMOCK_FOUND )
6
+ if (TARGET GTest::GTest )
7
7
add_executable (GTestCalculatorSteps features/step_definitions/GTestCalculatorSteps )
8
- target_link_libraries (GTestCalculatorSteps Calc ${CUKE_LIBRARIES} ${CUKE_GTEST_LIBRARIES} )
8
+ target_link_libraries (GTestCalculatorSteps Calc ${CUKE_LIBRARIES} GTest::GTest )
9
9
10
10
list (FIND CMAKE_CXX_COMPILE_FEATURES cxx_variadic_templates HAS_VARIADIC_TEMPLATES )
11
11
if (HAS_VARIADIC_TEMPLATES GREATER -1 )
12
12
add_executable (FuncArgsCalculatorSteps features/step_definitions/FuncArgsCalculatorSteps )
13
- target_link_libraries (FuncArgsCalculatorSteps Calc ${CUKE_LIBRARIES} ${CUKE_GTEST_LIBRARIES} )
13
+ target_link_libraries (FuncArgsCalculatorSteps Calc ${CUKE_LIBRARIES} GTest::GTest )
14
14
15
15
target_compile_features (FuncArgsCalculatorSteps PRIVATE cxx_variadic_templates )
16
16
endif ()
Original file line number Diff line number Diff line change @@ -19,9 +19,9 @@ if(QT_LIBRARIES)
19
19
target_link_libraries (BoostCalculatorQtSteps libcalcqt ${CUKE_LIBRARIES} ${QT_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} )
20
20
endif ()
21
21
22
- if (GTEST_FOUND )
22
+ if (TARGET GTest::GTest )
23
23
add_executable (GTestCalculatorQtSteps features/step_definitions/GTestCalculatorQtSteps )
24
- target_link_libraries (GTestCalculatorQtSteps libcalcqt ${CUKE_LIBRARIES} ${CUKE_GTEST_LIBRARIES} ${QT_LIBRARIES} )
24
+ target_link_libraries (GTestCalculatorQtSteps libcalcqt ${CUKE_LIBRARIES} GTest::GTest ${QT_LIBRARIES} )
25
25
endif ()
26
26
27
27
endif ()
Original file line number Diff line number Diff line change 1
1
project (FeatureShowcase )
2
2
3
- if (GMOCK_FOUND )
3
+ if (TARGET GTest::GTest )
4
4
function (add_cucumber_executable )
5
5
add_executable (FeatureShowcaseSteps ${ARGV} )
6
- target_link_libraries (FeatureShowcaseSteps ${CUKE_LIBRARIES} ${CUKE_GTEST_LIBRARIES} )
6
+ target_link_libraries (FeatureShowcaseSteps ${CUKE_LIBRARIES} GTest::GTest )
7
7
foreach (_arg ${ARGN} )
8
8
get_filename_component (OBJECT_PREFIX ${_arg} NAME_WE )
9
9
set_source_files_properties (${_arg} PROPERTIES COMPILE_FLAGS "-DCUKE_OBJECT_PREFIX=${OBJECT_PREFIX} " )
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ set(CUKE_SOURCES
17
17
18
18
set (CUKE_DEP_LIBRARIES json_spirit.header )
19
19
20
- if (GTEST_FOUND )
20
+ if (TARGET GTest::GTest )
21
21
list (APPEND CUKE_DEP_LIBRARIES GTest::GTest )
22
22
list (APPEND CUKE_SOURCES drivers/GTestDriver.cpp )
23
23
endif ()
Original file line number Diff line number Diff line change @@ -6,12 +6,12 @@ function(cuke_add_driver_test TEST_FILE)
6
6
add_test (NAME ${TEST_NAME} COMMAND ${TEST_NAME} )
7
7
endfunction ()
8
8
9
- if (GMOCK_FOUND )
9
+ if (TARGET GMock::Main )
10
10
function (cuke_add_test TEST_FILE )
11
11
get_filename_component (TEST_NAME ${TEST_FILE} NAME )
12
12
message (STATUS "Adding " ${TEST_NAME} )
13
13
add_executable (${TEST_NAME} ${TEST_FILE} .cpp )
14
- target_link_libraries (${TEST_NAME} cucumber-cpp-nomain ${CUKE_EXTRA_LIBRARIES} ${ARGN} ${CUKE_GMOCK_LIBRARIES} )
14
+ target_link_libraries (${TEST_NAME} cucumber-cpp-nomain ${CUKE_EXTRA_LIBRARIES} ${ARGN} GMock::Main )
15
15
gtest_add_tests (${TEST_NAME} "" ${TEST_FILE} .cpp )
16
16
# Run all tests in executable at once too. This ensures that the used fixtures get tested
17
17
# properly too. Additionally gather the output in jUnit compatible output for CI.
@@ -35,8 +35,10 @@ if(GMOCK_FOUND)
35
35
cuke_add_test (unit/StepManagerTest )
36
36
cuke_add_test (unit/TableTest )
37
37
cuke_add_test (unit/TagTest )
38
+ endif ()
38
39
39
- cuke_add_driver_test (integration/drivers/GTestDriverTest ${CUKE_GTEST_LIBRARIES} )
40
+ if (TARGET GTest::Main )
41
+ cuke_add_driver_test (integration/drivers/GTestDriverTest GTest::Main )
40
42
41
43
list (FIND CMAKE_CXX_COMPILE_FEATURES cxx_variadic_templates HAS_VARIADIC_TEMPLATES )
42
44
if (HAS_VARIADIC_TEMPLATES GREATER -1 )
You can’t perform that action at this time.
0 commit comments