MantisBT - CMake
View Issue Details
0007898CMakeModulespublic2008-10-30 06:042010-09-01 00:12
Andreas Schneider. 
Philip Lowman 
normaltweakN/A
closedfixed 
CMake-2-6 
 
0007898: Improved FindPerl.cmake
I've written a better FindPerlLibs.cmake module some time ago. I've polished it and here is the latest version. It uses the perl executable to determine each needed variable.
This is the output of my CMakeLists.txt. Note: perl 5.10.0 has no libperl.so

-- >>> PERL_EXECUTABLE /usr/bin/perl
-- >>> PERL_VERSION 5.10.0
-- >>> PERL_ARCHNAME x86_64-linux-thread-multi
--
-- > Module directories:
-- >>> PERL_SITESEARCH UNKNOWN
-- >>> PERL_SITELIB /usr/lib/perl5/site_perl/5.10.0
-- >>> PERL_VENDORARCH /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi
-- >>> PERL_VENDORLIB /usr/lib/perl5/vendor_perl/5.10.0
-- >>> PERL_PRIVLIB /usr/lib/perl5/5.10.0
--
-- > Flags:
-- >>> PERL_EXTRA_C_FLAGS -D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -DDEBUGGING -fno-strict-aliasing -pipe
-- >>> Include directory:
-- >>> PERL_POSSIBLE_INCLUDE_PATHS /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/CORE;/usr/lib/perl/5.10.0/x86_64-linux-thread-multi/CORE;/usr/lib/perl/5.8/CORE;/usr/lib/perl5/5.8/CORE
-- >>> PERL_INCLUDE_PATH /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/CORE
--
-- > Library:
-- >>> PERL_POSSIBLE_LIBRARY_NAME /usr/lib/libperl.so

-- >>> PERL_LIBRARY PERL_LIBRARY-NOTFOUND
No tags attached.
? FindPerlLibs.cmake (5,975) 2008-10-30 06:04
https://public.kitware.com/Bug/file/1813/FindPerlLibs.cmake
? FindPerlLibs.cmake.20081104 (6,134) 2008-11-04 08:18
https://public.kitware.com/Bug/file/1825/FindPerlLibs.cmake.20081104
Issue History
2008-10-30 06:04Andreas Schneider.New Issue
2008-10-30 06:04Andreas Schneider.File Added: FindPerlLibs.cmake
2008-11-04 07:18Andreas Schneider.Note Added: 0014023
2008-11-04 07:31Robert HainesNote Added: 0014022
2008-11-04 08:18Andreas Schneider.File Added: FindPerlLibs.cmake.20081104
2009-01-15 13:01Bill HoffmanStatusnew => assigned
2009-01-15 13:01Bill HoffmanAssigned To => Philip Lowman
2009-07-15 04:13Andreas Schneider.Note Added: 0016872
2009-07-15 08:49Philip LowmanNote Added: 0016873
2009-07-15 09:19Andreas Schneider.Note Added: 0016874
2009-07-17 23:52Philip LowmanNote Added: 0016897
2009-07-17 23:52Philip LowmanStatusassigned => resolved
2009-07-17 23:52Philip LowmanResolutionopen => fixed
2010-09-01 00:12Philip LowmanStatusresolved => closed

Notes
(0014023)
Andreas Schneider.   
2008-11-04 07:18   
You're right. Updated file uploaded.
(0014022)
Robert Haines   
2008-11-04 07:31   
Are you sure there's no libperl?

On Fedora Core 9 it's moved:
/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE/libperl.so

Also on macports (5.8 I know, but there's a pattern showing):
/opt/local/lib/perl5/5.8.8/darwin-thread-multi-2level/CORE/libperl.dylib

I suggest adding $Config{installarchlib}/CORE to the library search path.

Cheers,
Rob
(0016872)
Andreas Schneider.   
2009-07-15 04:13   
Bill will this be included in the next CMake release.
(0016873)
Philip Lowman   
2009-07-15 08:49   
The dynamic search for this patch looked like a good thing to merge. I was put off by the discussion regarding whether perl 5.10 has libperl.so or not. Did this ever get resolved? It would be nice to merge something that works across all perl versions. Rhaines' suggestion looked promising.
(0016874)
Andreas Schneider.   
2009-07-15 09:19   
Yes, this was fixed. I've uploaded a new version of the file.

There was a time problem on the server an my reply got posted before the first comment.

FindPerlLibs.cmake.20081104 [^] (6,134 bytes) 2008-11-04 08:18

This is the fixed file.
(0016897)
Philip Lowman   
2009-07-17 23:52   
Thanks for the patch. I checked it in with some minor changes.

* added PERL_ARCHLIB/CORE to library & include search paths, so it would find the libraries on my system (also should help with macports and other systems where perl isn't in /usr/lib/perl5)
* merged some minor things from the existing FindPerlLibs.cmake into it (e.g. calling include(FindPerl) to find perl executable & FindPackageHandleStandardArgs)
* made search for include directory & library conditional on having PERL_EXECUTABLE
* mark_as_advanced() isn't needed for non-cache variables.

Committer: Philip Lowman <philip@yhbt.com>
/cvsroot/CMake/CMake/Modules/FindPerlLibs.cmake,v <-- FindPerlLibs.cmake
new revision: 1.10; previous revision: 1.9
Committer: Philip Lowman <philip@yhbt.com>
/cvsroot/CMake/CMake/Modules/FindPerlLibs.cmake,v <-- FindPerlLibs.cmake
new revision: 1.11; previous revision: 1.10