@@ -86,7 +86,7 @@ endif(WIN32)
8686macro (POCO_SOURCES_PLAT out name platform )
8787 source_group ("${name} \\ Source Files" FILES ${ARGN} )
8888 list (APPEND ${out} ${ARGN} )
89- if (NOT ${platform} )
89+ if (NOT ( ${platform} ) )
9090 set_source_files_properties (${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE )
9191 endif ()
9292endmacro ()
@@ -182,3 +182,51 @@ macro(POCO_MESSAGES out name)
182182
183183 endif (WIN32 )
184184endmacro ()
185+
186+
187+ #===============================================================================
188+ # Macros for Package generation
189+ #
190+ #TODO: Document this!
191+ # POCO_GENERATE_PACKAGE - Generates *Config.cmake
192+ # Usage: POCO_SOURCES_PLAT( out name platform sources)
193+ # INPUT:
194+ # out the variable the sources are added to
195+ # name: the name of the components
196+ # platform: the platform this sources are for (ON = All, OFF = None, WIN32, UNIX ...)
197+ # sources: a list of files to add to ${out}
198+ # Example: POCO_SOURCES_PLAT( SRCS Foundation ON src/Foundation.cpp )
199+ macro (POCO_GENERATE_PACKAGE target_name export_name package_destination )
200+ include (CMakePackageConfigHelpers )
201+ write_basic_package_version_file (
202+ "${CMAKE_CURRENT_BINARY_DIR} /Poco${target_name} ConfigVersion.cmake"
203+ VERSION ${PROJECT_VERSION}
204+ COMPATIBILITY AnyNewerVersion
205+ )
206+ export (EXPORT "${export_name} "
207+ FILE "${CMAKE_CURRENT_BINARY_DIR} /Poco${target_name} Targets.cmake"
208+ NAMESPACE "Poco::"
209+ )
210+ configure_file (cmake/Poco${target_name}Config.cmake
211+ "${CMAKE_CURRENT_BINARY_DIR} /Poco${target_name} Config.cmake"
212+ @ONLY
213+ )
214+
215+ set (ConfigPackageLocation "${package_destination} " )
216+
217+ install (
218+ EXPORT "${export_name} "
219+ FILE "Poco${target_name} Targets.cmake"
220+ NAMESPACE "Poco::"
221+ DESTINATION ${package_destination}
222+ )
223+
224+ install (
225+ FILES
226+ "${CMAKE_CURRENT_BINARY_DIR} /Poco${target_name} Config.cmake"
227+ "${CMAKE_CURRENT_BINARY_DIR} /Poco${target_name} ConfigVersion.cmake"
228+ DESTINATION ${package_destination}
229+ COMPONENT Devel
230+ )
231+
232+ endmacro ()
0 commit comments