0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-19 19:52:15 +02:00

cmake: create findswigdeps to reduce code duplication

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
This commit is contained in:
Frank Lichtenheld 2022-03-16 13:02:19 +01:00
parent 77b0bae736
commit 592b6c4604
2 changed files with 19 additions and 19 deletions

View File

@ -1,23 +1,5 @@
include(findcoredeps)
find_package(PythonInterp)
find_package(PythonLibs)
FIND_PACKAGE(SWIG 3.0)
# We test building this library with python instead of java since that is easier to do and both languages should work
if (${PYTHONLIBS_FOUND} AND ${SWIG_FOUND})
if (NOT WIN32)
set(BUILD_SWIG_LIB TRUE)
elseif("${CMAKE_EXE_LINKER_FLAGS}" MATCHES "x64")
set(BUILD_SWIG_LIB TRUE)
else()
MESSAGE(INFO " Skipping ovpncli swig build on non-x64 arch: ${CMAKE_EXE_LINKER_FLAGS}")
endif()
else()
MESSAGE(INFO " Python libraries or swig not found, skipping ovpncli swig build")
endif()
include(findswigdeps)
if (${BUILD_SWIG_LIB})
add_custom_command(

18
cmake/findswigdeps.cmake Normal file
View File

@ -0,0 +1,18 @@
find_package(PythonInterp)
find_package(PythonLibs)
FIND_PACKAGE(SWIG 3.0)
# We test building this library with python instead of java since that is easier to do and both languages should work
if (PYTHONLIBS_FOUND AND SWIG_FOUND)
if (NOT WIN32)
set(BUILD_SWIG_LIB TRUE)
elseif("${CMAKE_EXE_LINKER_FLAGS}" MATCHES "x64")
set(BUILD_SWIG_LIB TRUE)
else()
MESSAGE(INFO " Skipping swig builds on non-x64 Windows: ${CMAKE_EXE_LINKER_FLAGS}")
endif()
else()
MESSAGE(INFO " Python libraries or swig not found, skipping swig builds")
endif()