mirror of
https://github.com/mariusgreuel/avrdude.git
synced 2025-09-28 06:55:27 +00:00
CMake: Add build option to select static or shared libraries
This commit is contained in:
@@ -35,6 +35,13 @@ option(USE_LIBUSBWIN32 "Prefer libusb-win32 over libusb" OFF)
|
|||||||
option(DEBUG_CMAKE "Enable debugging output for this CMake project" OFF)
|
option(DEBUG_CMAKE "Enable debugging output for this CMake project" OFF)
|
||||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
# Prefer static libraries over DLLs on Windows
|
||||||
|
option(USE_STATIC_LIBS "Use static libraries" ON)
|
||||||
|
else()
|
||||||
|
option(USE_STATIC_LIBS "Use static libraries" OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
@@ -110,8 +117,7 @@ endif()
|
|||||||
# Detect installed libraries
|
# Detect installed libraries
|
||||||
# =====================================
|
# =====================================
|
||||||
|
|
||||||
# Prefer static libraries over DLLs on Windows
|
if(USE_STATIC_LIBS)
|
||||||
if(WIN32)
|
|
||||||
set(PREFERRED_LIBELF libelf.a elf)
|
set(PREFERRED_LIBELF libelf.a elf)
|
||||||
set(PREFERRED_LIBUSB libusb.a usb)
|
set(PREFERRED_LIBUSB libusb.a usb)
|
||||||
set(PREFERRED_LIBUSB_1_0 libusb-1.0.a usb-1.0)
|
set(PREFERRED_LIBUSB_1_0 libusb-1.0.a usb-1.0)
|
||||||
|
Reference in New Issue
Block a user