@@ -2,14 +2,30 @@ cmake_minimum_required(VERSION 3.0)
22project (qsqlcipher)
33
44set (CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH} ;${PROJECT_SOURCE_DIR} /cmake/" )
5- SET (CMAKE_PREFIX_PATH "D:/Qt/5.9.2/msvc2017_64/lib/cmake/" )
5+
6+ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
7+ SET (CMAKE_PREFIX_PATH "C:/Qt/5.9.2/msvc2017_64/lib/cmake/" )
8+ else ()
9+ SET (CMAKE_PREFIX_PATH "C:/Qtx86/5.9.2/msvc2015/lib/cmake/" )
10+ endif ()
611
712find_package (Qt5Sql REQUIRED)
8- find_package (PkgConfig REQUIRED)
913
1014if (NOT WIN32 )
15+ find_package (PkgConfig REQUIRED)
1116 pkg_check_modules(SQLCIPHER REQUIRED sqlcipher)
1217else ()
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+
1329 find_package (Libsqlcipher REQUIRED)
1430endif ()
1531
@@ -19,9 +35,15 @@ set(CMAKE_AUTOMOC ON)
1935# Arrange output paths so that the plugin is found in the default search path
2036# relative to the test binary.
2137set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} )
22- set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /sqldrivers)
38+ if (NOT WIN32 )
39+ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /sqldrivers)
40+ else ()
41+ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR} /Debug/sqldrivers)
42+ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR} /Release/sqldrivers)
43+ endif ()
2344
2445option (QSQLCIPHER_STATIC "Build plugin as a static library" OFF )
46+ option (QSQLCIPHER_BUILD_TESTS "Build the test binary" ON )
2547
2648set (CMAKE_CXX_STANDARD 14)
2749set (CMAKE_CXX_STANDARD_REQUIRED ON )
@@ -74,27 +96,17 @@ add_library(qsqlcipher ${LIBTYPE}
7496 "${CMAKE_BINARY_DIR} /qt-private-from-git-version-${Qt5Sql_VERSION} /qt-private/qsql_sqlite.cpp"
7597)
7698
77- if (WIN32 )
78- # Change this by hand if needed
79- set (SQLCIPHER_INCLUDE_DIRS "D:/CppProjects/sqlcipher-original" )
80- endif ()
81-
8299target_include_directories (qsqlcipher PRIVATE
83100 ${Qt5Sql_PRIVATE_INCLUDE_DIRS}
84101 ${SQLCIPHER_INCLUDE_DIRS} ${Libsqlcipher_INCLUDE_DIRS}
85102)
86103
87- if (WIN32 )
88- # Change this by hand if needed
89- set (SQLCIPHER_LIBRARIES "optimized;D:/CppProjects/sqlcipher-original-build/Retail/x64/sqlite3.lib;debug;D:/CppProjects/sqlcipher-original-build/Debug/x64/sqlite3.lib" )
90- endif ()
91-
92104target_link_libraries (qsqlcipher
93105 Qt5::Sql
94106 ${SQLCIPHER_LIBRARIES} ${Libsqlcipher_LIBRARIES}
95107)
96108
97- include (CTest)
98- if (BUILD_TESTING )
109+ # include(CTest)
110+ if (QSQLCIPHER_BUILD_TESTS )
99111 add_subdirectory (${TEST_DIR} )
100112endif ()
0 commit comments