diff --git a/paddle/phi/CMakeLists.txt b/paddle/phi/CMakeLists.txt index 220f37e7f65be3..4a15534ea7921d 100644 --- a/paddle/phi/CMakeLists.txt +++ b/paddle/phi/CMakeLists.txt @@ -195,7 +195,7 @@ endif() # when phi is built to dynamic library, it's fine. But when phi # is built to static library, phi_gpu should be linked to phi_core. # By the way, cyclic dependency is allowed in static library. -if(NOT WIN32 AND NOT WITH_SHARED_PHI) +if((WITH_GPU OR WITH_ROCM) AND NOT WITH_SHARED_PHI) target_link_libraries(phi_core phi_gpu) endif()