libftdi Archives

Subject: Re: static linking against libftdi?

From: Chris Morgan <chmorgan@xxxxxxxxx>
To: "libftdi@xxxxxxxxxxxxxxxxxxxxxxx" <libftdi@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 28 Jan 2014 08:53:53 -0500
On Tue, Jan 28, 2014 at 4:53 AM,
<bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>>>>>> "Chris" == Chris Morgan <chmorgan@xxxxxxxxx> writes:
>
>     Chris> How do I use that script? Do I just include it like:
>
> In xc3sprog/CMakeLists.txt I have
> ...
> set(USE_STATIC_FTDI ON)
> ...
> find_package(libftdi)
> include_directories(${LIBFTDI_INCLUDE_DIR})
> ...
> add_executable(detectchain detectchain.cpp cables.h devices.h)
> target_link_libraries(detectchain xc3sproglib ${LIBFTDI_LIBRARIES} 
> ${LIBFTD2XX_LIBRARIES} ${CONDITIONAL_LIBS})
>
> add_executable(xc3sprog xc3sprog.cpp javr.cpp srecfile.cpp progalgavr.cpp
>                         devices.h)
> target_link_libraries(xc3sprog xc3sproglib ${LIBFTDI_LIBRARIES}  
> ${LIBFTD2XX_LIBRARIES} ${CONDITIONAL_LIBS}  )
>
> add_executable(readdna readdna.cpp devices.h)
> target_link_libraries(readdna xc3sproglib ${LIBFTDI_LIBRARIES}  
> ${LIBFTD2XX_LIBRARIES} ${CONDITIONAL_LIBS}  )
>


I tried this but for whatever reason the Findlibftdi.cmake can't find
my libftdi files. I suspect this is because I'm actually installing
libftdi to a user directory and the pkg-config and other entries
aren't in the correct place. For whatever reason the example cmake
usage in the libftdi source is working for me, the:

find_package (LibFTDI1 NO_MODULE REQUIRED)
include (${LIBFTDI_USE_FILE})



Still seems like a better approach to support this in the existing
libftdi cmake scripts, unless I'm missing something as to why this
shouldn't be done.

I was looking at what it might take to add this support to libftdi
proper. In LibFTDI1Config.cmake there are set()s for LIBFTDI_LIBRARY
and LIBFTDI_LIBRARIES. What if we introduce two new ones,

LIBFTDI_STATIC_LIBRARY and LIBFTDI_STATIC_LIBRARIES that refer to
libftdi1.a instead of libftdi1.so? I tested this locally and it
appears to be working properly.

Thoughts?

Chris

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread