ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

I don't think you are required to use swipl-ld if you just want to link against prolog. As far as I know, it's just a wrapper that makes sure the right libraries are included and maybe stores some initial state.

However, on Ubuntu, swi-prolog provides a package-config file that you can use in your CMakeLists.txt. For swi-prolog, something like this should work:

include(FindPkgConfig)
pkg_check_modules(SWIPL REQUIRED swipl)
include_directories(${SWIPL_INCLUDE_DIRS})
link_directories(${SWIPL_LIBRARY_DIRS})

# ... some other stuff and the definition of your executable target
target_link_libraries(<your target> ${SWIPL_LIBRARIES})

If initialization of the prolog kernel does not work properly, the reason could be that your prolog home could not be found since your executable will not contain any saved prolog state. Have a look at the corresponding section in the prolog manual. Sorry for not providing a direct link but this site does not like urls with parenthesis and I'm too lazy to look up the corresponding code. Here the url: http://www.swi-prolog.org/pldoc/doc_for?object=section(2,'9.6',swi('/doc/Manual/findhome.html')).