On Thu, Jun 17, 2010 at 10:25:10AM -0400, cmake-requ...@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
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to