Binary delivery POC

Purpose

All components can be extracted and added as binary dependencies on the application. The binary artifact is static library (*.lib or .a) or shared library (.dll or *.so) and headers. All components use CMAKE for describe build and install steps. Each component is developed in a separate repository.

Condition

Application don't have nested dependecies. We can't use CONAN or HUNTER systems.

Using

I just try use CMAKE Relocatable Packages. More details here

Relocatable static library

cd library_for_delivery
mkdir !build
cd !build
cmake -DCMAKE_INSTALL_PREFIX=x86 -G"Visual Studio 12" ..
cmake --build . --target install --config Debug
cmake --build . --target install --config Release
	binary_delivery(
        PROJ library_for_delivery
		URL "https://github.com/qrealka/binary_delivery_test/releases/download/1.0.1/msvc2013${lib_zip_suffix}.zip")

	find_package(library_for_delivery REQUIRED)
	copy_import(library_for_delivery Release MinSizeRel)

	if (library_for_delivery_FOUND)
		message(STATUS "library_for_delivery configuration file: ${library_for_delivery_CONSIDERED_CONFIGS}")

		target_link_libraries(use_library PRIVATE library_for_delivery)
	else()
		message(FATAL_ERROR "library_for_delivery not found!")
	endif() #library_for_delivery_FOUND

Relocatable shared library

Same steps as for static library. But in application CMakeLists file we must one line:

		add_custom_command(TARGET use_library POST_BUILD	
			COMMAND ${CMAKE_COMMAND} -E copy_if_different 
              $<TARGET_FILE:dll_for_delivery> 
              $<TARGET_FILE_DIR:use_library>
		)

Just copy downloaded dll to target directory.