[CMake] Find PerlLibs fails;

Georgios Petasis petasisg at yahoo.gr
Sun Jul 6 05:55:34 EDT 2008


O/H Alexander Neundorf ??????:
> On Monday 30 June 2008, Georgios Petasis wrote:
>   
>> Hi all,
>>
>> I am running cmake 2.6 under windows:
>>
>> MESSAGE ( STATUS "Searching for Perl..." )
>> FIND_PACKAGE ( Perl )
>> FIND_PACKAGE ( PerlLibs )
>> IF ( PERL_FOUND )
>>   MESSAGE ( STATUS "  PERL_EXECUTABLE:        " ${PERL_EXECUTABLE} )
>>   MESSAGE ( STATUS "  PERL_INCLUDE_PATH:      " ${PERL_INCLUDE_PATH} )
>>   MESSAGE ( STATUS "  PERL_LIBRARY:           " ${PERL_LIBRARY} )
>> ENDIF ( PERL_FOUND )
>>
>> The output is:
>>
>> -- Searching for Perl...
>> -- Found Perl: C:/Program Files (x86)/Perl/bin/perl.exe
>> -- Could NOT find PerlLibs
>> --   PERL_EXECUTABLE:        C:/Program Files (x86)/Perl/bin/perl.exe
>> --   PERL_INCLUDE_PATH:      PERL_INCLUDE_PATH-NOTFOUND
>> --   PERL_LIBRARY:           PERL_LIBRARY-NOTFOUND
>>
>> It seems that it can locate perl (which is also in the PATH), but not
>> its libs. Can I fix this?
>>     
>
> Please have a look at FindPerlLibs.cmake and add some MESSAGE(STATUS ...) to 
> find out what is going on exactly. Is it simply the version number which is 
> missing ?
>
> Alex
Dear Alex,

I have solved this problem by not making adjustments to cmake files, as 
I have to support computers
with a default cmake installation. Instead, I have put the following 
code in my CMakeLists.txt:

  EXECUTE_PROCESS ( COMMAND ${PERL_EXECUTABLE}
                    -MConfig -e "print \$Config{version}"
                    OUTPUT_VARIABLE PERL_OUTPUT
                    RESULT_VARIABLE PERL_RETURN_VALUE )
  IF ( NOT PERL_RETURN_VALUE )
    SET ( PERL_VERSION ${PERL_OUTPUT} )
  ENDIF ( NOT PERL_RETURN_VALUE )

  ## Try to fix failure in PERL_INCLUDE_PATH
  IF ( PERL_INCLUDE_PATH MATCHES .*-NOTFOUND )
    EXECUTE_PROCESS ( COMMAND ${PERL_EXECUTABLE}
                      -MConfig -e "print \$Config{archlibexp}"
                      OUTPUT_VARIABLE PERL_OUTPUT
                      RESULT_VARIABLE PERL_RETURN_VALUE )
    IF ( NOT PERL_RETURN_VALUE )
      FIND_PATH ( PERL_INCLUDE_PATH perl.h ${PERL_OUTPUT}/CORE )
    ENDIF ( NOT PERL_RETURN_VALUE )
  ENDIF ( PERL_INCLUDE_PATH MATCHES .*-NOTFOUND )
  ## Try to fix failure in PERL_LIBRARY
  IF ( PERL_LIBRARY MATCHES .*-NOTFOUND )
    EXECUTE_PROCESS ( COMMAND ${PERL_EXECUTABLE}
                      -MConfig -e "print \$Config{libperl}"
                      OUTPUT_VARIABLE PERL_OUTPUT
                      RESULT_VARIABLE PERL_RETURN_VALUE )
    IF ( NOT PERL_RETURN_VALUE )
      FIND_LIBRARY ( PERL_LIBRARY NAMES ${PERL_OUTPUT}
                                  PATHS ${PERL_INCLUDE_PATH} )
    ENDIF ( NOT PERL_RETURN_VALUE )
  ENDIF ( PERL_LIBRARY MATCHES .*-NOTFOUND )
  MESSAGE ( STATUS "  PERL_VERSION:           " ${PERL_VERSION} )
  MESSAGE ( STATUS "  PERL_EXECUTABLE:        " ${PERL_EXECUTABLE} )
  MESSAGE ( STATUS "  PERL_INCLUDE_PATH:      " ${PERL_INCLUDE_PATH} )
  MESSAGE ( STATUS "  PERL_LIBRARY:           " ${PERL_LIBRARY} )

But, now my problem is different: I do have perl found, but I cannot 
convince cmake to build my code right.
It seems that an improper linker switch is added automatically by cmake, 
but I am unable to find somewhere the exact link statement that is 
executed by cmake. All options are written in a temp file, which is 
written/deleted instantly.
Any idea on how I can see its contents?

Currently the only way to build my code is with my hand-written makefile :-(
I have been trying to resolve this problem with cmake for more than 5 days.
I still have no clue what cmake adds, but makes global symbols in my dll 
& the perl library different symbols,
so perl cannot update its global structures...

Best regards,

George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080706/9b1ff58f/attachment.htm>


More information about the CMake mailing list