From 42742fadc1fb7085fc950df9108263fdffc2f0e7 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 29 Jan 2026 15:41:49 +0100 Subject: [PATCH] add use_only_needed to targets --- CMakeLists.txt | 2 ++ python/simulators/CMakeLists.txt | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a5f7eb38e..553e25a053 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -569,6 +569,7 @@ add_library(MainDispatchDynamic OBJECT opm/simulators/flow/MainDispatchDynamic.c use_warnings(TARGET MainDispatchDynamic) use_fast_build(TARGET MainDispatchDynamic) use_additional_optimization(TARGET MainDispatchDynamic) +use_only_needed(TARGET MainDispatchDynamic) set_property(TARGET MainDispatchDynamic PROPERTY POSITION_INDEPENDENT_CODE ON) # We only wait for the hipification process if we are compiling HIP. @@ -611,6 +612,7 @@ foreach(OBJ ${COMMON_MODELS} ${FLOW_MODELS} ${FLOW_VARIANT_MODELS}) use_warnings(TARGET flow_lib${OBJ}) use_fast_build(TARGET flow_lib${OBJ}) use_additional_optimization(TARGET flow_lib${OBJ}) + use_only_needed(TARGET flow_lib${OBJ}) list(APPEND FLOW_TGTS $) if(TARGET fmt::fmt) target_link_libraries(flow_lib${OBJ} PRIVATE fmt::fmt) diff --git a/python/simulators/CMakeLists.txt b/python/simulators/CMakeLists.txt index 802b48a0d3..7f6183666c 100644 --- a/python/simulators/CMakeLists.txt +++ b/python/simulators/CMakeLists.txt @@ -53,6 +53,7 @@ pybind11_add_module(BlackOil ${PYBIND11_SYSTEM} use_warnings(TARGET BlackOil) use_fast_build(TARGET BlackOil) use_additional_optimization(TARGET BlackOil) +use_only_needed(TARGET BlackOil) pybind11_add_module(GasWater ${PYBIND11_SYSTEM} $ @@ -62,6 +63,7 @@ pybind11_add_module(GasWater ${PYBIND11_SYSTEM} use_warnings(TARGET GasWater) use_fast_build(TARGET GasWater) use_additional_optimization(TARGET GasWater) +use_only_needed(TARGET GasWater) pybind11_add_module(OnePhase ${PYBIND11_SYSTEM} $ @@ -71,6 +73,7 @@ pybind11_add_module(OnePhase ${PYBIND11_SYSTEM} use_warnings(TARGET OnePhase) use_fast_build(TARGET OnePhase) use_additional_optimization(TARGET OnePhase) +use_only_needed(TARGET OnePhase) # Create a convenience target to build all Python simulator modules add_custom_target(python_simulator_modules