/// <summary>
        /// Process the passed files depending on its name prefix
        /// </summary>
        /// <param name="fileName">name of the file</param>
        public static void ProcessFiles(string fileName)
        {
            string file = Gpa.GetFileNameFromFilePath(fileName);

            // PublicCounterDefs*
            {
                int indexOf = file.IndexOf((IsInternal ? Gpa.internal_file_prefix : Gpa.public_file_prefix) + Gpa.CounterDefinitionsStr, StringComparison.Ordinal);
                if (indexOf != -1)
                {
                    string api = Gpa.GetApiFromFileName(file);
                    if (null != api)
                    {
                        CounterDefs[api].Add(fileName);
                    }
                }
            }

            // DerivedCounterDefs*
            {
                int indexOf = file.IndexOf((IsInternal ? Gpa.internal_file_prefix : Gpa.public_file_prefix) + Gpa.DerivedCounterOutFileName, StringComparison.Ordinal);
                if (indexOf != -1)
                {
                    string api = Gpa.GetApiFromFileName(file);
                    if (null != api)
                    {
                        DerivedCounters[api].Add(fileName);
                    }
                }
            }
        }
        /// <summary>
        /// Writes the CMake file
        /// </summary>
        public static void CMakeWriter()
        {
            string TypePrefix = (IsInternal ? Gpa.InternalStr : Gpa.PublicStr);

            foreach (var api in CounterDefs)
            {
                bool       init        = false;
                TextWriter CMakeWriter = null;
                string     headerFiles = "set(" + TypePrefix.ToUpper() + "_COUNTER_DEF_HEADERS_" + api.Key.ToUpper();
                string     sourceFiles = "set(" + TypePrefix.ToUpper() + "_COUNTER_DEF_SRC_" + api.Key.ToUpper();
                bool       foundHeader = false;
                foreach (var fileName in api.Value)
                {
                    if (!init)
                    {
                        init = true;
                        string CMakeFileName = Gpa.GetDirectoryFromFilePath(fileName) + "\\" +
                                               TypePrefix.ToLower() + "_" +
                                               Gpa.CounterDefinitionsStr + api.Key + ".cmake";
                        CMakeWriter = new StreamWriter(CMakeFileName);
                        CMakeWriter.WriteLine(
                            "## Copyright (c) {0} Advanced Micro Devices, Inc. All rights reserved.", DateTime.Today.Year);
                        CMakeWriter.WriteLine("cmake_minimum_required(VERSION 3.5.1)");
                        CMakeWriter.WriteLine();
                        CMakeWriter.WriteLine("set(CMAKE_INCLUDE_CURRENT_DIR ON)");
                    }

                    if (Gpa.IsHeaderFile(fileName))
                    {
                        headerFiles = headerFiles + Environment.NewLine + "${CMAKE_CURRENT_LIST_DIR}/" + Gpa.GetFileNameFromFilePath(fileName);
                        foundHeader = true;
                    }
                    else
                    {
                        sourceFiles = sourceFiles + Environment.NewLine + "${CMAKE_CURRENT_LIST_DIR}/" + Gpa.GetFileNameFromFilePath(fileName);
                    }
                }

                if (null != CMakeWriter)
                {
                    if (foundHeader)
                    {
                        headerFiles = headerFiles + ")" + Environment.NewLine;
                    }

                    sourceFiles = sourceFiles + ")" + Environment.NewLine;

                    if (foundHeader)
                    {
                        CMakeWriter.WriteLine(headerFiles);
                    }

                    CMakeWriter.WriteLine(sourceFiles);
                    CMakeWriter.Close();
                }
            }

            // DerivedCounterDefs
            foreach (var api in DerivedCounters)
            {
                bool       init        = false;
                TextWriter CMakeWriter = null;
                string     headerFiles = "set(" + TypePrefix.ToUpper() + "_DERIVED_COUNTERS_API_HEADERS_" + api.Key.ToUpper();
                string     sourceFiles = "set(" + TypePrefix.ToUpper() + "_DERIVED_COUNTERS_API_SRC_" + api.Key.ToUpper();
                bool       foundHeader = false;
                foreach (var fileName in api.Value)
                {
                    if (!init)
                    {
                        init = true;
                        string CMakeFileName = Gpa.GetDirectoryFromFilePath(fileName) + "\\" +
                                               TypePrefix.ToLower() + "_" +
                                               Gpa.DerivedCounterOutFileName + api.Key + ".cmake";
                        CMakeWriter = new StreamWriter(CMakeFileName);
                        CMakeWriter.WriteLine(
                            "## Copyright (c) {0} Advanced Micro Devices, Inc. All rights reserved.", DateTime.Today.Year);
                        CMakeWriter.WriteLine("cmake_minimum_required(VERSION 3.5.1)");
                        CMakeWriter.WriteLine();
                        CMakeWriter.WriteLine("set(CMAKE_INCLUDE_CURRENT_DIR ON)");
                    }

                    if (Gpa.IsHeaderFile(fileName))
                    {
                        headerFiles = headerFiles + Environment.NewLine + "${CMAKE_CURRENT_LIST_DIR}/" + Gpa.GetFileNameFromFilePath(fileName);
                        foundHeader = true;
                    }
                    else
                    {
                        sourceFiles = sourceFiles + Environment.NewLine + "${CMAKE_CURRENT_LIST_DIR}/" + Gpa.GetFileNameFromFilePath(fileName);
                    }
                }

                if (null != CMakeWriter)
                {
                    if (foundHeader)
                    {
                        headerFiles = headerFiles + ")" + Environment.NewLine;
                    }

                    sourceFiles = sourceFiles + ")" + Environment.NewLine;

                    if (foundHeader)
                    {
                        CMakeWriter.WriteLine(headerFiles);
                    }

                    CMakeWriter.WriteLine(sourceFiles);
                    CMakeWriter.Close();
                }
            }
        }