mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-27 09:39:08 +01:00
CMake: Create PocoConfig.cmake to make importable from other CMake projects
The generated PocoConfig.cmake can be used by other CMake projects using find_package.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
set(LIBNAME "PocoDataSQLite")
|
||||
set(LIBNAME "DataSQLite")
|
||||
set(POCO_LIBNAME "Poco${LIBNAME}")
|
||||
|
||||
# Sources
|
||||
file(GLOB SRCS_G "src/*.cpp")
|
||||
@@ -8,11 +9,9 @@ POCO_SOURCES_AUTO( SQLITE_SRCS ${SRCS_G})
|
||||
file(GLOB_RECURSE HDRS_G "include/*.h" )
|
||||
POCO_HEADERS_AUTO( SQLITE_SRCS ${HDRS_G})
|
||||
|
||||
include_directories( "include" "src" )
|
||||
|
||||
if (POCO_UNBUNDLED)
|
||||
find_package(SQLite3)
|
||||
set(DATASQLITELIBS PocoData PocoFoundation ${SQLITE3_LIBRARIES})
|
||||
set(DATASQLITELIBS ${SQLITE3_LIBRARIES})
|
||||
include_directories("${SQLITE3_INCLUDE_DIRS}")
|
||||
else()
|
||||
# sqlite3
|
||||
@@ -24,31 +23,48 @@ else()
|
||||
src/sqlite3.h
|
||||
)
|
||||
|
||||
set(DATASQLITELIBS PocoData PocoFoundation)
|
||||
set(DATASQLITELIBS "")
|
||||
endif()
|
||||
|
||||
if(WINCE)
|
||||
add_definitions(-DSQLITE_MSVC_LOCALTIME_API)
|
||||
endif(WINCE)
|
||||
|
||||
add_definitions(-DSQLITE_THREADSAFE=1 -DSQLITE_DISABLE_LFS -DSQLITE_OMIT_UTF16 -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_COMPLETE -DSQLITE_OMIT_TCL_VARIABLE -DSQLITE_OMIT_DEPRECATED)
|
||||
|
||||
add_library( ${LIBNAME} ${LIB_MODE} ${SQLITE_SRCS} )
|
||||
set_target_properties( ${LIBNAME}
|
||||
add_library( "${LIBNAME}" ${LIB_MODE} ${SQLITE_SRCS} )
|
||||
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}")
|
||||
set_target_properties( "${LIBNAME}"
|
||||
PROPERTIES
|
||||
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
|
||||
DEFINE_SYMBOL SQLite_EXPORTS)
|
||||
target_link_libraries( ${LIBNAME} ${DATASQLITELIBS} )
|
||||
OUTPUT_NAME ${POCO_LIBNAME}
|
||||
DEFINE_SYMBOL SQLite_EXPORTS
|
||||
)
|
||||
|
||||
target_link_libraries( "${LIBNAME}" Foundation Data ${DATASQLITELIBS} )
|
||||
target_include_directories( "${LIBNAME}"
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
install(
|
||||
DIRECTORY include/Poco
|
||||
DESTINATION include
|
||||
COMPONENT Devel
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS ${LIBNAME}
|
||||
TARGETS "${LIBNAME}" EXPORT "${LIBNAME}Targets"
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||
RUNTIME DESTINATION bin
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
POCO_GENERATE_PACKAGE("${LIBNAME}" "${LIBNAME}Targets" "lib/cmake/${PROJECT_NAME}")
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
||||
5
Data/SQLite/cmake/PocoDataSQLiteConfig.cmake
Normal file
5
Data/SQLite/cmake/PocoDataSQLiteConfig.cmake
Normal file
@@ -0,0 +1,5 @@
|
||||
include(CMakeFindDependencyMacro)
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||
find_dependency(PocoFoundation)
|
||||
find_dependency(PocoData)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/PocoDataSQLiteTargets.cmake")
|
||||
Reference in New Issue
Block a user