include(UseSWIG)

set(CMAKE_SWIG_FLAGS "-module" "openscap_pm")
if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
	swig_add_module(openscap_pm perl5 ../openscap.i)
else()
	swig_add_library(openscap_pm LANGUAGE perl5 SOURCES ../openscap.i)
endif()
swig_link_libraries(openscap_pm openscap ${PERL_LIBRARY})
target_include_directories(openscap_pm PUBLIC ${PERL_INCLUDE_PATH})

install(TARGETS ${SWIG_MODULE_openscap_pm_REAL_NAME}
	DESTINATION ${CMAKE_INSTALL_LIBDIR}/perl5/vendor_perl)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/openscap.pm
	DESTINATION ${CMAKE_INSTALL_DATADIR}/perl5/vendor_perl)

include(UseSWIG)

set(CMAKE_SWIG_FLAGS "-module" "openscap_pm")
if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
	swig_add_module(openscap_pm perl5 ../openscap.i)
else()
	swig_add_library(openscap_pm LANGUAGE perl5 SOURCES ../openscap.i)
endif()
swig_link_libraries(openscap_pm openscap ${PERL_LIBRARY})
target_include_directories(openscap_pm PUBLIC ${PERL_INCLUDE_PATH})

install(TARGETS ${SWIG_MODULE_openscap_pm_REAL_NAME}
	DESTINATION ${CMAKE_INSTALL_LIBDIR}/perl5/vendor_perl)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/openscap_pm.pm
	DESTINATION ${CMAKE_INSTALL_DATADIR}/perl5/vendor_perl)

Fix broken file name in install command in SWIG Perl bindings
Fix broken file name in install command in SWIG Perl bindings

A correct file name should be openscap_pm.pm, according to
the target name. Addressing:
CMake Error at swig/perl/cmake_install.cmake:61 (file):
  file INSTALL cannot find
  "/home/jcerny/openscap/build/swig/perl/openscap.pm".
Call Stack (most recent call first):
  swig/cmake_install.cmake:42 (include)
  cmake_install.cmake:54 (include)
