libftdi Archives

Subject: RE: Nested cmake?

From: xantares 09 <xantares09@xxxxxxxxxxx>
To: "libftdi@xxxxxxxxxxxxxxxxxxxxxxx" <libftdi@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 13 Sep 2013 10:23:50 +0000



Date: Thu, 12 Sep 2013 21:48:26 -0400
Subject: Nested cmake?
From: chmorgan@xxxxxxxxx
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx

Hello.

I was looking at how to use libftdi in the context of a project I'm working on without having to install it to a system directory. The project already uses cmake and I noticed libftdi does as well.

I was thinking I could just add add_subdirectory() with the libftdi directory and then retrieve the output library paths from the top level and set global properties so some applications could set their include and libraries to use the libraries that were built. Is anyone else doing this?

I added the libftdi directory to my project and  did discover some issues with including the libftdi in the main cmakelists.txt file, specifically that the libftdi cmake file uses CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR and this is looking for and outputting files relative to the main cmake file.

Would it be reasonable to make the libftdi cmake files operate relative to their location? I've made changes locally and everything appears to work correctly in both the normal case of running using the libftdi cmake as the base file and in my case of nesting it within my larger cmake build setup.

I'll send a patch tomorrow so it's clear what I mean. I was hoping someone had some advice on the idea of using the library without installing it.

Chris



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


Hello,

You're doing it wrong, you can use find_package:

0. look at the cmake example in example /examples/cmake_example/.

1. Install libftdi where you want by passing CMAKE_INSTALL_PREFIX=/home/bob/mylibfti/install to cmake configuration, this should install /home/bob/mylibftdi/install/lib/cmake/libftdi1/LibFTDI1Config.cmake

2. Use find_package(LibFTDI1) in your project, and pass -DLibFTDI1Config_DIR=/home/bob/mylibfti/install/lib/cmake/libftdi1 to your cmake configuration (only needed for non-system libftdi installations).

3. Link with LIBFTDI_LIBRARIES in your project, done.

x.




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


Current Thread