Demonstration of entanglement-by-measurement of solid-state qubits