mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-08 04:05:26 +02: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 "PocoDataMySQL")
|
||||
set(LIBNAME "DataMySQL")
|
||||
set(POCO_LIBNAME "Poco${LIBNAME}")
|
||||
|
||||
# Sources
|
||||
file(GLOB SRCS_G "src/*.cpp")
|
||||
@@ -10,28 +11,39 @@ POCO_HEADERS_AUTO( MYSQL_SRCS ${HDRS_G})
|
||||
|
||||
add_definitions(-DTHREADSAFE -DNO_TCL)
|
||||
|
||||
include_directories( "include" )
|
||||
|
||||
add_library( ${LIBNAME} ${LIB_MODE} ${MYSQL_SRCS} )
|
||||
set_target_properties( ${LIBNAME}
|
||||
add_library( "${LIBNAME}" ${LIB_MODE} ${MYSQL_SRCS} )
|
||||
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}")
|
||||
set_target_properties( "${LIBNAME}"
|
||||
PROPERTIES
|
||||
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
|
||||
DEFINE_SYMBOL MySQL_EXPORTS)
|
||||
target_link_libraries( ${LIBNAME} PocoData PocoFoundation ${MYSQL_LIB})
|
||||
OUTPUT_NAME ${POCO_LIBNAME}
|
||||
DEFINE_SYMBOL MySQL_EXPORTS
|
||||
)
|
||||
|
||||
target_link_libraries( "${LIBNAME}" Foundation Data ${MYSQL_LIB})
|
||||
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 ()
|
||||
|
Reference in New Issue
Block a user