Skip to content

Commit

Permalink
Merge pull request OpenSCAP#2054 from VCTLabs/perl-install-fix
Browse files Browse the repository at this point in the history
make default perl install path respect CMAKE_INSTALL_PREFIX
  • Loading branch information
evgenyz authored Dec 18, 2023
2 parents 5b3b1d7 + f70f38e commit ef654dd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
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()

0 comments on commit ef654dd

Please sign in to comment.