[CMake] Cmake and Libltdl
Carlos Lopez Gonzalez
carloslopezgonzalez at yahoo.es
Sat Jun 19 03:47:02 EDT 2010
On Fri, 18
Jun 2010 11:23:48 +0200 Andreas Mohr wrote:
>On Thu, Jun 17, 2010 at 10:25:10AM
-0400, cmake-request at cmake.org wrote:
>> Hi,
>> I'm new to
cmake and want to port a C++ project which is now built using autotools
to cmake build system.
>> The project has some libraries (we call
them modules) which are used in two applications. The applications uses
lt_dladdsearchdir to add the path where to search the modules and >then
uses the lt_dlopenext and lt_dlsym to register the modules.
>> When using cmake, do I need to use ltdl as well or will cmake replace the
way the libraries are found and registered?
>
>I'm now using a CMake setup with ltdl as well, and AFAIK there are no
>special "usability
improvements" provided for plugins to be loaded via ltdl.
>
>Probably one needs to add lt_dladdsearchdir() to match all the various differing
>plugin library paths that the CMake configuration might produce on various
platforms
'>til one's nose gets green...
>
>However, of course a
probably very elegant solution is to add a
>PROJ_PLUGIN_DIR_BUILD=...
and/or PROJ_PLUGIN_DIR_INSTALL=...
>to COMPILE_DEFINITIONS property or add_definitions(),
>and then to simply use that in the project source to achieve a precise path:
>#ifndef PROJ_PLUGIN_DIR_BUILD
>#define
PROJ_PLUGIN_DIR_BUILD "some_random_hardcoded_fallback"
>#endif
>lt_dladdsearchdir(PROJ_PLUGIN_DIR_BUILD);
>lt_dladdsearchdir("random_hardcoded_dir_a");
>lt_dladdsearchdir("random_hardcoded_dir_b");
>
>
>PROJ_PLUGIN_DIR_BUILD could probably be figured out using things such as
>${LIBRARY_OUTPUT_PATH} or ${CMAKE_BINARY_DIR}/.......
>
>Andreas Mohr
Hi Andreas
As mentioned in the other reply, the application loads the libraries in a book of libraries using the ltdl utilities.
None of the usage of the libraries are hardcoded because they are instantiated based on the name of the library needed.
I now understand what's the libltdl usage and why it is not replaced by the cmake ability to link the libraries in a dynamic way.
Wish me good luck with the implementation of the migration.
Thanks you all.
Carlos López
http://synfig.org
More information about the CMake
mailing list