1#############################################################################
2# $Id: CMake.NCBIComponents.cmake 620492 2020-11-23 18:41:26Z gouriano $
3#############################################################################
4
5##
6## NCBI CMake components description
7##
8##
9## As a result, the following variables should be defined for component XXX
10##  NCBI_COMPONENT_XXX_FOUND
11##  NCBI_COMPONENT_XXX_INCLUDE
12##  NCBI_COMPONENT_XXX_DEFINES
13##  NCBI_COMPONENT_XXX_LIBS
14##  HAVE_LIBXXX
15
16
17#############################################################################
18set(NCBI_ALL_COMPONENTS "")
19set(NCBI_ALL_LEGACY "")
20set(NCBI_ALL_REQUIRES "")
21
22set(NCBI_REQUIRE_MT_FOUND YES)
23list(APPEND NCBI_ALL_REQUIRES MT)
24if(BUILD_SHARED_LIBS)
25    set(NCBI_REQUIRE_DLL_BUILD_FOUND YES)
26    list(APPEND NCBI_ALL_REQUIRES DLL_BUILD)
27endif()
28
29if(NOT "${NCBI_PTBCFG_PROJECT_COMPONENTS}" STREQUAL "")
30    foreach(_comp IN LISTS NCBI_PTBCFG_PROJECT_COMPONENTS)
31        if("${_comp}" STREQUAL "")
32            continue()
33        endif()
34        string(SUBSTRING ${_comp} 0 1 _sign)
35        if ("${_sign}" STREQUAL "-")
36            string(SUBSTRING ${_comp} 1 -1 _comp)
37            set(NCBI_COMPONENT_${_comp}_DISABLED YES)
38        else()
39            set(NCBI_COMPONENT_${_comp}_DISABLED NO)
40        endif()
41    endforeach()
42endif()
43
44#############################################################################
45#############################################################################
46# components definition functions (unix)
47
48string(REPLACE ":" ";" NCBI_PKG_CONFIG_PATH  "$ENV{PKG_CONFIG_PATH}")
49set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
50#message("NCBI_PKG_CONFIG_PATH init = ${NCBI_PKG_CONFIG_PATH}")
51
52#############################################################################
53function(NCBI_get_component_locations _sub _type)
54    if(APPLE)
55        if("${CMAKE_BUILD_TYPE}" STREQUAL "")
56            set(_cmake_build_type Release)
57            set(_ncbi_build_type  Release${NCBI_PlatformBits})
58        else()
59            set(_cmake_build_type ${CMAKE_BUILD_TYPE})
60            set(_ncbi_build_type  ${CMAKE_BUILD_TYPE}${NCBI_PlatformBits})
61        endif()
62    else()
63        set(_cmake_build_type ${CMAKE_BUILD_TYPE})
64        set(_ncbi_build_type  ${NCBI_BUILD_TYPE})
65    endif()
66    set(_dirs   ${NCBI_COMPILER}${NCBI_COMPILER_VERSION}-${_ncbi_build_type}/${_type}
67                ${NCBI_COMPILER}-${_ncbi_build_type}/${_type}
68                ${_ncbi_build_type}/${_type}
69                ${_cmake_build_type}${NCBI_PlatformBits}/${_type}
70                ${_type}${NCBI_PlatformBits} ${_type})
71    if(DEFINED NCBI_COMPILER_COMPONENTS)
72        set(_components ${NCBI_COMPILER_COMPONENTS})
73        list(REVERSE _components)
74        foreach(_c IN LISTS _components)
75            set(_dirs ${_c}-${_ncbi_build_type}/${_type} ${_dirs})
76        endforeach()
77    endif()
78    set(${_sub} ${_dirs} PARENT_SCOPE)
79endfunction()
80
81#############################################################################
82function(NCBI_find_package _name _package)
83    if(NCBI_COMPONENT_${_name}_DISABLED)
84        message("DISABLED ${_name}")
85        return()
86    endif()
87# root
88    set(_root "")
89    if (DEFINED NCBI_ThirdParty_${_name})
90        set(_root ${NCBI_ThirdParty_${_name}})
91    else()
92        string(FIND ${_name} "." dotfound)
93        string(SUBSTRING ${_name} 0 ${dotfound} _dotname)
94        if (DEFINED NCBI_ThirdParty_${_dotname})
95            set(_root ${NCBI_ThirdParty_${_dotname}})
96#        else()
97#            message("NOT FOUND ${_name}: NCBI_ThirdParty_${_name} not found")
98#            return()
99        endif()
100    endif()
101    set(_roots ${_root})
102    NCBI_get_component_locations( _subdirs lib)
103
104    if("${_root}" STREQUAL "")
105        if(NCBI_TRACE_COMPONENT_${_name})
106            find_package(${_package})
107        else()
108            find_package(${_package} QUIET)
109        endif()
110        string(TOUPPER ${_package} _uppackage)
111        if (${_package}_FOUND OR ${_uppackage}_FOUND)
112            if( DEFINED ${_uppackage}_LIBRARIES OR DEFINED ${_uppackage}_INCLUDE_DIRS OR
113                DEFINED ${_uppackage}_LIBRARY   OR DEFINED ${_uppackage}_INCLUDE_DIR)
114                set(_package ${_uppackage})
115            endif()
116            if(DEFINED ${_package}_INCLUDE_DIRS)
117                set(_pkg_include ${${_package}_INCLUDE_DIRS})
118            elseif(DEFINED ${_package}_INCLUDE_DIR)
119                set(_pkg_include ${${_package}_INCLUDE_DIR})
120            else()
121                set(_pkg_include "")
122            endif()
123            if(DEFINED ${_package}_LIBRARIES)
124                set(_pkg_libs ${${_package}_LIBRARIES})
125            elseif(DEFINED ${_package}_LIBRARY)
126                set(_pkg_libs ${${_package}_LIBRARY})
127            else()
128                set(_pkg_libs "")
129            endif()
130            set(NCBI_COMPONENT_${_name}_INCLUDE ${_pkg_include} PARENT_SCOPE)
131            set(NCBI_COMPONENT_${_name}_LIBS ${_pkg_libs} PARENT_SCOPE)
132            if(DEFINED ${_package}_DEFINITIONS)
133                set(NCBI_COMPONENT_${_name}_DEFINES ${${_package}_DEFINITIONS} PARENT_SCOPE)
134                set(_pkg_defines ${${_package}_DEFINITIONS})
135            endif()
136            if(DEFINED ${_package}_VERSION_STRING)
137                set(_pkg_version ${${_package}_VERSION_STRING})
138            elseif(DEFINED ${_package}_VERSION)
139                set(_pkg_version ${${_package}_VERSION})
140            else()
141                set(_pkg_version "")
142            endif()
143            set(_root ${_pkg_libs})
144            set(_all_found YES)
145        endif()
146    else()
147        set(_all_found NO)
148        if(NCBI_TRACE_COMPONENT_${_name})
149            message("NCBI_find_package: ${_name}: checking ${_root}: ${_subdirs}")
150        endif()
151        foreach(_root IN LISTS _roots)
152            foreach(_libdir IN LISTS _subdirs)
153                if(EXISTS ${_root}/${_libdir}/pkgconfig)
154                    set(_pkgcfg ${NCBI_PKG_CONFIG_PATH})
155                    if(NOT ${_root}/${_libdir}/pkgconfig IN_LIST _pkgcfg)
156                        list(INSERT _pkgcfg 0 ${_root}/${_libdir}/pkgconfig)
157                    endif()
158                    set(CMAKE_PREFIX_PATH ${_pkgcfg})
159                    string(REPLACE ";" ":" _config_path  "${_pkgcfg}")
160                    set(ENV{PKG_CONFIG_PATH} "${_config_path}")
161                    if(NCBI_TRACE_COMPONENT_${_name})
162                        message("PKG_CONFIG_PATH = $ENV{PKG_CONFIG_PATH}")
163                    endif()
164                    unset(${_name}_FOUND CACHE)
165                    if(DEFINED ${_name}_STATIC_LIBRARIES)
166                        foreach(_lib IN LISTS ${_name}_STATIC_LIBRARIES)
167                            if(NOT "${pkgcfg_lib_${_name}_${_lib}}" STREQUAL "")
168                                unset(pkgcfg_lib_${_name}_${_lib} CACHE)
169                            endif()
170                        endforeach()
171                    endif()
172                    if(NCBI_TRACE_COMPONENT_${_name})
173                        pkg_check_modules(${_name} ${_package})
174                    else()
175                        pkg_search_module(${_name} QUIET ${_package})
176                    endif()
177
178                    if(${_name}_FOUND)
179                        if(NOT ${_root}/${_libdir}/pkgconfig IN_LIST NCBI_PKG_CONFIG_PATH)
180                            list(INSERT NCBI_PKG_CONFIG_PATH 0 ${_root}/${_libdir}/pkgconfig)
181                            set(NCBI_PKG_CONFIG_PATH ${NCBI_PKG_CONFIG_PATH} PARENT_SCOPE)
182                        endif()
183                        set(NCBI_COMPONENT_${_name}_INCLUDE ${${_name}_INCLUDE_DIRS} PARENT_SCOPE)
184                        set(NCBI_COMPONENT_${_name}_LIBS ${${_name}_LINK_LIBRARIES} PARENT_SCOPE)
185                        if(NCBI_TRACE_COMPONENT_${_name})
186                            message("${_name}_LIBRARIES = ${${_name}_LIBRARIES}")
187                            message("${_name}_CFLAGS = ${${_name}_CFLAGS}")
188                            message("${_name}_CFLAGS_OTHER = ${${_name}_CFLAGS_OTHER}")
189                            message("${_name}_LDFLAGS = ${${_name}_LDFLAGS}")
190                        endif()
191                        if(NOT "${${_name}_CFLAGS}" STREQUAL "")
192                            set(_pkg_defines "")
193                            foreach( _value IN LISTS ${_name}_CFLAGS)
194                                string(FIND ${_value} "-D" _pos)
195                                if(${_pos} EQUAL 0)
196                                string(SUBSTRING ${_value} 2 -1 _pos)
197                                    list(APPEND _pkg_defines ${_pos})
198                                endif()
199                            endforeach()
200                            set(NCBI_COMPONENT_${_name}_DEFINES ${_pkg_defines} PARENT_SCOPE)
201                        endif()
202                        set(_pkg_include ${${_name}_INCLUDE_DIRS})
203                        set(_pkg_libs ${${_name}_LINK_LIBRARIES})
204                        set(_pkg_version ${${_name}_VERSION})
205if(OFF AND NOT APPLE)
206                        if(NOT BUILD_SHARED_LIBS)
207                            set(_lib "")
208                            set(_libs "")
209                            foreach(_lib IN LISTS ${_name}_LINK_LIBRARIES)
210                                string(REGEX REPLACE "[.]so$" ".a" _stlib ${_lib})
211                                if(EXISTS ${_stlib})
212                                    list(APPEND _libs ${_stlib})
213                                else()
214                                    set(_libs "")
215                                    break()
216                                endif()
217                            endforeach()
218                            if(NOT "${_libs}" STREQUAL "")
219                                set(NCBI_COMPONENT_${_name}_LIBS ${_libs} PARENT_SCOPE)
220                            endif()
221                        endif()
222endif()
223                        set(_all_found YES)
224                        break()
225                    endif()
226                endif()
227            endforeach()
228            if(_all_found)
229                break()
230            endif()
231    endforeach()
232    endif()
233
234    if(_all_found)
235        message(STATUS "Found ${_name}: ${_root} (version ${_pkg_version})")
236        if(NCBI_TRACE_COMPONENT_${_name})
237            message("${_name}: include dir = ${_pkg_include}")
238            message("${_name}: libs = ${_pkg_libs}")
239            if(DEFINED _pkg_defines)
240                message("${_name}: defines = ${_pkg_defines}")
241            endif()
242        endif()
243        set(NCBI_COMPONENT_${_name}_FOUND YES PARENT_SCOPE)
244
245        string(TOUPPER ${_name} _upname)
246        set(HAVE_LIB${_upname} 1 PARENT_SCOPE)
247        string(REPLACE "." "_" _altname ${_upname})
248        set(HAVE_${_altname} 1 PARENT_SCOPE)
249
250        list(APPEND NCBI_ALL_COMPONENTS ${_name})
251        set(NCBI_ALL_COMPONENTS ${NCBI_ALL_COMPONENTS} PARENT_SCOPE)
252    else()
253        set(NCBI_COMPONENT_${_name}_FOUND NO PARENT_SCOPE)
254        message("NOT FOUND ${_name}: package not found")
255    endif()
256endfunction()
257
258#############################################################################
259function(NCBI_define_component _name)
260
261    if(NCBI_COMPONENT_${_name}_DISABLED)
262        message("DISABLED ${_name}")
263        return()
264    endif()
265    if(APPLE)
266        if(BUILD_SHARED_LIBS OR TRUE)
267            set(_suffixes .dylib .a)
268        else()
269            set(_suffixes .a .dylib)
270        endif()
271    else()
272        if(BUILD_SHARED_LIBS OR TRUE)
273            set(_suffixes .so .a)
274        else()
275            set(_suffixes .a .so)
276        endif()
277    endif()
278
279# root
280    set(_root "")
281    if (DEFINED NCBI_ThirdParty_${_name})
282        set(_root ${NCBI_ThirdParty_${_name}})
283    else()
284        string(FIND ${_name} "." dotfound)
285        string(SUBSTRING ${_name} 0 ${dotfound} _dotname)
286        if (DEFINED NCBI_ThirdParty_${_dotname})
287            set(_root ${NCBI_ThirdParty_${_dotname}})
288        else()
289            message("NOT FOUND ${_name}: NCBI_ThirdParty_${_name} not found")
290            return()
291        endif()
292    endif()
293
294    set(_args ${ARGN})
295    set(_roots ${_root})
296
297# include dir
298    NCBI_get_component_locations(_subdirs include)
299    if(NCBI_TRACE_COMPONENT_${_name})
300        message("${_name}: checking ${_root}: ${_subdirs}")
301    endif()
302    set(_inc "")
303    foreach(_libdir IN LISTS _subdirs)
304        if (EXISTS ${_root}/${_libdir})
305            set(_inc ${_root}/${_libdir})
306            break()
307        endif()
308    endforeach()
309    if("${_inc}" STREQUAL "")
310        message("NOT FOUND ${_name}: ${_root}/include not found")
311        return()
312    endif()
313    set(NCBI_COMPONENT_${_name}_INCLUDE ${_inc} PARENT_SCOPE)
314    if(NCBI_TRACE_COMPONENT_${_name})
315        message("${_name}: include dir = ${_inc}")
316    endif()
317
318# libraries
319    NCBI_get_component_locations(_subdirs lib)
320    if(NCBI_TRACE_COMPONENT_${_name})
321        message("${_name}: checking ${_root}: ${_subdirs}")
322    endif()
323    if (BUILD_SHARED_LIBS AND DEFINED NCBI_ThirdParty_${_name}_SHLIB)
324        set(_roots ${NCBI_ThirdParty_${_name}_SHLIB} ${_roots})
325        set(_subdirs shlib64 shlib lib64 lib)
326    endif()
327
328    set(_all_found YES)
329    set(_all_libs "")
330    foreach(_root IN LISTS _roots)
331        foreach(_libdir IN LISTS _subdirs)
332            set(_all_found NO)
333            set(_all_libs "")
334            if (EXISTS ${_root}/${_libdir})
335                set(_all_found YES)
336                set(_all_libs "")
337                foreach(_lib IN LISTS _args)
338                    set(_this_found NO)
339                    foreach(_sfx IN LISTS _suffixes)
340                        if(EXISTS ${_root}/${_libdir}/lib${_lib}${_sfx})
341                            list(APPEND _all_libs ${_root}/${_libdir}/lib${_lib}${_sfx})
342                            set(_this_found YES)
343                            if(NCBI_TRACE_COMPONENT_${_name})
344                                message("${_name}: found:  ${_root}/${_libdir}/lib${_lib}${_sfx}")
345                            endif()
346                            break()
347                        endif()
348                    endforeach()
349                    if(NOT _this_found)
350                        if(NCBI_TRACE_COMPONENT_${_name})
351                            message("${_name}: not found: ${_root}/${_libdir}/lib${_lib}${_sfx}")
352                        endif()
353                        set(_all_found NO)
354                        break()
355                    endif()
356                endforeach()
357            endif()
358            if("${_args}" STREQUAL "")
359                set(_all_found YES)
360            endif()
361            if(_all_found)
362                break()
363            endif()
364        endforeach()
365        if(_all_found)
366            break()
367        endif()
368    endforeach()
369
370    if(_all_found)
371        message(STATUS "Found ${_name}: ${_root}")
372        set(NCBI_COMPONENT_${_name}_FOUND YES PARENT_SCOPE)
373#        set(NCBI_COMPONENT_${_name}_INCLUDE ${_root}/include)
374        set(NCBI_COMPONENT_${_name}_LIBS ${_all_libs} PARENT_SCOPE)
375
376        string(TOUPPER ${_name} _upname)
377        set(HAVE_LIB${_upname} 1 PARENT_SCOPE)
378        string(REPLACE "." "_" _altname ${_upname})
379        set(HAVE_${_altname} 1 PARENT_SCOPE)
380
381        list(APPEND NCBI_ALL_COMPONENTS ${_name})
382        set(NCBI_ALL_COMPONENTS ${NCBI_ALL_COMPONENTS} PARENT_SCOPE)
383    else()
384        set(NCBI_COMPONENT_${_name}_FOUND NO PARENT_SCOPE)
385        message("NOT FOUND ${_name}: some libraries not found at ${_root}")
386    endif()
387
388endfunction()
389
390#############################################################################
391macro(NCBI_find_library _name)
392    if(NOT NCBI_COMPONENT_${_name}_DISABLED)
393        set(_args ${ARGN})
394        set(_all_libs "")
395        set(_notfound_libs "")
396        foreach(_lib IN LISTS _args)
397            find_library(${_lib}_LIBS ${_lib})
398            if (${_lib}_LIBS)
399                list(APPEND _all_libs ${${_lib}_LIBS})
400            else()
401                list(APPEND _notfound_libs ${_lib})
402            endif()
403        endforeach()
404        if("${_notfound_libs}" STREQUAL "")
405            set(NCBI_COMPONENT_${_name}_FOUND YES)
406            set(NCBI_COMPONENT_${_name}_LIBS ${_all_libs})
407            list(APPEND NCBI_ALL_COMPONENTS ${_name})
408            message(STATUS "Found ${_name}: ${NCBI_COMPONENT_${_name}_LIBS}")
409
410            string(TOUPPER ${_name} _upname)
411            set(HAVE_LIB${_upname} 1)
412            set(HAVE_${_upname} 1)
413        else()
414            set(NCBI_COMPONENT_${_name}_FOUND NO)
415            message("NOT FOUND ${_name}: some libraries not found: ${_notfound_libs}")
416        endif()
417    else()
418        message("DISABLED ${_name}")
419    endif()
420endmacro()
421
422#############################################################################
423# Windows
424function(NCBI_define_Wcomponent _name)
425
426    if(NCBI_COMPONENT_${_name}_DISABLED)
427        message("DISABLED ${_name}")
428        return()
429    endif()
430# root
431    if (DEFINED NCBI_ThirdParty_${_name})
432        set(_root ${NCBI_ThirdParty_${_name}})
433    else()
434        string(FIND ${_name} "." dotfound)
435        string(SUBSTRING ${_name} 0 ${dotfound} _dotname)
436        if (DEFINED NCBI_ThirdParty_${_dotname})
437            set(_root ${NCBI_ThirdParty_${_dotname}})
438        else()
439            message("NOT FOUND ${_name}: NCBI_ThirdParty_${_name} not found")
440            return()
441        endif()
442    endif()
443# include dir
444    if (EXISTS ${_root}/include)
445        set(_found YES)
446    else()
447        message("NOT FOUND ${_name}: ${_root}/include not found")
448        set(_found NO)
449    endif()
450# libraries
451    set(_args ${ARGN})
452    if (_found)
453        if(BUILD_SHARED_LIBS)
454            set(_locations lib_dll lib_static lib)
455        else()
456            set(_locations lib_static lib_dll lib)
457        endif()
458        set(_rt ${NCBI_CONFIGURATION_RUNTIMELIB})
459
460        foreach(_libdir IN LISTS _locations)
461            set(_found YES)
462            foreach(_cfg ${NCBI_CONFIGURATION_TYPES})
463                if(NCBI_TRACE_COMPONENT_${_name})
464                    message("${_name}: checking ${_root}/${_libdir}/${_cfg}${_rt}")
465                endif()
466                foreach(_lib IN LISTS _args)
467                    if(NOT EXISTS ${_root}/${_libdir}/${_cfg}${_rt}/${_lib})
468                        if(NCBI_TRACE_COMPONENT_${_name})
469                            message("${_name}: ${_root}/${_libdir}/${_cfg}${_rt}/${_lib} not found")
470                        endif()
471                        set(_found NO)
472                    endif()
473                endforeach()
474            endforeach()
475            if (_found)
476#                set(_libtype ${_libdir}/\$\(Configuration\))
477                set(_libtype ${_libdir}/$<CONFIG>${_rt})
478                break()
479            endif()
480        endforeach()
481
482        if (NOT _found)
483            set(_found YES)
484            foreach(_cfg ${NCBI_CONFIGURATION_TYPES})
485                if(NCBI_TRACE_COMPONENT_${_name})
486                    message("${_name}: checking ${_root}/${_cfg}${_rt}")
487                endif()
488                foreach(_lib IN LISTS _args)
489                    if(NOT EXISTS ${_root}/${_cfg}${_rt}/${_lib})
490                        if(NCBI_TRACE_COMPONENT_${_name})
491                            message("${_name}: ${_root}/${_cfg}${_rt}/${_lib} not found")
492                        endif()
493                        set(_found NO)
494                    endif()
495                endforeach()
496            endforeach()
497            if (_found)
498#                set(_libtype \$\(Configuration\))
499                set(_libtype $<CONFIG>${_rt})
500            endif()
501        endif()
502
503        if (NOT _found)
504            set(_locations lib libs)
505            foreach(_libdir IN LISTS _locations)
506                set(_found YES)
507                if(NCBI_TRACE_COMPONENT_${_name})
508                    message("${_name}: checking ${_root}/${_libdir}")
509                endif()
510                foreach(_lib IN LISTS _args)
511                    if(NOT EXISTS ${_root}/${_libdir}/${_lib})
512                        if(NCBI_TRACE_COMPONENT_${_name})
513                            message("${_name}: ${_root}/${_libdir}/${_lib} not found")
514                        endif()
515                        set(_found NO)
516                    endif()
517                endforeach()
518                if (_found)
519                    set(_libtype ${_libdir})
520                    break()
521                endif()
522            endforeach()
523        endif()
524
525        if (NOT _found)
526            message("NOT FOUND ${_name}: some libraries not found at ${_root}")
527        endif()
528    endif()
529
530    if (_found)
531        message(STATUS "Found ${_name}: ${_root}")
532        set(NCBI_COMPONENT_${_name}_FOUND YES PARENT_SCOPE)
533        set(NCBI_COMPONENT_${_name}_INCLUDE ${_root}/include PARENT_SCOPE)
534        foreach(_lib IN LISTS _args)
535            set(NCBI_COMPONENT_${_name}_LIBS ${NCBI_COMPONENT_${_name}_LIBS} ${_root}/${_libtype}/${_lib})
536        endforeach()
537        set(NCBI_COMPONENT_${_name}_LIBS ${NCBI_COMPONENT_${_name}_LIBS} PARENT_SCOPE)
538        if (EXISTS ${_root}/bin)
539            set(NCBI_COMPONENT_${_name}_BINPATH ${_root}/bin PARENT_SCOPE)
540        endif()
541
542        string(TOUPPER ${_name} _upname)
543        set(HAVE_LIB${_upname} 1 PARENT_SCOPE)
544        string(REPLACE "." "_" _altname ${_upname})
545        set(HAVE_${_altname} 1 PARENT_SCOPE)
546
547        list(APPEND NCBI_ALL_COMPONENTS ${_name})
548        set(NCBI_ALL_COMPONENTS ${NCBI_ALL_COMPONENTS} PARENT_SCOPE)
549    else()
550        set(NCBI_COMPONENT_${_name}_FOUND NO PARENT_SCOPE)
551    endif()
552endfunction()
553
554#############################################################################
555#############################################################################
556
557
558#############################################################################
559# local_lbsm
560if(WIN32 OR CYGWIN)
561    set(NCBI_COMPONENT_local_lbsm_FOUND NO)
562else()
563    if (EXISTS ${NCBITK_SRC_ROOT}/connect/ncbi_lbsm.c)
564        set(NCBI_COMPONENT_local_lbsm_FOUND YES)
565        list(APPEND NCBI_ALL_REQUIRES local_lbsm)
566        set(HAVE_LOCAL_LBSM 1)
567    else()
568        set(NCBI_COMPONENT_local_lbsm_FOUND NO)
569    endif()
570endif()
571
572#############################################################################
573# LocalPCRE
574if (EXISTS ${NCBITK_INC_ROOT}/util/regexp)
575  set(NCBI_COMPONENT_LocalPCRE_FOUND YES)
576  list(APPEND NCBI_ALL_REQUIRES LocalPCRE)
577  set(NCBI_COMPONENT_LocalPCRE_INCLUDE ${NCBITK_INC_ROOT}/util/regexp)
578  set(NCBI_COMPONENT_LocalPCRE_NCBILIB regexp)
579else()
580  set(NCBI_COMPONENT_LocalPCRE_FOUND NO)
581endif()
582
583#############################################################################
584# LocalZ
585if (EXISTS ${NCBITK_INC_ROOT}/util/compress/zlib)
586  set(NCBI_COMPONENT_LocalZ_FOUND YES)
587  list(APPEND NCBI_ALL_REQUIRES LocalZ)
588  set(NCBI_COMPONENT_LocalZ_INCLUDE ${NCBITK_INC_ROOT}/util/compress/zlib)
589  set(NCBI_COMPONENT_LocalZ_NCBILIB z)
590else()
591  set(NCBI_COMPONENT_LocalZ_FOUND NO)
592endif()
593
594#############################################################################
595# LocalBZ2
596if (EXISTS ${NCBITK_INC_ROOT}/util/compress/bzip2)
597  set(NCBI_COMPONENT_LocalBZ2_FOUND YES)
598  list(APPEND NCBI_ALL_REQUIRES LocalBZ2)
599  set(NCBI_COMPONENT_LocalBZ2_INCLUDE ${NCBITK_INC_ROOT}/util/compress/bzip2)
600  set(NCBI_COMPONENT_LocalBZ2_NCBILIB bz2)
601else()
602  set(NCBI_COMPONENT_LocalBZ2_FOUND NO)
603endif()
604
605#############################################################################
606# LocalLMDB
607if (EXISTS ${NCBITK_INC_ROOT}/util/lmdb AND NOT CYGWIN)
608  set(NCBI_COMPONENT_LocalLMDB_FOUND YES)
609  list(APPEND NCBI_ALL_REQUIRES LocalLMDB)
610  set(NCBI_COMPONENT_LocalLMDB_INCLUDE ${NCBITK_INC_ROOT}/util/lmdb)
611  set(NCBI_COMPONENT_LocalLMDB_NCBILIB lmdb)
612else()
613  set(NCBI_COMPONENT_LocalLMDB_FOUND NO)
614endif()
615
616#############################################################################
617# connext
618if (EXISTS ${NCBITK_SRC_ROOT}/connect/ext/CMakeLists.txt)
619  set(NCBI_REQUIRE_connext_FOUND YES)
620  set(HAVE_LIBCONNEXT 1)
621  list(APPEND NCBI_ALL_REQUIRES connext)
622endif()
623
624#############################################################################
625# PubSeqOS
626if (EXISTS ${NCBITK_SRC_ROOT}/objtools/data_loaders/genbank/pubseq/CMakeLists.txt)
627  set(NCBI_REQUIRE_PubSeqOS_FOUND YES)
628  list(APPEND NCBI_ALL_REQUIRES PubSeqOS)
629endif()
630
631#############################################################################
632# FreeTDS
633set(FTDS95_INCLUDE  ${NCBITK_INC_ROOT}/dbapi/driver/ftds95  ${NCBITK_INC_ROOT}/dbapi/driver/ftds95/freetds)
634set(FTDS100_INCLUDE ${NCBITK_INC_ROOT}/dbapi/driver/ftds100 ${NCBITK_INC_ROOT}/dbapi/driver/ftds100/freetds)
635
636set(NCBI_COMPONENT_FreeTDS_FOUND   YES)
637set(HAVE_LIBFTDS 1)
638list(APPEND NCBI_ALL_REQUIRES FreeTDS)
639set(NCBI_COMPONENT_FreeTDS_INCLUDE ${FTDS100_INCLUDE})
640#set(NCBI_COMPONENT_FreeTDS_LIBS    ct_ftds100)
641
642#############################################################################
643set(NCBI_COMPONENT_Boost.Test.Included_NCBILIB test_boost)
644set(NCBI_COMPONENT_SQLITE3_NCBILIB sqlitewrapp)
645set(NCBI_COMPONENT_Sybase_NCBILIB  ncbi_xdbapi_ctlib)
646set(NCBI_COMPONENT_ODBC_NCBILIB    ncbi_xdbapi_odbc)
647set(NCBI_COMPONENT_FreeTDS_NCBILIB ct_ftds100 ncbi_xdbapi_ftds)
648set(NCBI_COMPONENT_connext_NCBILIB xconnext)
649
650#############################################################################
651if (MSVC)
652  include(${NCBI_TREE_CMAKECFG}/CMake.NCBIComponentsMSVC.cmake)
653elseif (APPLE)
654  include(${NCBI_TREE_CMAKECFG}/CMake.NCBIComponentsXCODE.cmake)
655else()
656    if(ON)
657        include(${NCBI_TREE_CMAKECFG}/CMake.NCBIComponentsUNIXex.cmake)
658    else()
659        include(${NCBI_TREE_CMAKECFG}/CMake.NCBIComponentsUNIX.cmake)
660    endif()
661endif()
662
663#############################################################################
664# FreeTDS
665set(FTDS95_INCLUDE  ${NCBITK_INC_ROOT}/dbapi/driver/ftds95  ${NCBITK_INC_ROOT}/dbapi/driver/ftds95/freetds)
666set(FTDS100_INCLUDE ${NCBITK_INC_ROOT}/dbapi/driver/ftds100 ${NCBITK_INC_ROOT}/dbapi/driver/ftds100/freetds)
667
668#############################################################################
669list(SORT NCBI_ALL_LEGACY)
670list(APPEND NCBI_ALL_COMPONENTS ${NCBI_ALL_LEGACY})
671list(SORT NCBI_ALL_COMPONENTS)
672list(SORT NCBI_ALL_REQUIRES)
673