Clean up CMakeLists.txt file for the unit tests

This commit is contained in:
Martin Kleusberg
2016-10-14 13:38:13 +02:00
parent d5c6b7bb0e
commit 9c5c2f7f36

View File

@@ -1,5 +1,4 @@
if(USE_QT5)
else()
if(NOT USE_QT5)
find_package(Qt4 COMPONENTS QtTest REQUIRED)
include("${QT_USE_FILE}")
add_definitions(${QT_DEFINITIONS})
@@ -10,38 +9,40 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}" ..)
# test-sqlobjects
set(TESTSQLOBJECTS_SRC
../sqlitedb.cpp
../sqlitetablemodel.cpp
../sqlitetypes.cpp
../csvparser.cpp
../grammar/Sqlite3Lexer.cpp
../grammar/Sqlite3Parser.cpp
../Settings.cpp
../PreferencesDialog.cpp
testsqlobjects.cpp
../FileDialog.cpp
../sqltextedit.cpp
../SqlUiLexer.cpp
../sqlitedb.cpp
../sqlitetablemodel.cpp
../sqlitetypes.cpp
../csvparser.cpp
../grammar/Sqlite3Lexer.cpp
../grammar/Sqlite3Parser.cpp
../Settings.cpp
../PreferencesDialog.cpp
testsqlobjects.cpp
../FileDialog.cpp
../sqltextedit.cpp
../SqlUiLexer.cpp
)
set(TESTSQLOBJECTS_HDR
../grammar/sqlite3TokenTypes.hpp
../grammar/Sqlite3Lexer.hpp
../grammar/Sqlite3Parser.hpp
../sqlitetypes.h)
../grammar/sqlite3TokenTypes.hpp
../grammar/Sqlite3Lexer.hpp
../grammar/Sqlite3Parser.hpp
../sqlitetypes.h
)
set(TESTSQLOBJECTS_FORMS
../PreferencesDialog.ui)
../PreferencesDialog.ui
)
set(TESTSQLOBJECTS_MOC_HDR
../sqlitedb.h
../sqlitetablemodel.h
../Settings.h
../PreferencesDialog.h
testsqlobjects.h
../FileDialog.h
../sqltextedit.h
../SqlUiLexer.h
../sqlitedb.h
../sqlitetablemodel.h
../Settings.h
../PreferencesDialog.h
testsqlobjects.h
../FileDialog.h
../sqltextedit.h
../SqlUiLexer.h
)
if(sqlcipher)
@@ -64,8 +65,7 @@ if(USE_QT5)
set(QT_LIBRARIES "")
endif()
if(ANTLR2_FOUND)
else()
if(NOT ANTLR2_FOUND)
add_dependencies(test-sqlobjects antlr)
endif()
target_link_libraries(test-sqlobjects ${QT_LIBRARIES} ${LIBSQLITE})
@@ -76,23 +76,21 @@ else()
endif()
link_directories("${CMAKE_CURRENT_BINARY_DIR}/${QSCINTILLA_DIR}")
add_dependencies(test-sqlobjects qscintilla2)
target_link_libraries(test-sqlobjects
qscintilla2)
target_link_libraries(test-sqlobjects qscintilla2)
add_test(test-sqlobjects test-sqlobjects)
# test-import
set(TESTIMPORT_SRC
../csvparser.cpp
TestImport.cpp
../csvparser.cpp
TestImport.cpp
)
set(TESTIMPORT_MOC_HDR
TestImport.h
TestImport.h
)
if(USE_QT5)
else()
if(NOT USE_QT5)
QT4_WRAP_CPP(TESTIMPORT_MOC ${TESTIMPORT_MOC_HDR})
endif()
@@ -109,27 +107,27 @@ add_test(test-import test-import)
# test regex
set(TESTREGEX_SRC
../sqlitedb.cpp
../sqlitetablemodel.cpp
../sqlitetypes.cpp
../grammar/Sqlite3Lexer.cpp
../grammar/Sqlite3Parser.cpp
../Settings.cpp
TestRegex.cpp
../sqlitedb.cpp
../sqlitetablemodel.cpp
../sqlitetypes.cpp
../grammar/Sqlite3Lexer.cpp
../grammar/Sqlite3Parser.cpp
../Settings.cpp
TestRegex.cpp
)
set(TESTREGEX_HDR
../grammar/sqlite3TokenTypes.hpp
../grammar/Sqlite3Lexer.hpp
../grammar/Sqlite3Parser.hpp
../sqlitetypes.h
../grammar/sqlite3TokenTypes.hpp
../grammar/Sqlite3Lexer.hpp
../grammar/Sqlite3Parser.hpp
../sqlitetypes.h
)
set(TESTREGEX_MOC_HDR
../sqlitedb.h
../sqlitetablemodel.h
../Settings.h
TestRegex.h
../sqlitedb.h
../sqlitetablemodel.h
../Settings.h
TestRegex.h
)
if(sqlcipher)
@@ -137,8 +135,7 @@ if(sqlcipher)
list(APPEND TESTREGEX_MOC_HDR ../CipherDialog.h)
endif()
if(USE_QT5)
else()
if(NOT USE_QT5)
QT4_WRAP_CPP(TESTREGEX_MOC ${TESTREGEX_MOC_HDR})
endif()
@@ -149,8 +146,7 @@ if(USE_QT5)
set(QT_LIBRARIES "")
endif()
if(ANTLR2_FOUND)
else()
if(NOT ANTLR2_FOUND)
add_dependencies(test-regex antlr)
endif()
target_link_libraries(test-regex ${QT_LIBRARIES} ${LIBSQLITE})
@@ -161,6 +157,5 @@ else()
endif()
link_directories("${CMAKE_CURRENT_BINARY_DIR}/${QSCINTILLA_DIR}")
add_dependencies(test-regex qscintilla2)
target_link_libraries(test-regex
qscintilla2)
target_link_libraries(test-regex qscintilla2)
add_test(test-regex test-regex)