Commit 085d70df authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Skip downloading and installing pybind11 when it is available on the system

parent 8559da81
Loading
Loading
Loading
Loading
+20 −16
Original line number Diff line number Diff line
@@ -11,6 +11,9 @@ if( PYTHONINTERP_FOUND )
endif()

if( PYTHONLIBS_FOUND )
   # check if pybind11 exists on the system
   find_package(pybind11 QUIET)
   if( NOT pybind11_FOUND )
      # download and build pybind11 at configure time
      configure_file(pybind11.cmake.in ${CMAKE_BINARY_DIR}/pybind11-download/CMakeLists.txt)
      execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
@@ -28,6 +31,7 @@ if( PYTHONLIBS_FOUND )

      # add the pybind11 subdirectory to provide the pybind11_add_module macro
      add_subdirectory(${CMAKE_BINARY_DIR}/pybind11-src ${CMAKE_BINARY_DIR}/pybind11-build)
   endif()

   # add the subdirectory with our bindings
   add_subdirectory(pytnl)
+3 −1
Original line number Diff line number Diff line
@@ -8,7 +8,9 @@ ExternalProject_Add(pybind11
  GIT_TAG           master
  SOURCE_DIR        "${CMAKE_BINARY_DIR}/pybind11-src"
  BINARY_DIR        "${CMAKE_BINARY_DIR}/pybind11-build"
  CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DPYBIND11_TEST=FALSE
  CMAKE_ARGS -DPYBIND11_TEST=FALSE
  # Do not install pybind11 in the system or user's home directory
  INSTALL_COMMAND   ""
  # Disable update of the external project in an offline build
  # reference: https://stackoverflow.com/a/40423683
  UPDATE_DISCONNECTED ${OFFLINE_BUILD}