nlopt
nlopt copied to clipboard
Fix/cmake guile
FindGuile.cmake does not seem to work everywhere. The pkg-config approach to guile is quite robust and is available in most platforms. This is a cleaned up CMake script for NLopt Guile wrapper.
on what platform does it not work ? maybe we dont watn to force require pkgconfig anyways this should stay in findguile
on what platform does it not work ?
This is failing on my Mac 11.7 (BigSur) and I installed guile using homebrew
maybe we dont watn to force require pkgconfig anyways this should stay in findguile
I do not agree with requiring pkg-config because if you look at the FindGuile.cmake,
if (GUILE_CONFIG_EXECUTABLE)
execute_process (COMMAND ${GUILE_CONFIG_EXECUTABLE} info prefix
OUTPUT_VARIABLE GUILE_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
...
It is using the GUILE_CONFIG_EXECUTABLE=guile-config command that in turn is a wrapper over pkg-config. On certain platforms the execute_command puts extra quotes around OUTPUT_VARIABLE and that is still an unresolved issue with CMake in my experience. Directly using pkg-config from the CMake packages is much safer and is better supported within CMake.
I do agree that this should be inside FindGuile.cmake. Will make these changes and squash it into a single commit and update the pull request.
It is using the GUILE_CONFIG_EXECUTABLE=guile-config command that in turn is a wrapper over pkg-config.
No, guile-config is not a wrapper around pkg-config. It is installed as a part of guile itself (e.g. if you build Guile from source and do make install, and in fact is written in Scheme. It's the documented "official" way to find out how to link against guile.
Using guile-config will fail if you haven't installed it into your PATH, but then you should either set your PATH appropriately or pass GUILE_CONFIG_EXECUTABLE=/path/to/guile-config to cmake.
It is using the GUILE_CONFIG_EXECUTABLE=guile-config command that in turn is a wrapper over pkg-config.
No,
guile-configis not a wrapper aroundpkg-config. It is installed as a part of guile itself (e.g. if you build Guile from source and domake install, and in fact is written in Scheme. It's the documented "official" way to find out how to link against guile.
It does look like a wrapper over the pkg-config on my platform (written in scheme).
prompt> guile-config info --cflags
error: (“/opt/homebrew/opt/pkg-config/bin/pkg-config” “--variable=--cflags” “guile-3.0”) exited with non-zero error code 127
And please read line 28 of the guile-config.in you sent me it reads as follows
;;; This script has been deprecated. Just use pkg-config.
Using
guile-configwill fail if you haven't installed it into yourPATH, but then you should either set yourPATHappropriately or passGUILE_CONFIG_EXECUTABLE=/path/to/guile-configtocmake.
This doesn't help