File tree Expand file tree Collapse file tree 3 files changed +27
-33
lines changed Expand file tree Collapse file tree 3 files changed +27
-33
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ ENDIF(MYSQLCPPCONN_TEST_NOT_IMPLEMENTED)
49
49
50
50
INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR} /include/jdbc" )
51
51
52
- SET (jdbctests_sources
52
+ SET (test_CJUnitTestsPort_sources
53
53
ccpptests.cpp
54
54
BaseTestFixture.cpp
55
55
../common/stringutils.cpp
@@ -70,8 +70,8 @@ SET(jdbctests_sources
70
70
71
71
# It's convinient for VS users to have headers as part of project
72
72
IF (WIN32 )
73
- SET (jdbctests_sources
74
- ${jdbctests_sources }
73
+ SET (test_CJUnitTestsPort_sources
74
+ ${tests_CJUnitTestsPort_sources }
75
75
BaseTestFixture.h
76
76
../common/stringutils.h
77
77
resources.h
@@ -90,12 +90,7 @@ IF(WIN32)
90
90
)
91
91
ENDIF (WIN32 )
92
92
93
- ADD_EXECUTABLE (CJUnitTestsPort ${jdbctests_sources} )
94
- TARGET_LINK_LIBRARIES (CJUnitTestsPort ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES} )
95
-
96
- set_target_properties (CJUnitTestsPort PROPERTIES FOLDER "Tests/jdbc" )
97
-
98
- ADD_TEST (NAME jdbc_CJUnitTestsPort COMMAND CJUnitTestsPort )
93
+ add_unit_test (CJUnitTestsPort )
99
94
100
95
#Copy sql.properties file to build dir
101
96
file (COPY sql.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
Original file line number Diff line number Diff line change @@ -87,6 +87,29 @@ TARGET_LINK_LIBRARIES(driver_test ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIB
87
87
#TODO: Check if this test should be added since it is failing!
88
88
#ADD_TEST(NAME jdbc_driver_test COMMAND driver_test)
89
89
90
+ function (add_unit_test NAME )
91
+
92
+ if (ARGN )
93
+ list (GET ARGN 0 TGT_NAME )
94
+ else ()
95
+ set (TGT_NAME test_${NAME} )
96
+ endif ()
97
+
98
+ ADD_EXECUTABLE (${TGT_NAME} ${test_${NAME}_sources} )
99
+ SET_TARGET_PROPERTIES (${TGT_NAME} PROPERTIES
100
+ OUTPUT_NAME "${NAME} "
101
+ LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS} "
102
+ COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} "
103
+ FOLDER "Tests/jdbc"
104
+ )
105
+ TARGET_LINK_LIBRARIES (${TGT_NAME} ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES} )
106
+
107
+ ADD_TEST (NAME jdbc_test_${NAME} COMMAND $< TARGET_FILE_NAME:${TGT_NAME} > )
108
+
109
+ MESSAGE (STATUS "Configuring unit tests - ${NAME} " )
110
+
111
+ endfunction ()
112
+
90
113
MESSAGE (STATUS "Configuring test cases" )
91
114
92
115
add_subdirectory (CJUnitTestsPort )
Original file line number Diff line number Diff line change @@ -104,30 +104,6 @@ IF(MYSQLCPPCONN_TEST_NOT_IMPLEMENTED)
104
104
ENDIF (MYSQLCPPCONN_TEST_NOT_IMPLEMENTED )
105
105
106
106
107
- function (add_unit_test NAME )
108
-
109
- if (ARGN )
110
- list (GET ARGN 0 TGT_NAME )
111
- else ()
112
- set (TGT_NAME test_${NAME} )
113
- endif ()
114
-
115
- ADD_EXECUTABLE (${TGT_NAME} ${test_${NAME}_sources} )
116
- SET_TARGET_PROPERTIES (${TGT_NAME} PROPERTIES
117
- OUTPUT_NAME "${NAME} "
118
- LINK_FLAGS "${MYSQLCPPCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS} "
119
- COMPILE_FLAGS "${MYSQLCPPCONN_COMPILE_FLAGS_ENV} "
120
- FOLDER "Tests/jdbc"
121
- )
122
- TARGET_LINK_LIBRARIES (${TGT_NAME} ${MY_TARGET_LINK_LIBRARIES} ${MY_GCOV_LINK_LIBRARIES} )
123
-
124
- ADD_TEST (NAME jdbc_test_${NAME} COMMAND $< TARGET_FILE_NAME:${TGT_NAME} > )
125
-
126
- MESSAGE (STATUS "Configuring unit tests - ${NAME} " )
127
-
128
- endfunction ()
129
-
130
-
131
107
MESSAGE (STATUS "Configuring unit tests" )
132
108
133
109
ADD_SUBDIRECTORY (example/ )
You can’t perform that action at this time.
0 commit comments