#[[ Create imported targets: * PIP - main library * PIP::USB * PIP::Console * PIP::Crypt * PIP::Compress * PIP::FFTW * PIP::OpenCL * PIP::IOUtils * PIP::ClientServer * PIP::Cloud * PIP::Lua * PIP::HTTPClient * PIP::HTTPServer These targets include directories and depends on main library ]] cmake_policy(SET CMP0011 NEW) # don`t affect includer policies include(SHSTKMacros) shstk_set_find_dirs(PIP) set(__libs "usb;crypt;console;fftw;compress;opencl;io_utils;client_server;cloud;lua;http_client;http_server") if (BUILDING_PIP) #set(_libs "pip;pip_usb;pip_console;pip_crypt;pip_fftw;pip_compress;pip_opencl;pip_io_utils;pip_cloud;pip_lua;pip_http_client;pip_http_server") #set(_bins "pip_cmg;pip_rc;deploy_tool") #get_target_property(_path pip BINARY_DIR) #get_target_property(_path pip LIBRARY_OUTPUT_NAME) #message("${_path}") #set(PIP_LIBRARY "$/$" CACHE STRING "") set(PIP_LIBRARY pip CACHE STRING "") set(PIP_FOUND ON CACHE BOOL "") else() find_library(PIP_LIBRARY pip HINTS ${PIP_LIBDIR}) foreach (_l ${__libs}) find_library(PIP_LIBRARY_${_l} pip_${_l} HINTS ${PIP_LIBDIR}) endforeach() endif() if (BUILDING_PIP AND (NOT CMAKE_CROSSCOMPILING)) set(PIP_CMG "$/$" CACHE STRING "") set(PIP_RC "$/$" CACHE STRING "") set(PIP_TR "$/$" CACHE STRING "") set(PIP_DEPLOY_TOOL "$/$" CACHE STRING "") else() find_program(PIP_CMG pip_cmg${PIP_BINEXT} HINTS ${PIP_BINDIR} ${PIP_FIND_PROGRAM_ARG}) find_program(PIP_RC pip_rc${PIP_BINEXT} HINTS ${PIP_BINDIR} ${PIP_FIND_PROGRAM_ARG}) find_program(PIP_TR pip_tr${PIP_BINEXT} HINTS ${PIP_BINDIR} ${PIP_FIND_PROGRAM_ARG}) find_program(PIP_DEPLOY_TOOL deploy_tool${PIP_BINEXT} HINTS ${PIP_BINDIR} ${PIP_FIND_PROGRAM_ARG}) endif() if (NOT PIP_LIBRARY) if(PIP_FIND_REQUIRED) message(FATAL_ERROR "Can`t find PIP library!") endif() return() endif() set(_PIP_LIBRARY_PATH_ "${PIP_LIBRARY}") set(_PIP_ADD_LIBS_ "") if (NOT BUILDING_PIP) if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") find_library(DL_LIBRARY dl) list(APPEND PIP_LIBRARY ${DL_LIBRARY}) if (NOT DEFINED ANDROID_PLATFORM) find_library(PTHREAD_LIBRARY pthread) find_library(UTIL_LIBRARY util) set(_PIP_ADD_LIBS_ ${PTHREAD_LIBRARY} ${UTIL_LIBRARY}) if((NOT DEFINED ENV{QNX_HOST}) AND (NOT APPLE) AND (NOT PIP_FREERTOS)) find_library(RT_LIBRARY rt) list(APPEND _PIP_ADD_LIBS_ ${RT_LIBRARY}) endif() list(APPEND PIP_LIBRARY ${_PIP_ADD_LIBS_}) endif() endif() endif() if (NOT BUILDING_PIP) shstk_find_header(PIP "pip_version.h" "${_PIP_LIBRARY_PATH_}") set(PIP_INCLUDES "${PIP_INCLUDES}" CACHE STRING "") endif() if(PIP_FIND_VERSION VERSION_GREATER PIP_VERSION) message(FATAL_ERROR "PIP version ${PIP_VERSION} is available, but ${PIP_FIND_VERSION} requested!") endif() set(__module_usb USB ) set(__module_console Console ) set(__module_crypt Crypt ) set(__module_fftw FFTW ) set(__module_compress Compress ) set(__module_opencl OpenCL ) set(__module_io_utils IOUtils ) set(__module_client_server ClientServer) set(__module_cloud Cloud ) set(__module_lua Lua ) set(__module_http_client HTTPClient ) set(__module_http_server HTTPServer ) foreach (_l ${__libs}) set( __inc_${_l} "") set(__deps_${_l} "") set(__libs_${_l} "") endforeach() set(__deps_io_utils "PIP::Crypt" ) set(__deps_client_server "PIP::IOUtils") set(__deps_cloud "PIP::IOUtils") if (BUILDING_PIP) if (NOT SET_TARGETS_PIP) set(SET_TARGETS_PIP ON CACHE BOOL "") #message("create aliases") if((NOT TARGET PIP) AND PIP_LIBRARY) #message("alias PIP = pip") add_library(PIP ALIAS pip) endif() foreach (_l ${__libs}) set(_m ${__module_${_l}}) if((NOT TARGET PIP::${_m}) AND TARGET pip_${_l}) #message("alias PIP::${_m} = pip_${_l}") add_library(PIP::${_m} ALIAS pip_${_l}) endif() endforeach() endif() else() #message("create interfaces") if((NOT TARGET PIP) AND PIP_LIBRARY) add_library(PIP UNKNOWN IMPORTED) set_target_properties(PIP PROPERTIES IMPORTED_LOCATION "${_PIP_LIBRARY_PATH_}" INTERFACE_INCLUDE_DIRECTORIES "${PIP_INCLUDES}" INTERFACE_LINK_LIBRARIES "${_PIP_ADD_LIBS_}") #message("imported PIP = ${PIP_LIBRARY}") endif() foreach (_l ${__libs}) set(_m ${__module_${_l}}) if((NOT TARGET PIP::${_m}) AND PIP_LIBRARY_${_l}) add_library(PIP::${_m} UNKNOWN IMPORTED) set_target_properties(PIP::${_m} PROPERTIES IMPORTED_LOCATION "${PIP_LIBRARY_${_l}}" INTERFACE_INCLUDE_DIRECTORIES "${__inc_${_l}}" INTERFACE_LINK_LIBRARIES "PIP;${__deps_${_l}};${__libs_${_l}}") #message("imported PIP::${_m} = ${PIP_LIBRARY_${_l}} ${__deps_${_l}} ${__libs_${_l}} ${__inc_${_l}}") endif() endforeach() endif() set(PIP_FOUND ON CACHE BOOL "") include(PIPMacros)