We derive a hierarchy of continuous-variable multipartite entanglement conditions in terms of second-order moments of position and momentum operators that generalizes existing criteria. Each condition corresponds to a convex optimization problem which, given the covariance matrix of the state, can be numerically solved in a straightforward way. The conditions are independent of partial transposition and thus are also able to detect bound entangled states. Our approach can be used to obtain an analytical condition for genuine multipartite entanglement. We demonstrate that even a special case of our conditions can detect entanglement very efficiently. Using multi-objective optimization it is also possible to numerically verify genuine entanglement of some experimentally realizable states.