Improve CMakeLists to handle variables and initial support for QT4