summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Vogt <fvogt@suse.de>2022-06-21 10:45:50 +0200
committerFabian Vogt <fvogt@suse.de>2022-06-21 10:47:07 +0200
commit4d7b2a237b206492cd63d0e96c0c1caf89902352 (patch)
treeae31f4fca160cc7b6bd913a7b46468914501f7e2
parenta1db4618d3b8f67cfed9dcb580f0bebe4b7ca0c6 (diff)
downloadlibproxy-git-4d7b2a237b206492cd63d0e96c0c1caf89902352.tar.gz
bindings: perl: Use ccflags from %Config for libproxy module compilation
This is needed to achieve (binary and source) compatibility. Unfortunately there doesn't appear to be a more official way, even PERL_EXTRA_C_FLAGS is not complete. Fixes #182
-rw-r--r--bindings/perl/CMakeLists.txt7
-rw-r--r--bindings/perl/src/CMakeLists.txt1
2 files changed, 8 insertions, 0 deletions
diff --git a/bindings/perl/CMakeLists.txt b/bindings/perl/CMakeLists.txt
index 4db28e1..368bc56 100644
--- a/bindings/perl/CMakeLists.txt
+++ b/bindings/perl/CMakeLists.txt
@@ -33,6 +33,13 @@ if(PERL_FOUND AND PERLLIBS_FOUND)
OUTPUT_VARIABLE PX_PERL_ARCH)
set (PX_PERL_LIB ${PERL_SITELIB})
endif()
+
+ # PERL_EXTRA_C_FLAGS is not complete, we need full flags (including e.g.
+ # _FILE_OFFSET_BITS=64) for compatibility.
+ EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{ccflags}"
+ OUTPUT_VARIABLE PX_PERL_CCFLAGS)
+ # Convert it to a "list" suitable for target_compile_options.
+ string(REPLACE " " ";" PX_PERL_CCFLAGS ${PX_PERL_CCFLAGS})
endif()
add_subdirectory(lib)
diff --git a/bindings/perl/src/CMakeLists.txt b/bindings/perl/src/CMakeLists.txt
index 29e656d..2800a85 100644
--- a/bindings/perl/src/CMakeLists.txt
+++ b/bindings/perl/src/CMakeLists.txt
@@ -18,6 +18,7 @@ if(PERL_LINK_LIBPERL)
endif()
target_link_libraries(PLlibproxy ${PLlibproxy_LIB_DEPENDENCIES})
+target_compile_options(PLlibproxy PRIVATE ${PX_PERL_CCFLAGS})
set_target_properties(PLlibproxy PROPERTIES OUTPUT_NAME "Libproxy")
set_target_properties(PLlibproxy PROPERTIES PREFIX "")