# sub-directory 'libbson' was already included at the top-level
# sub-directory 'libmongoc' was already included at the top-level
# sub-directory 'kms-message' was already included at the top-level
add_subdirectory (tools)

# zconf.h is generated by configure_file() in the parent CMakeLists.txt
extra_dist_generated (zlib-1.2.12/zconf.h)
set (src_zlib_DIST
   src/zlib-1.2.12/crc32.h
   src/zlib-1.2.12/deflate.h
   src/zlib-1.2.12/gzguts.h
   src/zlib-1.2.12/inffast.h
   src/zlib-1.2.12/inffixed.h
   src/zlib-1.2.12/inflate.h
   src/zlib-1.2.12/inftrees.h
   src/zlib-1.2.12/trees.h
   src/zlib-1.2.12/zconf.h.in
   src/zlib-1.2.12/zlib.h
   src/zlib-1.2.12/zutil.h
)
# Strip leading directory components to make the paths relative for MakeDist.
# The ZLIB_SOURCES list is set in the top-level CMakeLists.txt.
foreach (zlib_src IN LISTS ZLIB_SOURCES)
   string (REPLACE "${SOURCE_DIR}/" "" zlib_src_rel ${zlib_src})
   list (APPEND src_zlib_DIST ${zlib_src_rel})
endforeach ()

file (GLOB_RECURSE src_kms_message_DIST RELATIVE "${SOURCE_DIR}" kms-message/*)

set_local_dist (src_DIST_local
   CMakeLists.txt
   cpp-check.cpp
)

set (src_DIST
   ${src_DIST_local}
   ${src_tools_DIST}
   ${src_zlib_DIST}
   ${src_common_DIST}
   ${src_kms_message_DIST}
   PARENT_SCOPE
)


if (CMAKE_CXX_COMPILER)
   # Add a C++ source file that will #include the main C headers. This "library"
   # does nothing other than validate that the C headers are valid C++ headers.
   add_library (mongoc-cxx-check STATIC cpp-check.cpp)
   if (TARGET mongoc_static)
      target_link_libraries (mongoc-cxx-check PRIVATE mongoc_static)
   else ()
      target_link_libraries (mongoc-cxx-check PRIVATE mongoc_shared)
   endif ()
endif ()
