Fix the CMake-port-specific part of ticket #40648.

This reverts the changes made to the CMake Portfile in r110069 so that
ports, which are configured by CMake, honor the configure.optflags set
in the Portfile. Thus, Release builds are compiled with optimization
by default again.

The MacPorts-specific issue of handling configure.optflags has to be
resolved in the CMake PortGroup.
Add the original CMake PortGroup to prepare resolution of issue #40648.
Improve the CMake PortGroup so that it handles the configure.*flags.

The configure.cppflags, configure.optflags, configure.cflags,
configure.cxxflags, configure.ldflags are handled by setting the
equivalent CMAKE_*_FLAGS.

The configure.cppflags are added to the C/C++ compiler flags as CMake
does not honor separately CPPFLAGS (it uses usually add_definitions()
for that).  The compiler flags for all build types (CMAKE_C_FLAGS,
CMAKE_CXX_FLAGS) are used, as they are usually empty.  Cf. also to
CMake upstream ticket #12928 "CMake silently ignores CPPFLAGS"
<http://www.cmake.org/Bug/view.php?id=12928>.

The configure.cflags contain configure.optflags by default. Therefore,
they are set via the Release flags CMAKE_C_FLAGS_RELEASE, which would
otherwise overrule the optimization flags, as they are set by default
to "-O3 -NDEBUG". Therefore, be sure to add "-NDEBUG" to the
configure.cflags if you want to turn off assertions in release builds!

The configure.cxxflags contain configure.optflags by
default. Therefore, they are set via the Release flags
CMAKE_CXX_FLAGS_RELEASE, which would otherwise overrule the
optimization flags, as they are set by default to "-O3
-NDEBUG". Therefore, be sure to add "-NDEBUG" to the configure.cflags
if you want to turn off assertions in release builds!

A port author has to be aware that a CMake script can always override
these flags when it runs, as they are frequently set internally in
function of other CMake build variables!

Attention: If the port author wants to be sure that no compiler flags
are passed via configure.args to CMake, he has to set manually
configure.optflags to "", as it is by default "-O2" and added to all
language-specific flags. If he wants to prevent optimization, he
should set configure.optflags to "-O0".

TODO: Handle the compiler flags specific to Objective-C, Fortran, and
Java in the CMake PortGroup.
Change the CMAKE_BUILD_TYPE to Debug instead of debugFull for the +debug variant in the CMake PortGroup.

"debugFull" is not a standard build type in CMake so there are no
default compiler flags set for it, which would turn on the inclusion
of debug symbols. Instead, CMake provides the build type "Debug" for
this purpose. Only KDE provides in its CMake build infrastructure
support for a build type called "DebugFull", which turns off
optimization, as KDE leaves it on for the "Debug" build type. Confer
to <http://techbase.kde.org/Development/CMake/Addons_for_KDE> for
further explanations.
Consider the configure.cflags and configure.cxxflags for +debug variant of the CMake PortsGroup.

The CMAKE_BUILD_TYPE "Debug" uses CMAKE_C_FLAGS_DEBUG and
CMAKE_CXX_FLAGS_DEBUG to specify the compiler flags. These variables
are set to "-g" plus the respective configure.cflags and
configure.cxxflags. Be aware that configure.cflags and
configure.cxxflags contain configure.optflags by default, which are
not deleted for the Debug build. The port author has to set
configure.optflags to "-O0" to turn off optimization.