-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakelists.txt
30 lines (26 loc) · 928 Bytes
/
CMakelists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
cmake_minimum_required(VERSION 3.15)
project (get_started_c LANGUAGES C)
# Find the MongoDB C Driver package
# NOTE: For this to work, the CMAKE_PREFIX_PATH variable must be set to point to
# the directory where libmongoc is installed.
find_package (mongoc-1.0 REQUIRED)
# Your project sources
set(SOURCES
bcon.c
delete.c
find.c
hello_mongoc.c
insert.c
list_collections.c
update.c
# Add other source files here
)
# Loop through each source file
foreach(source_file IN LISTS SOURCES)
# Get the name of the file without the extension (e.g. 'bcon' from 'bcon.c')
get_filename_component(target_name ${source_file} NAME_WE)
# Create an executable with the above name, building the above source
add_executable("${target_name}" "${source_file}")
# Link against the MongoDB C Driver (libmongoc)
target_link_libraries("${target_name}" PRIVATE mongo::mongoc_shared)
endforeach()