rearranged source code with cmake environment