File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,12 +9,16 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
99include (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+ if (CMAKE_VERSION VERSION_LESS "3.24.0" )
14+ find_package (Python @PythonMAJMIN@ EXACT QUIET REQUIRED COMPONENTS Interpreter Development )
15+ else ()
16+ find_package (Python @PythonMAJMIN@ EXACT QUIET REQUIRED COMPONENTS Interpreter Development GLOBAL )
17+ endif ()
1418endif ()
1519
1620# Find pybind11
17- if (NOT pybind11_FOUND )
21+ if (NOT TARGET pybind11 )
1822 # Save PYTHON_* vars
1923 set (PYTHON_VERSION_RESET "${PYTHON_VERSION} " )
2024 set (PYTHON_EXECUTABLE_RESET "${PYTHON_EXECUTABLE} " )
@@ -40,7 +44,11 @@ if(NOT pybind11_FOUND)
4044 set (PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIRS} " CACHE INTERNAL "" FORCE )
4145 endif ()
4246
43- find_package (pybind11 @pybind11_VERSION@ QUIET REQUIRED CONFIG )
47+ if (CMAKE_VERSION VERSION_LESS "3.24.0" )
48+ find_package (pybind11 @pybind11_VERSION@ QUIET REQUIRED CONFIG )
49+ else ()
50+ find_package (pybind11 @pybind11_VERSION@ QUIET REQUIRED CONFIG GLOBAL )
51+ endif ()
4452
4553 # Reset PYTHON_* vars
4654 set (PYTHON_VERSION "${PYTHON_VERSION_RESET} " CACHE STRING "" FORCE )
Original file line number Diff line number Diff line change 55
66set (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 )
1517if (SP3_WITH_SOFAEXPORTER)
16- find_package (SofaPython3 QUIET REQUIRED COMPONENTS Bindings.SofaExporter )
18+ sofa_find_package (SofaPython3 QUIET REQUIRED COMPONENTS Bindings.SofaExporter )
1719endif ()
1820
1921# If we are importing this config file and the target is not yet there this is indicating that
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 33@PACKAGE_GUARD@
44@PACKAGE_INIT@
55
6- find_package (SofaPython3 QUIET REQUIRED COMPONENTS Plugin )
6+ 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
You can’t perform that action at this time.
0 commit comments