diff --git a/CMakeLists.txt b/CMakeLists.txt index e5386fe..eebc803 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,15 @@ pkg_check_modules(LIBFTDIPP REQUIRED libftdipp1) pkg_check_modules(LIBUSB REQUIRED libusb-1.0) pkg_check_modules(LIBUDEV REQUIRED libudev) +# for non glibc, argp-standalone is required and must be +# explicitly linked. This code will fail for others libc +# implementations +include(CheckCXXSourceCompiles) +check_cxx_source_compiles(" + #include + int main(int argc, char **argv) { + argp_parse(NULL, argc, argv, 0, 0, NULL);}" HAVE_ARGP) + set(OPENFPGALOADER_SOURCE src/spiFlash.cpp src/epcq.cpp @@ -90,6 +99,10 @@ target_link_libraries(openFPGALoader ${LIBFTDIPP_LIBRARIES} ) +if(NOT HAVE_ARGP) + target_link_libraries(openFPGALoader /usr/lib/libargp.a) +endif() + # libftdi < 1.4 as no usb_addr if (${LIBFTDI_VERSION} VERSION_LESS 1.4) set(CMAKE_CXX_FLAGS "-DOLD_FTDI_VERSION=1") diff --git a/README.md b/README.md index 3c8606b..926f877 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,11 @@ depending of the distribution, headers too) ```bash apt-get install libftdi1-2 libftdi1-dev libftdipp1-3 libftdipp1-dev libudev-dev cmake ``` -and if not already done, install **pkg-config**, **make** and **g++**. + +For distributions using non-glibc (musl, uClibc) **argp-standalone** must be +installed. + +And if not already done, install **pkg-config**, **make** and **g++**. To build the app: ```bash