Skip to content

Commit 7223b9e

Browse files
committed
Added more hints in the tests.
Fixed the include script for LibSqlCipher.
1 parent d620195 commit 7223b9e

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

CMakeLists.txt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,6 @@ if (NOT WIN32)
1515
find_package(PkgConfig REQUIRED)
1616
pkg_check_modules(SQLCIPHER REQUIRED sqlcipher)
1717
else()
18-
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
19-
set(_lib_suffix_win "x64")
20-
else()
21-
set(_lib_suffix_win "x86")
22-
endif()
23-
24-
# Change this by hand if needed
25-
set(Libsqlcipher_INCLUDE_DIRS "C:/CppProjects/sqlcipher/include")
26-
# Change this by hand if needed
27-
set(Libsqlcipher_LIBRARIES "optimized;C:/CppProjects/sqlcipher/compile/${_lib_suffix_win}/Release/sqlite3.lib;debug;C:/CppProjects/sqlcipher/compile/${_lib_suffix_win}/Debug/sqlite3.lib")
28-
2918
find_package(Libsqlcipher REQUIRED)
3019
endif()
3120

@@ -108,7 +97,7 @@ add_library(qsqlcipher ${LIBTYPE}
10897

10998
target_include_directories(qsqlcipher PRIVATE
11099
${Qt5Sql_PRIVATE_INCLUDE_DIRS}
111-
${SQLCIPHER_INCLUDE_DIRS} ${Libsqlcipher_INCLUDE_DIRS}
100+
${SQLCIPHER_INCLUDE_DIRS} ${Libsqlcipher_INCLUDE_DIRS}/sqlcipher
112101
)
113102

114103
target_link_libraries(qsqlcipher

cmake/FindLibsqlcipher.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ find_path(Libsqlcipher_INCLUDE_DIRS sqlcipher/sqlite3.h
2626
/usr
2727
/opt/local
2828
/opt
29+
${Libsqlcipher_INCLUDE_DIRS}
2930
)
3031

32+
if(NOT EXISTS "${Libsqlcipher_INCLUDE_DIRS}/sqlcipher/sqlite3.h")
33+
message(SEND_ERROR "Could not find LibSqlCipher Include directory for Libsqlcipher_INCLUDE_DIRS, it should contain sqlcipher/sqlite3.h! Tried: \"${Libsqlcipher_INCLUDE_DIRS}\"")
34+
set(Libsqlcipher_INCLUDE_DIRS "")
35+
endif()
36+
3137
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
3238
set(_lib_suffix 64)
3339
set(_lib_suffix_win "x64")

test-shared/main.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ int main(int argc, char *argv[])
6060
// QSQLCIPHER
6161
{
6262
#if defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER )
63-
std::cout << "Hint: If you get an error in the following task like \"QSQLCIPHER driver not loaded\" then check if library dependencies (e.g. libeay32.dll) are in the same folder as the test executable." << std::endl;
63+
std::cout << "Hint: If you get an error in the following task like \"QSQLCIPHER driver not loaded\" then check if library dependencies (e.g. libssl32.dll and sqlite3.dll from SQLCipher) are in the same folder as the test executable." << std::endl;
6464
#endif
6565
std::cout << "Running Task 4..." << std::endl;
6666
// Check that SQLCipher is not SQLite
@@ -75,7 +75,8 @@ int main(int argc, char *argv[])
7575
withDB("QSQLCIPHER", [](auto db){
7676
std::cout << "Running Task 5.1..." << std::endl;
7777
db.exec("PRAGMA key = 'foobar';");
78-
std::cout << "Running Task 5.2... (this might trigger a segfault)" << std::endl;
78+
std::cout << "Hint: The next test might trigger a segfault when SQLCipher is linked against an incompatible version of OpenSSL or comes with the broken compatibility patch for OpenSSL 1.1.x." << std::endl;
79+
std::cout << "Running Task 5.2..." << std::endl;
7980
db.exec("CREATE TABLE `foo` (`bar` INTEGER);");
8081
std::cout << "Running Task 5.3..." << std::endl;
8182
db.exec("INSERT INTO `foo` VALUES (42);");

0 commit comments

Comments
 (0)