Skip to content

Commit 5c778cb

Browse files
committed
Dont search for python and pybind11 if already found previously
1 parent 1219430 commit 5c778cb

4 files changed

Lines changed: 22 additions & 17 deletions

File tree

SofaPython3Config.cmake.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
99
include(SofaPython3Tools)
1010

1111
# Find Python3
12-
if(NOT Python_FOUND)
13-
find_package(Python @PythonMAJMIN@ EXACT QUIET REQUIRED COMPONENTS Interpreter Development)
12+
if(NOT TARGET Python::Python)
13+
find_package(Python @PythonMAJMIN@ EXACT QUIET REQUIRED COMPONENTS Interpreter Development GLOBAL)
1414
endif()
1515

1616
# Find pybind11
17-
if(NOT pybind11_FOUND)
17+
if(NOT TARGET pybind11)
1818
# Save PYTHON_* vars
1919
set(PYTHON_VERSION_RESET "${PYTHON_VERSION}")
2020
set(PYTHON_EXECUTABLE_RESET "${PYTHON_EXECUTABLE}")
@@ -40,7 +40,7 @@ if(NOT pybind11_FOUND)
4040
set(PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIRS}" CACHE INTERNAL "" FORCE)
4141
endif()
4242

43-
find_package(pybind11 @pybind11_VERSION@ QUIET REQUIRED CONFIG)
43+
find_package(pybind11 @pybind11_VERSION@ QUIET REQUIRED CONFIG GLOBAL)
4444

4545
# Reset PYTHON_* vars
4646
set(PYTHON_VERSION "${PYTHON_VERSION_RESET}" CACHE STRING "" FORCE)

bindings/BindingsConfig.cmake.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55

66
set(SP3_WITH_SOFAEXPORTER @SP3_WITH_SOFAEXPORTER@)
77

8-
find_package(SofaPython3 QUIET REQUIRED COMPONENTS
8+
find_package(Sofa.Config QUIET REQUIRED)
9+
10+
sofa_find_package(SofaPython3 QUIET REQUIRED COMPONENTS
911
Bindings.Modules
1012
Bindings.Sofa
1113
Bindings.SofaGui
1214
Bindings.SofaRuntime
1315
Bindings.SofaTypes
1416
)
1517
if(SP3_WITH_SOFAEXPORTER)
16-
find_package(SofaPython3 QUIET REQUIRED COMPONENTS Bindings.SofaExporter)
18+
sofa_find_package(SofaPython3 QUIET REQUIRED COMPONENTS Bindings.SofaExporter)
1719
endif()
1820

1921
# If we are importing this config file and the target is not yet there this is indicating that

bindings/Modules/Bindings.ModulesConfig.cmake.in

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
@PACKAGE_GUARD@
44
@PACKAGE_INIT@
55

6-
find_package(SofaPython3 QUIET REQUIRED COMPONENTS Plugin Bindings.Sofa)
6+
find_package(Sofa.Config QUIET REQUIRED)
7+
sofa_find_package(SofaPython3 QUIET REQUIRED COMPONENTS Plugin Bindings.Sofa)
78

89
# Required by Bindings.Modules.SofaBaseTopology
9-
find_package(Sofa.Component.Topology.Container.Grid QUIET REQUIRED)
10+
sofa_find_package(Sofa.Component.Topology.Container.Grid QUIET REQUIRED)
1011

1112
# Required by Bindings.Modules.SofaDeformable
12-
find_package(Sofa.Component.SolidMechanics.Spring QUIET REQUIRED)
13+
sofa_find_package(Sofa.Component.SolidMechanics.Spring QUIET REQUIRED)
1314

1415
# Required by Bindings.Modules.SofaLinearSolver
15-
find_package(Sofa.Component.LinearSolver.Iterative QUIET REQUIRED)
16+
sofa_find_package(Sofa.Component.LinearSolver.Iterative QUIET REQUIRED)
1617

1718
# If we are importing this config file and the target is not yet there this is indicating that
1819
# target is an imported one. So we include it

bindings/Sofa/Bindings.SofaConfig.cmake.in

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@
33
@PACKAGE_GUARD@
44
@PACKAGE_INIT@
55

6-
find_package(SofaPython3 QUIET REQUIRED COMPONENTS Plugin)
6+
sofa_find_package(Sofa.Config QUIET REQUIRED)
7+
8+
sofa_find_package(SofaPython3 QUIET REQUIRED COMPONENTS Plugin)
79

810
# Required by Bindings.Sofa.Helper, Bindings.Sofa.Types
9-
find_package(Sofa.Core QUIET REQUIRED)
11+
sofa_find_package(Sofa.Core QUIET REQUIRED)
1012

1113
# Required by Bindings.Sofa.Core
12-
find_package(Sofa.Simulation.Core QUIET REQUIRED)
14+
sofa_find_package(Sofa.Simulation.Core QUIET REQUIRED)
1315

1416
# Required by Bindings.Sofa.Core
15-
find_package(Sofa.Component.Visual QUIET REQUIRED)
16-
find_package(Sofa.Component.Collision.Response.Contact QUIET REQUIRED)
17-
find_package(Sofa.SimpleApi QUIET REQUIRED)
17+
sofa_find_package(Sofa.Component.Visual QUIET REQUIRED)
18+
sofa_find_package(Sofa.Component.Collision.Response.Contact QUIET REQUIRED)
19+
sofa_find_package(Sofa.SimpleApi QUIET REQUIRED)
1820

1921
# Required by Bindings.Sofa.Simulation
20-
find_package(Sofa.Simulation.Graph QUIET REQUIRED)
22+
sofa_find_package(Sofa.Simulation.Graph QUIET REQUIRED)
2123

2224
# If we are importing this config file and the target is not yet there this is indicating that
2325
# target is an imported one. So we include it

0 commit comments

Comments
 (0)