When configuring PLplot 5.11.0 from pkgsrc using a private pkgsrc plplot package definition on OS X Yosemite using CMake 3.0.2, I get the following error:
CMake Error at cmake/modules/pkg-config.cmake:202 (string): string sub-command REGEX, mode REPLACE needs at least 6 arguments total to command. Call Stack (most recent call first): cmake/modules/pkg-config.cmake:355 (pkg_config_link_flags) bindings/c++/CMakeLists.txt:83 (pkg_config_file)
I think the problem is that the ${link_flags} argument is not quoted, and if it's empty, then Cmake doesn't see it as an argument. If I quote it, then the configure succeeds. Attached is a patch against the 5.11.0 release to fix this problem.
Initially reported on the plplot-devel mailing list in message 20150417153110.GA9862@bass.imca.aps.anl.gov.
Thanks for your report.
You have confirmed (on the plplot-devel mailing list) this issue has been fixed in the git version of PLplot which will form the basis of the next release. Therefore, I am closing this with the status of "closed-fixed".
A similar bug still happens in 5.12 when building the Fortran bindings:
https://github.com/Homebrew/homebrew-core/issues/15851
This is the CMake error message I am getting:
This is a regression and did not happen in 5.11.
In fact, I think it may be the same bug. Here is the patch that I have: https://gist.github.com/zbeekman/7e958baf7f3271083209caaf4b0f9af5
Yes it appears this fix never made it into master or the 5.12 branch... I opened a new issue: https://sourceforge.net/p/plplot/bugs/186/
I agree the last argument of string(REGEX REPLACE ...) must be quoted for those cases where the argument is empty. I thought I had gotten all of these before, but I have just now looked again, and there was one unquoted instance (only affecting Mac OS X platforms) still left in pkg-config.cmake. (This issue was present in 5.11.0 on line 202, but it is a different line in the modern version of PLplot). I have fixed this issue in commit 6819eb3 on our master branch which will be the basis of the imminent PLplot-5.13.0 release.
Last edit: Alan W. Irwin 2017-07-24
Great, glad to hear the fix will sneak into the next release! I've had a
patch accepted to homebrew which fixes this issue for 5.12 in the mean time
On Mon, Jul 24, 2017 at 5:45 PM Alan W. Irwin airwin@users.sf.net wrote: