Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make default perl install path respect CMAKE_INSTALL_PREFIX #2054

Merged
merged 3 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,10 @@ message(STATUS " ")
message(STATUS "Language bindings:")
message(STATUS "python3 bindings: ${ENABLE_PYTHON3}")
message(STATUS "perl bindings: ${ENABLE_PERL}")
message(STATUS "perl vendorlib: ${PERL_VENDORLIB}")
message(STATUS "perl vendorarch: ${PERL_VENDORARCH}")
message(STATUS "perl privlib: ${PERL_PRIVLIB}")
message(STATUS "perl archlib: ${PERL_ARCHLIB}")
message(STATUS " ")

message(STATUS "Utilities:")
Expand Down
15 changes: 13 additions & 2 deletions swig/perl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
include(UseSWIG)
include(FindPerlLibs)

string(SUBSTRING "${PERL_VERSION_STRING}" 0 4 PERL_VERSION_MINOR)

# process cmake vendor paths to respect install prefix, use as Linux defaults below
if (NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
STRING(REGEX REPLACE "^/usr/" "${CMAKE_INSTALL_PREFIX}/" PERL_VENDORARCH "${PERL_VENDORARCH}")
STRING(REGEX REPLACE "^/usr/" "${CMAKE_INSTALL_PREFIX}/" PERL_VENDORLIB "${PERL_VENDORLIB}")
endif()

message(STATUS "perl install libdir: ${PERL_VENDORARCH}")
message(STATUS "perl install archdir: ${PERL_VENDORLIB}")

set(CMAKE_SWIG_FLAGS "-module" "openscap_pm")
if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
swig_add_module(openscap_pm perl5 ../openscap.i)
Expand All @@ -20,7 +31,7 @@ if (APPLE OR (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD"))
DESTINATION ${CMAKE_INSTALL_DATADIR}/perl5/vendor_perl)
else()
install(TARGETS ${SWIG_MODULE_openscap_pm_REAL_NAME}
DESTINATION ${PERL_VENDORLIB})
DESTINATION ${PERL_VENDORARCH})
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/openscap_pm.pm
DESTINATION ${PERL_VENDORARCH})
DESTINATION ${PERL_VENDORLIB})
endif()