Fix package building (without BY) by reordering CMakeLists.txt