mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-17 03:03:23 +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 "PocoXML")
|
||||
set(LIBNAME "XML")
|
||||
set(POCO_LIBNAME "Poco${LIBNAME}")
|
||||
|
||||
# Sources
|
||||
file(GLOB SRCS_G "src/*.cpp")
|
||||
@@ -24,28 +25,47 @@ else()
|
||||
)
|
||||
endif (POCO_UNBUNDLED)
|
||||
|
||||
add_definitions(-D_USRDLL -DXML_NS -DXML_DTD -DHAVE_EXPAT_CONFIG_H)
|
||||
if(WIN32)
|
||||
#TODO: Is XML_STATIC only required with Windows? What does it do?
|
||||
add_definitions(-DXML_STATIC -DXML_NS -DXML_DTD -DHAVE_EXPAT_CONFIG_H)
|
||||
else()
|
||||
add_definitions(-DXML_NS -DXML_DTD -DHAVE_EXPAT_CONFIG_H)
|
||||
endif()
|
||||
|
||||
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
|
||||
set_target_properties( ${LIBNAME}
|
||||
add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} )
|
||||
add_library( "${POCO_LIBNAME}" ALIAS "${LIBNAME}")
|
||||
set_target_properties( "${LIBNAME}"
|
||||
PROPERTIES
|
||||
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION}
|
||||
DEFINE_SYMBOL XML_EXPORTS)
|
||||
target_link_libraries( ${LIBNAME} ${SYSLIBS} PocoFoundation)
|
||||
OUTPUT_NAME ${POCO_LIBNAME}
|
||||
DEFINE_SYMBOL XML_EXPORTS
|
||||
)
|
||||
|
||||
target_link_libraries( "${LIBNAME}" ${SYSLIBS} Foundation)
|
||||
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(samples)
|
||||
add_subdirectory(testsuite)
|
||||
|
4
XML/cmake/PocoXMLConfig.cmake
Normal file
4
XML/cmake/PocoXMLConfig.cmake
Normal file
@@ -0,0 +1,4 @@
|
||||
include(CMakeFindDependencyMacro)
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||
find_dependency(PocoFoundation)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/PocoXMLTargets.cmake")
|
Reference in New Issue
Block a user