From 7e280ec8a49aaf26976d72a4080f2e2c6756f2b7 Mon Sep 17 00:00:00 2001 From: Tao He Date: Sun, 20 Dec 2020 14:54:25 +0800 Subject: [PATCH] Install dll to bin/ on windows. Signed-off-by: Tao He --- CMakeLists.txt | 1 + src/CMakeLists.txt | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dd8e9d..ec6314f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ set(etcd-cpp-api_VERSION_MAJOR 0) set(etcd-cpp-api_VERSION_MINOR 1) option(BUILD_ETCD_TESTS "Build test cases" OFF) +option(BUILD_SHARED_LIBS "Build shared libraries" ON) find_package(Boost REQUIRED COMPONENTS system thread locale random) if (APPLE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 60f7667..23f5bbd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -17,4 +17,8 @@ target_link_libraries(etcd-cpp-api PUBLIC target_include_directories(etcd-cpp-api PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../proto/gen) target_include_directories(etcd-cpp-api PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../proto/gen/proto) -install (TARGETS etcd-cpp-api DESTINATION lib) +if (WIN32 AND BUILD_SHARED_LIBS) + install (TARGETS etcd-cpp-api RUNTIME DESTINATION bin) +else() + install (TARGETS etcd-cpp-api LIBRARY DESTINATION lib) +endif()