diff --git a/README.md b/README.md index ec9a846a..ffb451ae 100644 --- a/README.md +++ b/README.md @@ -192,6 +192,55 @@ int main() { cmake -B build -DENABLE_SQLITE3=ON -DCMAKE_BUILD_TYPE=Debug cmake --build build --config Debug +## 作为第三方库引入 + +mysql +```cmake +set(ENABLE_MYSQL ON) +add_definitions(-DORMPP_ENABLE_MYSQL) +add_subdirectory(ormpp) +``` +或者 +```cmake +set(ENABLE_MYSQL ON) +add_definitions(-DORMPP_ENABLE_MYSQL) +add_library(ormpp INTERFACE) +include(cmake/mysql.cmake) +target_link_libraries(ormpp INTERFACE ${MYSQL_LIBRARY}) +target_include_directories(ormpp INTERFACE ormpp ormpp/ormpp ${MYSQL_INCLUDE_DIR}) +``` + +sqlite +```cmake +set(ENABLE_SQLITE3 ON) +add_definitions(-DORMPP_ENABLE_SQLITE3) +add_subdirectory(ormpp) +``` +或者 +```cmake +set(ENABLE_SQLITE3 ON) +add_definitions(-DORMPP_ENABLE_SQLITE3) +add_library(ormpp INTERFACE) +target_link_libraries(ormpp INTERFACE sqlite3) +target_include_directories(ormpp INTERFACE ormpp ormpp/ormpp thirdparty/sqlite3) +``` + +pg +```cmake +set(ENABLE_PG ON) +add_definitions(-DORMPP_ENABLE_PG) +add_subdirectory(ormpp) +``` +或者 +```cmake +set(ENABLE_PG ON) +add_definitions(-DORMPP_ENABLE_PG) +add_library(ormpp INTERFACE) +include(cmake/pgsql.cmake) +target_link_libraries(ormpp INTERFACE ${PGSQL_LIBRARY}) +target_include_directories(ormpp INTERFACE ormpp ormpp/ormpp ${PGSQL_INCLUDE_DIR}) +``` + ### 编译器支持 需要支持C++17的编译器, 要求的编译器版本:linux gcc7.2, clang4.0; windows >vs2017 update5