From 8374564665c2d18414c87d40d1797e8a8ded63c2 Mon Sep 17 00:00:00 2001 From: Yegor Yefremov Date: Tue, 11 Jan 2022 12:02:36 +0100 Subject: [PATCH 1/2] CMake: enable dynamic-link library for libavrdude Add on option BUILD_SHARED_LIBS to also build a DLL variant of the libavrdude library. Turn it off by default to preserve current behavior. --- src/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8fbb21d7..ca1cb350 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -33,6 +33,7 @@ option(HAVE_PARPORT "Enable parallel port support" OFF) option(USE_EXTERNAL "Use external libraries from AVRDUDE GitHub repositories" OFF) option(USE_LIBUSBWIN32 "Prefer libusb-win32 over libusb" OFF) option(DEBUG_CMAKE "Enable debugging output for this CMake project" OFF) +option(BUILD_SHARED_LIBS "Build shared libraries" OFF) include(CheckIncludeFile) include(CheckSymbolExists) @@ -476,7 +477,7 @@ endif() # Project # ===================================== -add_library(libavrdude STATIC +add_library(libavrdude ac_cfg.h arduino.h arduino.c From e72fa01073572cc5b84fc767689971efe1cde2e5 Mon Sep 17 00:00:00 2001 From: Yegor Yefremov Date: Tue, 11 Jan 2022 14:58:40 +0100 Subject: [PATCH 2/2] Fix libavrdude library file name CMake adds "lib" prefix to the library name and hence we get the following name "liblibavrdude". Use set_target_properties to set the prefix to "". --- src/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ca1cb350..3dfd6778 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -586,6 +586,8 @@ add_library(libavrdude ${BISON_Parser_OUTPUTS} ) +set_target_properties(libavrdude PROPERTIES PREFIX "") + target_include_directories(libavrdude PUBLIC "${PROJECT_SOURCE_DIR}"