[CMake] Why I cannot build a dll that embeds perl with cmake?
Georgios Petasis
petasisg at yahoo.gr
Thu Jul 3 18:48:18 EDT 2008
Hi all,
I have some C code that embeds perl into a C application.
If I compile my code with:
cl.exe <result of "perl -MExtUtils::Embed -e ccopts">
and then:
link <result of "perl -MExtUtils::Embed -e ldopts">
the resulting dll works. But if I compile it with cmake, my code always
crashes, because a perl structure (a global pointer) is left
uninitialised, and is always NULL. It seems that cmake inserts something
that changes the building process.
How can I find what commands are executed when the code is compiled/linked?
I even tried the following:
EXECUTE_PROCESS ( COMMAND ${PERL_EXECUTABLE}
-MExtUtils::Embed -e ccopts
OUTPUT_VARIABLE PERL_OUTPUT
RESULT_VARIABLE PERL_RETURN_VALUE )
IF ( NOT PERL_RETURN_VALUE )
STRING ( REPLACE "-O1" "" ADDITIONAL_PERL_CCOPTS ${PERL_OUTPUT} )
ENDIF ( NOT PERL_RETURN_VALUE )
EXECUTE_PROCESS ( COMMAND ${PERL_EXECUTABLE}
-MExtUtils::Embed -e ldopts
OUTPUT_VARIABLE PERL_OUTPUT
RESULT_VARIABLE PERL_RETURN_VALUE )
IF ( NOT PERL_RETURN_VALUE )
SET ( ADDITIONAL_PERL_LDOPTS ${PERL_OUTPUT} )
ENDIF ( NOT PERL_RETURN_VALUE )
SET ( CMAKE_C_FLAGS "-DUSE_TCL_STUBS
${ADDITIONAL_PERL_CCOPTS}" )
SET ( CMAKE_C_FLAGS_RELEASE "" )
SET ( CMAKE_C_FLAGS_DEBUG "" )
SET ( CMAKE_SHARED_LINKER_FLAGS ${ADDITIONAL_PERL_LDOPTS} )
SET ( CMAKE_SHARED_LINKER_FLAGS_RELEASE "" )
SET ( CMAKE_SHARED_LINKER_FLAGS_DEBUG "" )
But it didn't change anything. The produced dll still crashes. Any ideas?
Regards,
George
More information about the CMake
mailing list