Skip to content

Commit ea59e7d

Browse files
authored
Update benchmark/CMakeLists.txt to link with library targets (#1027)
1 parent 25f3318 commit ea59e7d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

benchmark/CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
2626
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Gv")
2727
endif()
2828

29-
include_directories(
30-
${CMAKE_INSTALL_PREFIX}/${BSONCXX_HEADER_INSTALL_DIR}
31-
${CMAKE_INSTALL_PREFIX}/${MONGOCXX_HEADER_INSTALL_DIR}
32-
)
33-
3429
set(BENCHMARK_LIBRARY
3530
bson/bson_decoding.hpp
3631
bson/bson_encoding.hpp
@@ -63,4 +58,12 @@ set_dist_list (benchmark_DIST
6358
add_executable(microbenchmarks ${BENCHMARK_LIBRARY})
6459
set(THREADS_PREFER_PTHREAD_FLAG ON)
6560
find_package(Threads REQUIRED)
66-
target_link_libraries(microbenchmarks mongocxx bsoncxx Threads::Threads)
61+
target_link_libraries(microbenchmarks PRIVATE Threads::Threads)
62+
63+
if(MONGOCXX_BUILD_SHARED)
64+
target_link_libraries(microbenchmarks PRIVATE mongocxx_shared)
65+
endif()
66+
67+
if(MONGOCXX_BUILD_STATIC)
68+
target_link_libraries(microbenchmarks PRIVATE mongocxx_static)
69+
endif()

0 commit comments

Comments
 (0)