]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
PPGP Win32 porting - am2cmake customization as a temporary solution before migrating...
authorsan <san@opencascade.com>
Mon, 18 Mar 2013 12:43:20 +0000 (12:43 +0000)
committersan <san@opencascade.com>
Mon, 18 Mar 2013 12:43:20 +0000 (12:43 +0000)
- Generating documenattion with SPHINX
- Processing files from ${PYQRC_FILES} with ${PYRCC_EXECUTABLE} to generate Python scripts containing resources
- Support for ppgptests Makefile.am variable to install PPGP_SRC/tests  sub-directory

salome_adm/cmake_files/am2cmake.py

index 20f0e9c7b354101672f49d02df46e9f1417f7640..54af70cfb492802973a9497763e4336c640bd118 100644 (file)
-#  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-import re
-
-# ----
-# A set of regular expressions used ...
-# ----
-
-p_multiline = re.compile(r"""
-\\           # One backslash
-\s*          # 0 or more space
-\n           # One CR
-""", re.VERBOSE)
-
-p_dollar = re.compile(r"""
-\$\(           # a $ then a (
-(?P<val>       # open the group val
-[^)]*          # the group contain 0 or more non ) characters
-)              # close the group
-\)             # a ) at the end
-""", re.VERBOSE)
-
-p_arobas = re.compile(r"""
-@              # a @
-(?P<val>       # open the group val
-[^@]*            # the group contain 0 or more non @ characters
-)              # close the group
-@              # a @ at the end
-""", re.VERBOSE)
-
-p_if = re.compile(r"""
-^          # beginning of the string
-\s*        # 0 or more space
-if         # an if
-\s+        # 1 or more space
-(?P<val>   # open the group val
-.+         # the group contain 1 or more non space characters
-)          # close the group
-""", re.VERBOSE)
-
-p_else = re.compile(r"""
-^          # beginning of the line
-\s*        # 0 or more space
-else       #
-\s*        # 0 or more space
-""", re.VERBOSE)
-
-p_endif = re.compile(r"""
-^          # beginning of the line
-\s*        # 0 or more space
-endif      # a endif
-\s*        # 0 or more space
-""", re.VERBOSE)
-
-p_attribution = re.compile(r"""
-^              # beginning of the line
-(?P<spaces>    # open the group spaces
-\s*            # 0 or more space
-)              # close the group
-(?P<key>       # open the group key
-\w+            # the group contain 1 or more alphanumeric characters
-)              # close the group
-\s*            # 0 or more space
-(?P<method>    # open the group method
-\+?            # 0 or 1 +
-=              # One =
-)              # close the group
-(?P<value>     # open the group value
-.*             # 0 or more any characters 
-)              # close the group
-""", re.VERBOSE)
-
-# -----
-
-class CMakeFile(object):
-    
-    def __init__(self, the_root, root, dirs, files, f, module):
-        #
-        self.the_root = the_root
-        self.root = root
-        self.dirs = dirs
-        self.files = files
-        self.module = module
-        #
-        from os.path import join
-        self.amFile = join(root, f)
-        self.listsFile = join(root, "CMakeLists.txt")
-        #
-        self.parseFile()
-        #
-        return
-    
-    def parseFile(self):
-        
-        # --
-        # Read the Makefile.am file
-        # --
-        amFile = self.amFile
-        stream = open(amFile)
-        content = stream.read()
-        stream.close()
-        
-        # --
-        # Replace the composed lines separated by "\\n" by an unique line
-        # --
-        content = p_multiline.sub(r' ', content)
-        
-        # --
-        # Compatibility netgen plugin
-        # --
-        content = content.replace("../NETGEN/libNETGEN.la", "${NETGEN_LIBS}")
-        
-        # --
-        cas_list = [
-            "BinLPlugin",
-            "BinPlugin",
-            "BinTObjPlugin",
-            "BinXCAFPlugin",
-            "FWOSPlugin",
-            "PTKernel",
-            "StdLPlugin",
-            "StdPlugin",
-            "TKAdvTools",
-            "TKBin",
-            "TKBinL",
-            "TKBinTObj",
-            "TKBinXCAF",
-            "TKBO",
-            "TKBool",
-            "TKBRep",
-            "TKCAF",
-            "TKCDF",
-            "TKernel",
-            "TKFeat",
-            "TKFillet",
-            "TKG2d",
-            "TKG3d",
-            "TKGeomAlgo",
-            "TKGeomBase",
-            "TKHLR",
-            "TKIGES",
-            "TKLCAF",
-            "TKMath",
-            "TKMesh",
-            "TKMeshVS",
-            "TKNIS",
-            "TKOffset",
-            "TKOpenGl",
-            "TKPCAF",
-            "TKPLCAF",
-            "TKPrim",
-            "TKPShape",
-            "TKService",
-            "TKShapeSchema",
-            "TKShHealing",
-            "TKStdLSchema",
-            "TKStdSchema",
-            "TKSTEP",
-            "TKSTEP209",
-            "TKSTEPAttr",
-            "TKSTEPBase",
-            "TKSTL",
-            "TKTObj",
-            "TKTopAlgo",
-            "TKV2d",
-            "TKV3d",
-            "TKVRML",
-            "TKXCAF",
-            "TKXCAFSchema",
-            "TKXDEIGES",
-            "TKXDESTEP",
-            "TKXMesh",
-            "TKXml",
-            "TKXmlL",
-            "TKXmlTObj",
-            "TKXmlXCAF",
-            "TKXSBase",
-            "XCAFPlugin",
-            "XmlLPlugin",
-            "XmlPlugin",
-            "XmlTObjPlugin",
-            "XmlXCAFPlugin",
-            ]
-        vtk_list = [
-            "vtkCommonPythonD",
-            "vtkGraphicsPythonD",
-            "vtkImagingPythonD",
-            "vtkPythonCore",
-            ]
-        kernel_list  = [
-            "CalciumC",
-            "DF",
-            "Launcher",
-            "LifeCycleCORBATest",
-            "NamingServiceTest",
-            "OpUtil",
-            "Registry",
-            "ResourcesManager",
-            "SALOMEBasics",
-            "SalomeCatalog",
-            "SalomeCommunication",
-            "SalomeContainer",
-            "SalomeDatastream",
-            "SalomeDSCContainer",
-            "SalomeDSClient",
-            "SalomeDSCSupervBasic",
-            "SalomeDSCSuperv",
-            "SalomeDSImpl",
-            "SALOMEDSImplTest",
-            "SalomeDS",
-            "SALOMEDSTest",
-            "SalomeGenericObj",
-            "SalomeHDFPersist",
-            "SalomeIDLKernel",
-            "SalomeLauncher",
-            "SalomeLifeCycleCORBA",
-            "SALOMELocalTrace",
-            "SALOMELocalTraceTest",
-            "SalomeLoggerServer",
-            "SalomeMPIContainer",
-            "SalomeNotification",
-            "SalomeNS",
-            "SalomeResourcesManager",
-            "SalomeTestComponentEngine",
-            "SalomeTestMPIComponentEngine",
-            "SALOMETraceCollectorTest",
-            "TOOLSDS",
-            "UtilsTest",
-            "with_loggerTraceCollector",
-            "SalomeKernelHelpers",
-            ]
-        gui_list = [
-            "caf",
-            "CAM",
-            "CASCatch",
-            "DDS",
-            "Event",
-            "GLViewer",
-            "LightApp",
-            "LogWindow",
-            "ObjBrowser",
-            "OCCViewer",
-            "OpenGLUtils",
-            "Plot2d",
-            "PyConsole",
-            "PyInterp",
-            "QDS",
-            "qtx",
-            "QxScene",
-            "SalomeApp",
-            "SalomeAppTest",
-            "SalomeIDLGUI",
-            "SalomeObject",
-            "SalomePrs",
-            "SalomePyQtGUILight",
-            "SalomePyQtGUI",
-            "SalomePyQt",
-            "SalomePy",
-            "SalomeSession",
-            "SalomeStyle",
-            "SOCC",
-            "SPlot2d",
-            "std",
-            "SUITApp",
-            "suit",
-            "SUPERVGraph",
-            "SVTK",
-            "ToolsGUI",
-            "ViewerTools",
-            "VTKViewer",
-            "vtkEDFOverloads",
-            "vtkTools"
-            ]
-        geom_list = [
-            "AdvancedGUI",
-            "BasicGUI",
-            "BlocksGUI",
-            "BooleanGUI",
-            "BREPExport",
-            "BREPImport",
-            "BuildGUI",
-            "DisplayGUI",
-            "DlgRef",
-            "EntityGUI",
-            "GenerationGUI",
-            "GEOMAlgo",
-            "GEOMAlgo_NEW",
-            "GEOMArchimede",
-            "GEOMBase",
-            "GEOMbasic",
-            "GEOMClient",
-            "GEOMEngine",
-            "GEOMFiltersSelection",
-            "GEOMimpl",
-            "GEOMObject",
-            "GEOMSketcher",
-            "GEOM",
-            "GEOM_SupervEngine",
-            "GEOMToolsGUI",
-            "GroupGUI",
-            "IGESExport",
-            "IGESImport",
-            "MeasureGUI",
-           "Material",
-            "NMTDS",
-            "NMTDS_NEW",
-            "NMTTools",
-            "NMTTools_NEW",
-            "OCC2VTK",
-            "OperationGUI",
-            "PrimitiveGUI",
-            "RepairGUI",
-            "SalomeIDLGEOM",
-            "ShHealOper",
-            "STEPExport",
-            "STEPImport",
-            "STLExport",
-            "TransformationGUI",
-            "VTKExport",
-            ]
-        med_list = [
-            "interpkernel",
-            "InterpKernelTest",
-            "MEDClientcmodule",
-            "medcouplingclient",
-            "medcouplingcorba",
-            "medcouplingremapper",
-            "medcoupling",
-            "MEDEngine",
-            "medloader",
-            "MEDMEMCppTest",
-            "MEDMEMImpl",
-            "medmem",
-            "MED",
-            "medsplitter",
-            "MEDSPLITTERTest",
-            "med_V2_1",
-            "MEDWrapperBase",
-            "MEDWrapper",
-            "MEDWrapper_V2_1",
-            "MEDWrapper_V2_2",
-            "paramedcouplingcorba",
-            "paramedloader",
-            "paramedmemcompo",
-            "paramedmem",
-            "ParaMEDMEMTest",
-            "SalomeIDLMED",
-            "SalomeIDLMEDTests",
-            ]
-        smesh_list = [
-            "GeomSelectionTools",
-            "MEFISTO2D",
-            "MeshDriverDAT",
-            "MeshDriverMED",
-            "MeshDriver",
-            "MeshDriverSTL",
-            "MeshDriverUNV",
-            "SalomeIDLSMESH",
-            "SMDS",
-            "SMESHClient",
-            "SMESHControls",
-            "SMESHDS",
-            "SMESHEngine",
-            "SMESHFiltersSelection",
-            "SMESHimpl",
-            "SMESHObject",
-            "SMESH",
-            "SMESHUtils",
-            "StdMeshersEngine",
-            "StdMeshersGUI",
-            "StdMeshers",
-            ]
-        full_list  = cas_list + vtk_list
-        full_list += kernel_list + gui_list
-        full_list += geom_list + med_list + smesh_list
-        # --
-        # E.A. : sort by len before substitution ...
-        # Why ? Thing to "-lMEDWrapper" then "-lMEDWrapper_V2_1" substition
-        # And you understand ...
-        # --
-        full_list.sort(cmp = lambda x, y : cmp(len(y), len(x)))
-        # --
-        for key in full_list:
-            content = content.replace("-l%s"%(key), "${%s}"%(key))
-         
-            pass
-        
-        # --
-        # Split content in lines to treat each one separately
-        # --
-        lines = content.split('\n')
-        
-        # --
-        # newlines contains the lines of the future CMakeLists.txt file
-        # --
-        newlines = []
-        
-        # --
-        # opened_ifs is used to deals with nested conditionnals
-        # --
-        opened_ifs = []
-        
-        # --
-        # the __thedict__ dictionnary contains key, val
-        # of the Makefile.am file
-        # --
-        self.__thedict__ = {}
-        
-        # --
-        # Initialize file ... mainly includes other cmake files
-        # --
-        self.initialize(newlines)
-        
-        # --
-        # Do the job for each line
-        # --
-        for line in lines:
-            self.treatLine(line, newlines, opened_ifs)
-            pass
-        
-        # --
-        # Finalize file ... it is in here the cmake job is done
-        # --
-        self.finalize(newlines)
-        
-        # --
-        # Concatenate newlines into content
-        # --
-        content = '\n'.join(newlines)
-        
-        # --
-        # Add a CR at end if necessary
-        # --
-        lines = content.split('\n')
-        # lines = [ l.strip() for l in lines ]
-        if len(lines[-1]) != 0:
-            lines.append('')
-            pass
-        content = '\n'.join(lines)
-        
-        # --
-        self.content  = "# ---------------------------------------------------------------------\n"
-        self.content += "# This file was automatically generated by am2cmake (erwan.adam@cea.fr)\n"
-        self.content += "# ---------------------------------------------------------------------\n"
-        self.content += content
-        
-        # --
-        return
-    
-    def initialize(self, newlines):
-        if self.root == self.the_root:
-            # --
-            newlines.append("""
-            CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR)
-            IF(COMMAND cmake_policy)
-            cmake_policy(SET CMP0003 NEW)
-            ENDIF(COMMAND cmake_policy)
-            """)
-            # --
-            newlines.append("""
-            ENABLE_TESTING()
-            """)
-            # --
-            newlines.append("""
-            SET(MODULE %s)
-            """%(self.module.upper()))
-            # --
-            if self.module == "netgen":
-                newlines.append("""
-                INCLUDE(${CMAKE_SOURCE_DIR}/cmake/FindPLATFORM.cmake)
-                INCLUDE(${CMAKE_SOURCE_DIR}/cmake/FindCAS.cmake)
-                """)
-            else:
-                if self.module == "kernel":
-                    newlines.append("""
-                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)
-                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPYTHON.cmake)
-                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake)
-                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake)
-                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindMPI.cmake)
-                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindHDF5.cmake)
-                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindBOOST.cmake)
-                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake)
-                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSWIG.cmake)
-                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)
-                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake)
-                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake)
-                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)
-                    """)
-                    pass
-                else:
-                    if self.module == "med":
-                        newlines.append("""
-                        SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR})
-                        IF(KERNEL_ROOT_DIR)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPYTHON.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindMPI.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindHDF5.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindBOOST.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake)
-                        ELSE(KERNEL_ROOT_DIR)
-                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindPLATFORM.cmake)
-                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindMPI.cmake)
-                        ENDIF(KERNEL_ROOT_DIR)
-                        """)
-                    else:
-                        newlines.append("""
-                        SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR})
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPYTHON.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindMPI.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindHDF5.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindBOOST.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake)
-                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake)
-                        """)
-                        pass
-                    if self.module == "gui":
-                        newlines.append("""
-                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindCAS.cmake)
-                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindQT4.cmake)
-                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindOPENGL.cmake)
-                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindVTK.cmake)
-                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindQWT.cmake)
-                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSIPPYQT.cmake)
-                        """)
-                    else:
-                        newlines.append("""
-                        SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR})
-                        IF(GUI_ROOT_DIR)
-                        INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindCAS.cmake)
-                        INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindQT4.cmake)
-                        INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindOPENGL.cmake)
-                        INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindVTK.cmake)
-                        INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindQWT.cmake)
-                        INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindSIPPYQT.cmake)
-                        INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindGUI.cmake)
-                        ENDIF(GUI_ROOT_DIR)
-                        """)
-                        if self.module == "med":
-                            #METIS must be after PARMETIS to prevent to activate METIS if PARMETIS already exists
-                            newlines.append("""
-                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindPARMETIS.cmake)
-                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindMETIS.cmake)
-                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSCOTCH.cmake)
-                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSPLITTER.cmake)
-                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindRENUMBER.cmake)
-                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)
-                            IF(WINDOWS)
-                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindXDR.cmake)
-                            ENDIF(WINDOWS)
-                            """)
-                            pass
-                        if self.module == "smesh":
-                            newlines.append("""
-                            SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
-                            SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
-                            INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)
-                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)
-                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
-                            INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)
-                            """)
-                            pass
-                        if self.module == "geom":
-                            newlines.append("""
-                            INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)
-                            """)
-                            pass
-
-                        if self.module == "netgenplugin":
-                            newlines.append("""
-                            SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
-                            SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
-                            SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})
-                            INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)
-                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
-                            INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)
-                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindNETGEN.cmake)
-                            """)
-                            pass
-                        if self.module == "blsurfplugin":
-                            newlines.append("""
-                            SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
-                            SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
-                            SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})
-                            INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)
-                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
-                            INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)
-                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindBLSURF.cmake)
-                            """)
-                            pass
-                        if self.module in ["ghs3dplugin", "hexoticplugin"]:
-                            newlines.append("""
-                            SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
-                            SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
-                            SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})
-                            INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)
-                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
-                            INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)
-                            """)
-                            pass
-                        if self.module == "ghs3dprlplugin":
-                            newlines.append("""
-                            SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})
-                            SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
-                            SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})
-                            INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)
-                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)
-                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
-                            INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)
-                            """)
-                            pass
-                        if self.module == "visu":
-                            newlines.append("""
-                            SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
-                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
-                            """)
-                            pass
-                        if self.module == "yacs":
-                            newlines.append("""
-                            INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindEXPAT.cmake)
-                            INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindGRAPHVIZ.cmake)
-                            INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)
-                            """)
-                            pass
-                        if self.module == "hxx2salome":
-                            newlines.append("""
-                            SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})
-                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)
-                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
-                            """)
-                            pass
-                        pass
-                    pass
-                pass
-            # --
-            newlines.append("""
-            SET(DOXYGEN_IS_OK 0)
-            """)
-            if self.module not in ['med']:
-                newlines.append("""
-                IF(WINDOWS)
-                SET(CPPUNIT_IS_OK 0)
-                ENDIF(WINDOWS)
-                """)
-                pass
-            # --
-            if self.module == "kernel":
-                newlines.append("""
-                SET(WITH_LOCAL 1)
-                SET(WITH_BATCH 1)
-                SET(CALCIUM_IDL_INT_F77 long)
-                SET(CALCIUM_CORBA_INT_F77 CORBA::Long)
-                SET(LONG_OR_INT int)
-                """)
-            elif self.module == "gui":
-                newlines.append("""
-                SET(GUI_ENABLE_CORBA ${CORBA_GEN})
-                SET(ENABLE_VTKVIEWER ON)
-                SET(ENABLE_SALOMEOBJECT ON)
-                SET(ENABLE_OCCVIEWER ON)
-                SET(ENABLE_GLVIEWER ON)
-                SET(ENABLE_PLOT2DVIEWER ON)
-                SET(ENABLE_PYCONSOLE ON)
-                SET(ENABLE_SUPERVGRAPHVIEWER ON)
-                SET(ENABLE_QXGRAPHVIEWER ON)
-                """)
-                pass
-            elif self.module == "jobmanager":
-                newlines.append("""
-                IF(GUI_ROOT_DIR)
-                SET(HAS_GUI ON)
-                ENDIF(GUI_ROOT_DIR)
-                """)
-                pass
-            elif self.module == "geom":
-                newlines.append("""
-                IF(GUI_ROOT_DIR)
-                SET(GEOM_ENABLE_GUI ON)
-                ENDIF(GUI_ROOT_DIR)
-                """)
-                pass
-            elif self.module == "medfile":
-                newlines.append("""
-                SET(MED_NUM_MAJEUR 3)
-                SET(MED_NUM_MINEUR 0)
-                SET(MED_NUM_RELEASE 3)
-                SET(LONG_OR_INT int)
-                IF(NOT WINDOWS)
-                SET(FLIBS -lgfortranbegin -lgfortran)
-                ENDIF(NOT WINDOWS)
-                """)
-                pass
-            elif self.module == "med":
-                newlines.append("""
-                IF(KERNEL_ROOT_DIR)
-                SET(MED_ENABLE_KERNEL ON)
-                IF(NOT WINDOWS)
-                SET(MED_ENABLE_SPLITTER ON)
-                ENDIF(NOT WINDOWS)
-                ENDIF(KERNEL_ROOT_DIR)
-                IF(GUI_ROOT_DIR)
-                SET(MED_ENABLE_GUI ON)
-                ENDIF(GUI_ROOT_DIR)
-                """)
-                pass
-            elif self.module == "smesh":
-                newlines.append("""
-                IF(GUI_ROOT_DIR)
-                SET(SMESH_ENABLE_GUI ON)
-                ENDIF(GUI_ROOT_DIR)
-                """)
-                pass
-            elif self.module == "netgen":
-                newlines.append("""
-                SET(OCCFLAGS ${CAS_CPPFLAGS})
-                SET(OCCLIBS ${CAS_LDPATH})
-                SET(OCCLIBS ${OCCLIBS} ${TKernel} ${TKGeomBase} ${TKMath} ${TKG2d} ${TKG3d} ${TKXSBase} ${TKOffset} ${TKFillet} ${TKShHealing})
-                SET(OCCLIBS ${OCCLIBS} ${TKMesh} ${TKMeshVS} ${TKTopAlgo} ${TKGeomAlgo} ${TKBool} ${TKPrim} ${TKBO} ${TKIGES} ${TKBRep})
-                SET(OCCLIBS ${OCCLIBS} ${TKSTEPBase} ${TKSTEP} ${TKSTL} ${TKSTEPAttr} ${TKSTEP209} ${TKXDESTEP} ${TKXDEIGES} ${TKXCAF} ${TKLCAF} ${FWOSPlugin})
-                """)
-                pass
-            elif self.module == "netgenplugin":
-                newlines.append("""
-                IF(GUI_ROOT_DIR)
-                SET(NETGENPLUGIN_ENABLE_GUI ON)
-                ENDIF(GUI_ROOT_DIR)
-                """)
-                pass
-            elif self.module == "blsurfplugin":
-                newlines.append("""
-                IF(GUI_ROOT_DIR)
-                SET(BLSURFPLUGIN_ENABLE_GUI ON)
-                ENDIF(GUI_ROOT_DIR)
-                """)
-                pass
-            elif self.module == "ghs3dplugin":
-                newlines.append("""
-                IF(GUI_ROOT_DIR)
-                SET(GHS3DPLUGIN_ENABLE_GUI ON)
-                ENDIF(GUI_ROOT_DIR)
-                """)
-                pass
-            elif self.module == "hexoticplugin":
-                newlines.append("""
-                IF(GUI_ROOT_DIR)
-                SET(HEXOTICPLUGIN_ENABLE_GUI ON)
-                ENDIF(GUI_ROOT_DIR)
-                """)
-                pass
-            elif self.module == "ghs3dprlplugin":
-                newlines.append("""
-                IF(GUI_ROOT_DIR)
-                SET(GHS3DPRLPLUGIN_ENABLE_GUI ON)
-                ENDIF(GUI_ROOT_DIR)
-                """)
-                pass
-            elif self.module == "yacs":
-                newlines.append("""
-                SET(SALOME_KERNEL ON)
-                SET(HAS_GUI ON)
-                SET(WITH_QT4 ON)
-                """)
-                pass
-            # --
-            newlines.append("""
-            set(VERSION 6.5.0)
-            set(SHORT_VERSION 6.5)
-            set(XVERSION 0x060500)
-            """)
-            pass
-        # --
-        newlines.append("""
-        SET(VERSION_INFO 0.0.0)
-        SET(SOVERSION_INFO 0)
-        SET(SUBDIRS)
-        SET(bin_PROGRAMS)
-        SET(AM_CPPFLAGS -I${CMAKE_BINARY_DIR} )
-        SET(AM_CXXFLAGS -I${CMAKE_BINARY_DIR})
-        SET(LDADD)
-        SET(pythondir lib/python${PYTHON_VERSION}/site-packages)
-        SET(salomepythondir ${pythondir}/salome)
-        SET(salomepypkgdir ${salomepythondir}/salome)
-        """)
-        
-        if self.module == "smesh" and self.root[-len('SMESH_PY'):] == 'SMESH_PY':
-           newlines.append("""
-           SET(smeshpypkgdir ${salomepythondir}/salome/smesh)
-           """)
-           pass
-        if self.module == "netgen":
-            newlines.append(r'''
-            SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DNO_PARALLEL_THREADS -DOCCGEOMETRY -I${CMAKE_CURRENT_SOURCE_DIR})
-            ''')
-        elif self.module == "kernel":
-            newlines.append(r'''
-            SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h)
-            SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h)
-            ''')
-        else:
-            if self.module not in ["yacs"]:
-                newlines.append(r'''
-                IF(KERNEL_ROOT_DIR)
-                SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h)
-                SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h)
-                ENDIF(KERNEL_ROOT_DIR)
-                ''')
-                pass
-            if self.module == "gui":
-                newlines.append(r'''
-                IF(KERNEL_ROOT_DIR)
-                SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DWITH_SALOMEDS_OBSERVER -DSUIT_ENABLE_PYTHON)
-                SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DWITH_SALOMEDS_OBSERVER -DSUIT_ENABLE_PYTHON)
-                ENDIF(KERNEL_ROOT_DIR)
-                ''')
-                pass
-            if self.module in ["smesh", "netgenplugin", "blsurfplugin", "ghs3dplugin", "hexoticplugin"]:
-                newlines.append(r'''
-                SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DWITH_SMESH_CANCEL_COMPUTE)
-                SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DWITH_SMESH_CANCEL_COMPUTE)
-                ''')
-                pass
-            if self.module == "ghs3dplugin":
-    # TODO: Auto-detect TetGen-GHS3D version automatically
-                newlines.append(r'''
-                SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DGHS3D_VERSION=42)
-                SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DGHS3D_VERSION=42)
-                ''')
-                pass              
-            if self.module == "hxx2salome":
-                key = "_SRC"
-                if self.the_root[-len(key):] != key:
-                    msg = "Source dir must finished with %s !"%(key)
-                    raise Exception(msg)
-                hxxmodule = self.the_root[:-len(key)]
-                from os.path import basename
-                hxxmodule = basename(hxxmodule)
-                hxxmodule = hxxmodule.lower()
-                self.hxxmodule = hxxmodule
-                newlines.append(r'''
-                SET(HXXCPP_ROOT_DIR $ENV{%sCPP_ROOT_DIR})
-                SET(AM_CPPFLAGS ${AM_CPPFLAGS} -I${HXXCPP_ROOT_DIR}/include)
-                SET(AM_CXXFLAGS ${AM_CXXFLAGS} -I${HXXCPP_ROOT_DIR}/include)
-                SET(LDADD ${LDADD} -L${HXXCPP_ROOT_DIR}/lib)
-                '''%(hxxmodule.upper()))
-                pass
-            pass
-        # --
-        return
-    
-    def treatLine(self, line, newlines, opened_ifs):
-        
-        # --
-        # Print the comment above the line itself
-        # --
-        if line.find('#') >= 0:
-            fields = line.split('#')
-            line = fields[0]
-            comment = '#'.join([''] + fields[1:])
-            newlines.append(comment)
-            if len(line) == 0:
-                return
-            pass
-        
-        # --
-        # If the line begins with 'include ', just comment it
-        # --
-        if line.find("include ") == 0:
-            if line.find("include $(top_srcdir)/config/automake.common") == 0:
-                for l in [
-                    "MAINTAINERCLEANFILES = Makefile.in",
-                    "AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_builddir)/include",
-                    "AM_FFLAGS=-I$(top_srcdir)/include  -I$(top_builddir)/include",
-                    "AM_FCFLAGS=-I$(top_srcdir)/include  -I$(top_builddir)/include",
-                    "AM_CPPFLAGS+=@HDF5_CPPFLAGS@",
-                    "AM_LDFLAGS=@HDF5_LDFLAGS@",
-                    ]:
-                    self.treatLine(l, newlines, opened_ifs)
-                    pass
-                pass
-            else:
-                newlines.append("# " + line)
-                pass
-            return
-        
-        # --
-        # If the line begins with '-include', just comment it
-        # --
-        if line.find("-include") == 0:
-            newlines.append("# " + line)
-            return
-        
-        # --
-        # If the line is a definition of a make rule, just comment it
-        # --
-        if line.count(':') == 1:
-            newlines.append("# " + line)
-            return
-        
-        # --
-        # A particuliar case where there are two ":" on the same line
-        # --
-        if line.find('install-exec-local:') == 0:
-            newlines.append("# " + line)
-            return
-        
-        # --
-        # If the line begin by a tabulation, consider it's a makefile command and comment it
-        # --
-        if line.find("\t") == 0:
-            newlines.append("# " + line)
-            return
-        
-        # --
-        # --
-        key = "-version-info"
-        if line.find(key) >= 0:
-            # --
-            before = line.split(key)[0]
-            after = line[len(before)+len(key):]
-            sep = after[0]
-            after = after[1:]
-            version_info = after.split()[0]
-            line = line.replace(key+sep+version_info, "")
-            # --
-            version_info = version_info.replace(':', '.')
-            soversion_info = version_info.split('.')[0]
-            newlines.append("SET(VERSION_INFO " + version_info + ")")
-            newlines.append("SET(SOVERSION_INFO " + soversion_info + ")")
-            # --
-            pass
-        
-        # --
-        # Replace the $(TOTO) by ${TOTO}
-        # Replace the @TOTO@  by ${TOTO}
-        # --
-        line = p_dollar.sub(r"${\1}", line)
-        line = p_arobas.sub(r"${\1}", line)
-        
-        # --
-        line = line.replace(r"${top_builddir}", r"${CMAKE_BINARY_DIR}")
-        line = line.replace(r"${top_srcdir}", r"${CMAKE_SOURCE_DIR}")
-        line = line.replace(r"${srcdir}", r"${CMAKE_CURRENT_SOURCE_DIR}")
-        line = line.replace(r"${builddir}", r"${CMAKE_CURRENT_BINARY_DIR}")
-        line = line.replace(r"${datadir}", r"${CMAKE_INSTALL_PREFIX}/share")
-        
-        # --
-        # Check if the line is a 'if' condition
-        # If yes, replace it by a cmake grammar
-        # --
-        match = p_if.match(line)
-        if match:
-            theif = match.group("val")
-            if theif[0] == "!":
-                theif = "NOT " + theif[1:]
-                pass
-            line = p_if.sub(r"IF(%s)"%(theif), line)
-            opened_ifs.append(theif)
-            newlines.append(line)
-            return
-        
-        # --
-        # Check if the line is a 'else' condition
-        # If yes, replace it by a cmake grammar
-        # --
-        match = p_else.match(line)
-        if match:
-            line = "ELSE(%s)"%(opened_ifs[-1])
-            newlines.append(line)
-            return
-        
-        # --
-        # Check if the line is a 'endif' condition
-        # If yes, replace it by a cmake grammar
-        # --
-        match = p_endif.match(line)
-        if match:
-            line = "ENDIF(%s)"%(opened_ifs[-1])
-            opened_ifs[-1:] = []
-            newlines.append(line)
-            return
-        
-        # --
-        # Check if the line is an attribution '=' or '+='
-        # --
-        match = p_attribution.match(line)
-        if match:
-            self.treatAttribution(match, newlines)
-            return
-        
-        # --
-        newlines.append(line)
-        
-        # --
-        return
-    
-    def treatAttribution(self, match, newlines):
-        
-        spaces = match.group("spaces")
-        key = match.group("key")
-        method = match.group("method")
-        value = match.group("value")
-        # print [spaces, key, method, value]
-        
-        # --
-        # Open cmake SET command
-        # --
-        newlines.append(spaces + "SET(" + key)
-        
-        # --
-        # If method is '+=', put the previous definition as first value
-        # --
-        if method == "+=":
-            newlines.append("%s    ${%s}"%(spaces, key))
-            pass
-        
-        # --
-        fields = value.split()
-        
-        for i in range(len(fields)):
-            newlines.append("%s    %s"%(spaces, fields[i]))
-            pass
-        
-        # --
-        if method == "+=":
-            # --
-            # The try: except KeyError is here if the +=
-            # is an error which occurs in salome ...
-            # --
-            try:
-                self.__thedict__[key] += fields[:]
-            except KeyError:
-                self.__thedict__[key] = fields[:]
-                pass
-            pass
-        else:
-            self.__thedict__[key]  = fields[:]
-            pass
-        
-        # --
-        # Close cmake SET command
-        # --
-        
-        newlines.append("%s)"%(spaces))
-        
-        return
-    
-    def finalize(self, newlines):
-      
-        # --
-        # Convert the .in files in build dir
-        # --
-        upmod = ""
-        if self.module == "hexoticplugin" :
-          upmod = "HexoticPLUGIN"
-        else :
-          upmod = self.module.upper()
-
-        import operator
-        mod = self.module
-        if mod in ['kernel', 'gui'] and self.root[-len('gui'):] == 'gui' or mod == 'med' and operator.contains(self.root, 'doxygen'):
-            newlines.append(r'''
-            SET(top_builddir
-                ${CMAKE_BINARY_DIR}
-            )
-            SET(top_srcdir 
-                ${CMAKE_SOURCE_DIR}
-            )
-            SET(srcdir 
-                ${CMAKE_CURRENT_SOURCE_DIR}
-            )
-            SET(builddir 
-                ${CMAKE_CURRENT_BINARY_DIR}
-            )
-            SET(datadir
-                ${CMAKE_INSTALL_PREFIX}/share
-            )
-            SET(docdir 
-                ${datadir}/doc/salome
-            )
-            ''')
-            self.files.append("static/header.html.in")
-        elif self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc') or mod in ['kernel', 'gui', 'geom', 'med', 'smesh', 'visu'] and self.root[-len('tui'):] == 'tui':
-            newlines.append(r'''
-            SET(top_builddir
-                ${CMAKE_BINARY_DIR}
-            )
-            SET(top_srcdir 
-                ${CMAKE_SOURCE_DIR}
-            )
-            SET(srcdir 
-                ${CMAKE_CURRENT_SOURCE_DIR}
-            )
-            SET(builddir 
-                ${CMAKE_CURRENT_BINARY_DIR}
-            )
-            SET(datadir
-                ${CMAKE_INSTALL_PREFIX}/share
-            )
-            SET(docdir 
-                ${datadir}/doc/salome
-            )
-            ''')
-            self.files.append("static/header.html.in")
-            if mod in ['geom', 'smesh', 'visu','netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin',"ghs3dprlplugin"] and self.root[-len(mod):] == upmod:
-              self.files.append("static/header_py.html.in")
-     
-        if self.module == "yacs":
-            key = "salomegui"
-            if self.root[-len(key):] == key:
-                self.files.append("resources/YACSCatalog.xml.in")
-                self.files.append("resources/SalomeApp.xml.in")
-                pass
-            pass
-            from os import path
-            if operator.contains(self.root, 'YACS_SRC'+path.sep+'doc'):
-                newlines.append(r'''
-                SET(srcdir 
-                  ${CMAKE_CURRENT_SOURCE_DIR}
-                )
-                ''')
-            
-        if self.module == "jobmanager":
-            key = "salomegui"
-            if self.root[-len(key):] == key:
-                self.files.append("resources/SalomeApp.xml.in")
-                pass
-            pass
-        for f in self.files:
-            if f[-3:] == ".in":
-                if self.module == 'yacs' and f == "Doxyfile.in":
-                    continue
-                if f == "sstream.in":
-                    continue
-                if f in ["runContainer.in", "stopContainer.in"]:
-                    if self.module == "med":
-                        if self.root[-3:] == "csh":
-                            continue
-                        pass
-                    pass
-                if f == "SALOMEconfig.ref.in":
-                    out = "SALOMEconfig.h"
-                else:
-                    out = f[:-3]
-                    pass
-                newlines.append(r'''
-                SET(input ${CMAKE_CURRENT_SOURCE_DIR}/%s)
-                '''%(f))
-                newlines.append(r'''
-                SET(output ${CMAKE_CURRENT_BINARY_DIR}/%s)
-                '''%(out))
-                newlines.append(r'''
-                MESSAGE(STATUS "Creation of ${output}")
-                CONFIGURE_FILE(${input} ${output})
-                ''')
-                pass
-            pass
-
-        # --
-        # add commands for generating of user's documentation
-        # --
-        doc_gui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/%s"%(upmod)
-        doc_tui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/%s"%(upmod)
-        doc_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome"
-        head_source = "${CMAKE_CURRENT_SOURCE_DIR}/images/head.png"
-        if mod == 'kernel':
-            prepare_generating_doc_src = "${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/prepare_generating_doc.py"
-        else:
-            prepare_generating_doc_src = "$ENV{KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py"
-        if mod in ['kernel', 'gui'] and self.root[-len('gui'):] == 'gui' or mod == 'med' and operator.contains(self.root, 'doxygen'):
-            if mod == 'med':
-                doc_source = "${CMAKE_CURRENT_BINARY_DIR}/doc_ref_user/html"
-                input = "Doxyfile_med_user"
-            else:
-                doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod)
-                input = ""
-            newlines.append("""\t    ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} %s
-            COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''', True); shutil.copytree(r'''%s''', r'''%s'''); shutil.copy(r'''%s''', r'''%s''')"
-            VERBATIM 
-            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}             
-            )"""%(input, doc_gui_destination, doc_source, doc_gui_destination, head_source, doc_gui_destination))
-        from os import path
-        if mod in ['geom', 'smesh', 'visu', 'netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin','ghs3dprlplugin'] and self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc'):
-            ign = r"""'*usr_docs*', '*CMakeFiles*', '*.cmake', 'doxyfile*', '*.vcproj', 'static', 'Makefile*'"""
-            if mod in ['geom', 'smesh']:
-                if mod == 'geom':
-                    tmp = 'geompy'
-                    input = "COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_tui \n\t\t"
-                else:
-                    tmp =  'smesh' 
-                    input = ''
-                newlines.append(r"""
-                IF(WINDOWS)
-                  STRING(REPLACE "/" "\\" f "%s")
-               ELSE(WINDOWS)
-                 SET(f "%s")                       
-                ENDIF(WINDOWS)
-                ADD_CUSTOM_TARGET(usr_docs ${PYTHON_EXECUTABLE} ${f} %s.py ${CMAKE_SOURCE_DIR}/src/%s_SWIG/%sDC.py %s
-                %sCOMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py
-                COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
-                COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''%s.py''')"
-                COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''', True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''', r'''%s''', ignore=shutil.ignore_patterns(%s)); shutil.copy(r'''%s''', r'''%s''')"
-                VERBATIM 
-                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}             
-                )"""%(prepare_generating_doc_src, prepare_generating_doc_src, tmp, upmod, tmp, tmp, input, tmp, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination))
-            else:
-                config_f = ""
-               if mod in ['netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin', "ghs3dprlplugin"] :
-                    config_f = "doxyfile_py"
-                else:
-                    config_f = "doxyfile_idl"
-                newlines.append("""\t    ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} %s
-                COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
-                COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''',True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''',r'''%s''', ignore=shutil.ignore_patterns(%s)); shutil.copy(r'''%s''',r'''%s''')"
-                VERBATIM 
-                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-                )"""%(config_f, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination))
-        elif mod == 'yacs' and operator.contains(self.root, upmod + '_SRC'+path.sep+'doc'):
-            from sys import platform
-            params = '';
-            if platform == "win32":
-                params = '-Q';
-            newlines.append(r"""
-            ADD_CUSTOM_TARGET(html_docs ${SPHINX_EXECUTABLE} %s -c ${CMAKE_BINARY_DIR}/doc -b html ${ALLSPHINXOPTS} html
-            COMMAND ${PYTHON_EXECUTABLE} -c \"import shutil\;shutil.rmtree('''%s''', True)\;shutil.copytree('''${CMAKE_CURRENT_BINARY_DIR}/html''', '''%s''')\"
-            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"""%(params, doc_gui_destination, doc_gui_destination))              
-       elif mod in ['kernel', 'smesh', 'geom'] and operator.contains(self.root, upmod + '_SRC'+path.sep+'doc'+path.sep+'docutils'):
-            from sys import platform
-            params = ""
-            ext = ""
-            prf = ""
-            if platform == "win32":
-                params = '-Q';
-                ext = "bat"
-                prf = "call"
-            else:
-                ext = "sh"
-                prf = ". "
-            doc_gui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/%s/docutils"%(upmod)
-            scr = self.writeEnvScript(upmod)                   
-            newlines.append(r"""
-            IF(WINDOWS)
-               STRING(REPLACE "/" "\\" SCR "%s")
-           ELSE(WINDOWS)
-               SET(SCR "%s")
-            ENDIF(WINDOWS)
-            FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/env_s.%s "${SCR}")
-            ADD_CUSTOM_TARGET(html_docs %s ${CMAKE_CURRENT_BINARY_DIR}/env_s.%s && ${SPHINX_EXECUTABLE} %s -c ${CMAKE_BINARY_DIR}/doc/docutils -W -b html ${ALLSPHINXOPTS} html
-            COMMAND ${PYTHON_EXECUTABLE} -c \"import shutil\;shutil.rmtree('''%s''', True)\;shutil.copytree('''${CMAKE_CURRENT_BINARY_DIR}/html''', '''%s''')\"
-            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"""%(scr,scr,ext,prf,ext,params, doc_gui_destination, doc_gui_destination))
-
-
-
-
-  # --
-  # add commands for generating of developer's documentation
-  # --
-  
-        upmod = self.module.upper()
-        if mod in ['kernel', 'gui', 'med', 'smesh', 'visu'] and self.root[-len('tui'):] == 'tui':
-            if mod == 'kernel':
-                tmp = """\tADD_CUSTOM_TARGET(dev_docs ${DOXYGEN_EXECUTABLE} -u
-            COMMAND ${DOXYGEN_EXECUTABLE}
-            COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''${CMAKE_CURRENT_BINARY_DIR}/doxyfile.bak''')"  """
-                tmp1=""
-            else: 
-                tmp = """\tADD_CUSTOM_TARGET(dev_docs ${DOXYGEN_EXECUTABLE}"""
-                if mod == 'visu':
-                    tmp1= r"""\n           COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/visuscreen.png''', r'''%s''')" """%(doc_tui_destination)
-                elif mod == 'smesh':
-                    extra_srcdir = "${CMAKE_CURRENT_SOURCE_DIR}/extra"
-                    tmp1= """\n            COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/smeshscreen.png''', r'''%s'''); copy(r'''%s/AddNetgenInSalome2.pdf''', r'''%s'''); copy(r'''%s/PluginMeshers.html''', r'''%s''')" 
-            COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''%s/AddNetgenInSalome2.ps''', r'''%s'''); copy(r'''%s/AddNetgenInSalome2.sxw''', r'''%s''')" """%(doc_tui_destination, extra_srcdir,doc_destination, extra_srcdir,doc_destination, extra_srcdir,doc_destination,extra_srcdir,doc_destination)
-                else:
-                    tmp1=""
-            doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod)
-            newlines.append(tmp + """
-            COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''', True); shutil.copytree(r'''%s''', r'''%s'''); shutil.copy(r'''%s''', r'''%s''')" """%(doc_tui_destination, doc_source, doc_tui_destination, head_source, doc_tui_destination) + tmp1 + """
-            VERBATIM 
-            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}             
-            )""")
-        if mod == 'geom' and self.root[-len('tui'):] == 'tui':
-            tmp = 'geompy'
-            doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod)
-            newlines.append(r"""
-            IF(WINDOWS)
-              STRING(REPLACE "/" "\\" f "%s")
-            ELSE(WINDOWS)
-              SET(f "%s")
-           ENDIF(WINDOWS)
-            ADD_CUSTOM_TARGET(dev_docs ${PYTHON_EXECUTABLE} ${f} ${CMAKE_BINARY_DIR}/src/%s_SWIG/%s.py ${CMAKE_SOURCE_DIR}/src/%s_SWIG/%sDC.py %s
-            COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
-            COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''${CMAKE_BINARY_DIR}/src/%s_SWIG/%s.py''')"
-            COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''', True); shutil.copytree(r'''%s''', r'''%s'''); shutil.copy(r'''%s''', r'''%s'''); shutil.copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/geomscreen.png''', r'''%s''')"
-            VERBATIM 
-            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}             
-            )"""%(prepare_generating_doc_src, prepare_generating_doc_src, upmod, tmp, upmod, tmp, tmp, upmod, tmp, doc_tui_destination, doc_source, doc_tui_destination, head_source, doc_tui_destination, doc_tui_destination))
-
-        # --
-        # convert the SUBDIRS in cmake grammar
-        # --
-        if 1: # self.__thedict__.has_key("SUBDIRS"):
-            newlines.append(r'''
-            FOREACH(dir ${SUBDIRS})
-            IF(NOT dir STREQUAL .)
-            ADD_SUBDIRECTORY(${dir})
-            ENDIF(NOT dir STREQUAL .)
-            ENDFOREACH(dir ${SUBDIRS})
-            ''')
-            pass
-        
-        # --
-        # --
-        for key in ["lib_LTLIBRARIES", "noinst_LTLIBRARIES", "salomepyexec_LTLIBRARIES", "libparaview_LTLIBRARIES"] :
-            if self.__thedict__.has_key(key):
-                self.addLibTarget(key, newlines)
-                pass
-            pass
-        
-        # --
-        # --
-        for key in ["bin_PROGRAMS", "check_PROGRAMS"]:
-            if self.__thedict__.has_key(key):
-                self.addBinTarget(key, newlines)
-                pass
-            pass
-        
-        # --
-        # --
-        if self.__thedict__.has_key("BASEIDL_FILES"):
-            if not self.__thedict__.has_key("IDL_FILES"):
-                self.__thedict__["IDL_FILES"] = self.__thedict__["BASEIDL_FILES"]
-                newlines.append('''
-                SET(IDL_FILES ${BASEIDL_FILES})
-                ''')
-                pass
-            pass
-        
-        # --
-        # --
-        
-        key = "IDL_FILES"
-        if self.__thedict__.has_key(key):
-            if self.module == "kernel":
-                newlines.append('''
-                SET(IDL_FILES ${IDL_FILES} Calcium_Ports.idl)
-                ''')
-                pass
-            newlines.append('''
-            FOREACH(input ${IDL_FILES})
-            STRING(REGEX REPLACE ".idl" "" base ${input})
-            SET(src ${CMAKE_CURRENT_BINARY_DIR}/${base}SK.cc)
-            SET(outputs ${src})
-            SET(dynsrc ${CMAKE_CURRENT_BINARY_DIR}/${base}DynSK.cc)
-            SET(outputs ${outputs} ${dynsrc})
-            SET(inc ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh)
-            SET(outputs ${outputs} ${inc})
-            IF(input STREQUAL Calcium_Ports.idl)
-            SET(input ${CMAKE_CURRENT_BINARY_DIR}/${input})
-            ELSE(input STREQUAL Calcium_Ports.idl)
-            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
-            ENDIF(input STREQUAL Calcium_Ports.idl)
-            SET(flags ${IDLCXXFLAGS} ${OMNIORB_IDLCXXFLAGS})
-            STRING(REGEX MATCH "-bcxx" ISBCXX ${flags})
-            IF(NOT ISBCXX)
-            SET(flags -bcxx ${flags})
-            ENDIF(NOT ISBCXX)
-            ADD_CUSTOM_COMMAND(
-            OUTPUT ${outputs}
-            COMMAND ${OMNIORB_IDL} ${flags} ${input}
-            MAIN_DEPENDENCY ${input}
-            )
-            ''')
-            newlines.append('''
-            install(FILES ${input} DESTINATION idl/salome)
-            ''')
-            if self.module not in ["pyhello"]:
-                newlines.append('''
-                SET(IDL_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh)
-                install(FILES ${IDL_HEADER} DESTINATION include/salome)
-                ''')
-                pass
-            newlines.append('''
-            INSTALL(CODE "SET(IDL_FILE ${input})")
-            INSTALL(CODE "SET(DIR ${salomepythondir})")
-            IF(WINDOWS)
-            INSTALL(CODE "SET(DIR bin/salome)")
-            ENDIF(WINDOWS)
-            INSTALL(CODE "SET(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})")
-            INSTALL(CODE "SET(OMNIORB_IDL_PYTHON ${OMNIORB_IDL_PYTHON})")
-            # --
-            SET(flags)
-            FOREACH(f ${IDLPYFLAGS})
-            SET(flags "${flags} ${f}")
-            ENDFOREACH(f ${IDLPYFLAGS})
-            STRING(REGEX MATCH "-bpython" ISBPYTHON ${flags})
-            IF(NOT ISBPYTHON)
-            SET(flags "-bpython ${flags}")
-            ENDIF(NOT ISBPYTHON)
-            SET(IDLPYFLAGS ${flags})
-            STRING(REPLACE "\\\\" "/" IDLPYFLAGS ${IDLPYFLAGS})
-            INSTALL(CODE "SET(IDLPYFLAGS ${IDLPYFLAGS})")
-            # --
-            ''')
-            if self.module == "kernel":
-                newlines.append('''
-                INSTALL(SCRIPT ${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/install_python_from_idl.cmake)
-                ''')
-            else:
-                newlines.append('''
-                STRING(REPLACE "\\\\" "/" KERNEL_ROOT_DIR ${KERNEL_ROOT_DIR})
-                INSTALL(SCRIPT ${KERNEL_ROOT_DIR}/salome_adm/cmake_files/install_python_from_idl.cmake)
-                ''')
-                pass
-            newlines.append('''
-            ENDFOREACH(input ${IDL_FILES})
-            ''')
-            pass
-        
-        # --
-        # --
-        for key in ["SWIG_SRC", "SWIGSOURCES", "SWIG_DEF"]:
-            if self.__thedict__.has_key(key):
-                newlines.append('''
-                SET(SWIG_SOURCES ${%s})
-                '''%(key))
-                self.__thedict__["SWIG_SOURCES"] = self.__thedict__[key]
-                pass
-            pass
-        
-        # --
-        # --
-        if self.__thedict__.has_key("SWIG_SOURCES"):
-            newlines.append('''
-            IF(SWIG_SOURCES MATCHES ";")
-            STRING(REGEX REPLACE ";.*" "" SWIG_SOURCES_FIRST "${SWIG_SOURCES}")
-            ELSE(SWIG_SOURCES MATCHES ";")
-            SET(SWIG_SOURCES_FIRST "${SWIG_SOURCES}")
-            ENDIF(SWIG_SOURCES MATCHES ";")
-            SET(flags)
-            FOREACH(f ${SWIG_FLAGS} ${MY_SWIG_FLAGS})
-            SET(test ON)
-            IF(flags)
-            LIST(FIND flags ${f} index)
-            IF(NOT index EQUAL -1)
-            SET(test OFF)
-            ENDIF(NOT index EQUAL -1)
-            ENDIF(flags)
-            IF(test)
-            SET(flags ${flags} ${f})
-            ENDIF(test)
-            ENDFOREACH(f ${SWIG_FLAGS} ${MY_SWIG_FLAGS})
-            ADD_CUSTOM_COMMAND(
-            OUTPUT ${build_srcs}
-            COMMAND ${SWIG_EXECUTABLE} ${flags} -o ${build_srcs} ${CMAKE_CURRENT_SOURCE_DIR}/${SWIG_SOURCES_FIRST}
-            MAIN_DEPENDENCY ${SWIG_SOURCES}
-            )
-            ''')
-            pass
-        
-        # --
-        # --
-        if self.__thedict__.has_key("BUILT_SOURCES"):
-            newlines.append('''
-            FOREACH(f ${BUILT_SOURCES})
-            IF(f MATCHES "WRAP.cxx$")
-            # STRING(REGEX REPLACE "WRAP.cxx" "WRAP.h" inc ${f})
-            STRING(REGEX REPLACE "WRAP.cxx" ".i" input ${f})
-            ADD_CUSTOM_COMMAND(
-            OUTPUT ${f} # ${inc}
-            COMMAND ${SWIG_EXECUTABLE} ${SWIG_FLAGS} ${SWIG_PYTHON_INCLUDES} ${MYSWIG_FLAGS} -o ${f} ${CMAKE_CURRENT_SOURCE_DIR}/${input}
-            MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${input}
-            )
-            ENDIF(f MATCHES "WRAP.cxx$")
-            ENDFOREACH(f ${BUILT_SOURCES})
-            ''')
-            pass
-
-        # --
-        # --
-        key = "MOC_FILES"
-        if self.__thedict__.has_key(key):
-            newlines.append('''
-            FOREACH(output ${MOC_FILES})
-            ''')
-            if self.module in ["jobmanager", "yacs"]:
-                newlines.append('''
-                STRING(REGEX REPLACE _moc.cxx .hxx input ${output})
-                ''')
-            else:
-                newlines.append('''
-                STRING(REGEX REPLACE _moc.cxx .h input ${output})
-                ''')
-                pass
-            newlines.append('''
-            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
-            SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output})
-            ADD_CUSTOM_COMMAND(
-            OUTPUT ${output}
-            COMMAND ${QT_MOC_EXECUTABLE} ${MOC_FLAGS} ${input} -o ${output}
-            MAIN_DEPENDENCY ${input}
-            )
-            ENDFOREACH(output ${MOC_FILES})
-            ''')
-            pass
-        
-        # --
-        # --
-        key = "MOC_FILES_HXX"
-        if self.__thedict__.has_key(key):
-            newlines.append('''
-            FOREACH(output ${MOC_FILES_HXX})
-            ''')
-            newlines.append('''
-            STRING(REGEX REPLACE _moc.cxx .hxx input ${output})
-            ''')
-            newlines.append('''
-            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
-            SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output})
-            ADD_CUSTOM_COMMAND(
-            OUTPUT ${output}
-            COMMAND ${QT_MOC_EXECUTABLE} ${MOC_FLAGS} ${input} -o ${output}
-            MAIN_DEPENDENCY ${input}
-            )
-            ENDFOREACH(output ${MOC_FILES_HXX})
-            ''')
-            pass
-        
-        # --
-        # --
-        key = "UIC_FILES"
-        if self.__thedict__.has_key(key):
-            newlines.append('''
-            FOREACH(output ${UIC_FILES})
-            STRING(REPLACE "ui_" "" input ${output})
-            STRING(REPLACE ".h" ".ui" input ${input})
-            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
-            SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output})
-            ADD_CUSTOM_COMMAND(
-            OUTPUT ${output}
-            COMMAND ${QT_UIC_EXECUTABLE} -o ${output} ${input}
-            MAIN_DEPENDENCY ${input}
-            )
-            ENDFOREACH(output ${UIC_FILES})
-            ''')
-            pass
-        
-        # --
-        # --
-        key = "PYUIC_FILES"
-        if self.__thedict__.has_key(key):
-            newlines.append('''
-            FOREACH(output ${PYUIC_FILES})
-            STRING(REPLACE "_ui.py" ".ui" input ${output})
-            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
-            SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output})
-            ADD_CUSTOM_COMMAND(
-            OUTPUT ${output}
-            COMMAND ${PYUIC_EXECUTABLE} -o ${output} ${input}
-            MAIN_DEPENDENCY ${input}
-            )
-            ENDFOREACH(output ${PYUIC_FILES})
-            ADD_CUSTOM_TARGET(BUILD_PY_UI_FILES ALL DEPENDS ${PYUIC_FILES})
-            ''')
-            pass
-        
-        # --
-        # --
-        key = "QRC_FILES"
-        if self.__thedict__.has_key(key):
-            newlines.append('''
-            FOREACH(output ${QRC_FILES})
-            STRING(REGEX REPLACE "qrc_" "" input ${output})
-            STRING(REGEX REPLACE ".cxx" ".qrc" input ${input})
-            STRING(REGEX REPLACE ".qrc" "" name ${input})
-            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
-            SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output})
-            ADD_CUSTOM_COMMAND(
-            OUTPUT ${output}
-            COMMAND ${QT_RCC_EXECUTABLE} ${input} -o ${output} -name ${name}
-            MAIN_DEPENDENCY ${input}
-            )
-            ENDFOREACH(output ${QRC_FILES})
-            ''')
-            pass
-        
-        # --
-        # --
-        key = "SIP_FILES"
-        if self.__thedict__.has_key(key):
-            newlines.append('''
-            FOREACH(input ${SIP_FILES})
-            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
-            SET(output)
-            FOREACH(out ${SIP_SRC})
-            SET(output ${output} ${CMAKE_CURRENT_BINARY_DIR}/${out})
-            ENDFOREACH(out ${SIP_SRC})
-            ADD_CUSTOM_COMMAND(
-            OUTPUT ${output}
-            COMMAND ${SIP_EXECUTABLE} ${PYQT_SIPFLAGS} ${input}
-            MAIN_DEPENDENCY ${input}
-            )
-            ENDFOREACH(input ${SIP_FILES})
-            ''')
-            pass
-
-        # --
-        # For GUI/tools/dlgfactory
-        # --
-        key = "UIC_FILES_QDIALOG"
-        if self.__thedict__.has_key(key):
-            newlines.append('''
-            FOREACH(output ${UIC_FILES_QDIALOG} ${UIC_FILES_GDIALOG})
-            STRING(REPLACE "ui_" "" input ${output})
-            STRING(REPLACE ".hxx" ".ui" input ${input})
-            SET(input_path ${CMAKE_CURRENT_SOURCE_DIR}/${input})
-            IF (NOT EXISTS ${input_path})
-              SET(input_path ${CMAKE_CURRENT_BINARY_DIR}/${input})
-            ENDIF (NOT EXISTS ${input_path})
-            ADD_CUSTOM_COMMAND(
-            OUTPUT ${output}
-            COMMAND ${QT_UIC_EXECUTABLE} -o ${output} ${input_path}
-            MAIN_DEPENDENCY ${input}
-            )
-            ENDFOREACH(output ${UIC_FILES})
-
-            FOREACH(output ${MOC_FILES_QDIALOG} ${MOC_FILES_GDIALOG})
-            STRING(REGEX REPLACE _moc.cxx .hxx input ${output})
-            SET(input_path ${CMAKE_CURRENT_SOURCE_DIR}/${input})
-            IF (NOT EXISTS ${input_path})
-              SET(input_path ${CMAKE_CURRENT_BINARY_DIR}/${input})
-            ENDIF (NOT EXISTS ${input_path})
-            ADD_CUSTOM_COMMAND(
-            OUTPUT ${output}
-            COMMAND ${QT_MOC_EXECUTABLE} ${MOC_FLAGS} ${input_path} -o ${output}
-            MAIN_DEPENDENCY ${input}
-            )
-            ENDFOREACH(output ${MOC_FILES})
-            
-            ADD_CUSTOM_COMMAND(
-            OUTPUT QDialogTest.ui QDialogTest.hxx QDialogTest.cxx
-            COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dlgfactory.py -n QDialogTest -t qdialog
-            DEPENDS __QDIALOG__.ui __QDIALOG__.hxx __QDIALOG__.cxx dlgfactory.py
-            )
-            
-            ADD_CUSTOM_COMMAND(
-            OUTPUT GDialogTest.ui GDialogTest.hxx GDialogTest.cxx
-            COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dlgfactory.py -n GDialogTest -t gdialog
-            DEPENDS __GDIALOG__.ui __GDIALOG__.hxx __GDIALOG__.cxx dlgfactory.py
-            )
-            ''')
-            pass
-
-        # --
-        # For make check
-        # --
-        for key in ["TESTS"]:
-            if self.__thedict__.has_key(key):
-                newlines.append('''
-                SET(UNIT_TEST_PROG ${%s})
-                '''%(key))
-                self.__thedict__["UNIT_TEST_PROG"] = self.__thedict__[key]
-                pass
-            pass
-        key = "UNIT_TEST_PROG"
-        if self.__thedict__.has_key(key):
-            newlines.append('''
-            FOREACH(input ${UNIT_TEST_PROG})
-            GET_FILENAME_COMPONENT(ext ${input} EXT)
-            IF(ext STREQUAL .py)
-            SET(test ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${input})
-            ELSE(ext STREQUAL .py)
-            IF(WINDOWS)
-            SET(test ${CMAKE_CURRENT_BINARY_DIR}/${input}_exe.exe)
-            ELSE()
-            SET(test ${CMAKE_CURRENT_BINARY_DIR}/${input}_exe)
-            ENDIF()
-            ENDIF(ext STREQUAL .py)
-            ADD_TEST(${input} ${test})
-            SET(fail_regex "KO")
-            SET_PROPERTY(TEST ${input} PROPERTY FAIL_REGULAR_EXPRESSION "${fail_regex}")
-            # IF(NOT WINDOWS)
-            # ADD_TEST(${input}_valgrind valgrind ${test})
-            # SET_PROPERTY(TEST ${input}_valgrind PROPERTY FAIL_REGULAR_EXPRESSION "${fail_regex}")
-            # SET_PROPERTY(TEST ${input}_valgrind PROPERTY PASS_REGULAR_EXPRESSION "no leaks are possible")
-            # ENDIF()
-            ENDFOREACH(input ${UNIT_TEST_PROG})
-            ''')
-            pass
-        
-        # --
-        # Treat the install targets
-        # --
-        resdir = self.module
-        if resdir == "hxx2salome":
-            resdir = self.hxxmodule
-            pass
-        d = {
-            "salomeadmux_DATA"                 :  "salome_adm/unix",
-            "dist_salomeadmux_DATA"            :  "salome_adm/unix",
-            "dist_salome_cmake_DATA"           :  "salome_adm/cmake_files",
-            "dist_salomem4_DATA"               :  "salome_adm/unix/config_files",
-            "dist_salome4depr_DATA"            :  "salome_adm/unix/config_files/DEPRECATED",
-            "dist_admlocalm4_DATA"             :  "adm_local/unix/config_files",
-            "dist_admlocal_cmake_DATA"         :  "adm_local/cmake_files",
-            "salomeinclude_DATA"               :  "include/salome",
-            "salomeinclude_HEADERS"            :  "include/salome",
-            "nodist_salomeinclude_HEADERS"     :  "include/salome",
-            "dist_salomeres_DATA"              :  "share/salome/resources/%s"%(resdir),
-            "nodist_salomeres_DATA"            :  "share/salome/resources/%s"%(resdir),
-            "nodist_salomeres_SCRIPTS"         :  "share/salome/resources/%s"%(resdir),
-            "dist_salomescript_SCRIPTS"        :  "bin/salome",
-            "dist_salomescript_DATA"           :  "bin/salome",
-            "dist_salomescript_PYTHON"         :  "bin/salome",
-            "dist_appliskel_SCRIPTS"           :  "bin/salome/appliskel",
-            "dist_appliskel_PYTHON"            :  "bin/salome/appliskel",
-            "nodist_salomescript_DATA"         :  "bin/salome",
-            "salomepython_PYTHON"              :  "${salomepythondir}",
-            "nodist_salomepython_PYTHON"       :  "${salomepythondir}",
-            "dist_salomepython_DATA"           :  "${salomepythondir}",
-            "sharedpkgpython_PYTHON"           :  "${salomepythondir}/shared_modules",
-            "salomepypkg_PYTHON"               :  "${salomepypkgdir}",
-            "mypkgpython_PYTHON"               :  "${mypkgpythondir}",
-            "nodist_mypkgpython_PYTHON"        :  "${mypkgpythondir}",
-            }
-        if self.module == "jobmanager":
-            d["bin_SCRIPTS"] = "bin"
-            pass
-        if self.module == "medfile":
-            d = {
-                "include_HEADERS"        :  "include",
-                "nodist_include_HEADERS" :  "include",
-                "bin_SCRIPTS"            :  "bin",
-                "doc_DATA"               :  "${docdir}",
-                }
-            pass
-        if self.module == "netgen":
-            d = {
-                "include_HEADERS"        :  "include",
-                "noinst_HEADERS"         :  "share/netgen/include",
-                "dist_pkgdata_DATA"      :  "share/netgen",
-                "dist_doc_DATA"          :  "share/doc/netgen",
-                }
-            pass
-        for key, value in d.items():
-            if self.__thedict__.has_key(key):
-                self.addInstallTarget(key, value, newlines)
-                pass
-            pass
-        
-        # --
-        return
-    
-    def setLibAdd(self, key, newlines):
-        # --
-        newlines.append(r'''
-        SET(libadd)
-        ''')
-        # --
-        newlines.append(r'''
-        IF(WINDOWS)
-        SET(targets)
-        SET(targets ${targets} MEFISTO2D)
-        FOREACH(target ${targets})
-        IF(name STREQUAL ${target})
-        SET(dir $ENV{F2CHOME})
-        STRING(REPLACE "\\\\" "/" dir ${dir})
-        SET(libadd ${libadd} ${dir}/LIBF77.lib)
-        SET(libadd ${libadd} ${dir}/LIBI77.lib)
-        ENDIF(name STREQUAL ${target})
-        ENDFOREACH(target ${targets})
-        ELSE(WINDOWS)
-        SET(targets)
-        SET(targets ${targets} MEFISTO2D)
-        FOREACH(target ${targets})
-        IF(name STREQUAL ${target})
-        SET(libadd ${libadd} -lf2c)
-        ENDIF(name STREQUAL ${target})
-        ENDFOREACH(target ${targets})
-        ENDIF(WINDOWS)
-        ''')
-        # --
-        newlines.append(r'''
-        SET(libs ${PLATFORM_LIBADD} ${PLATFORM_LDFLAGS} ${LDADD} ${${amname}_LIBADD} ${${amname}_LDADD} ${${amname}_LDFLAGS})
-        FOREACH(lib SALOMEBasics SalomeBatch)
-        IF(name STREQUAL lib)
-        SET(libs ${libs} ${PTHREAD_LIBS})
-        ENDIF(name STREQUAL lib)
-        ENDFOREACH(lib SALOMEBasics SalomeBatch)
-        ''')
-        # --
-        newlines.append(r'''
-        FOREACH(lib ${libs})
-        GET_FILENAME_COMPONENT(ext ${lib} EXT)
-        IF(ext STREQUAL .la)
-        GET_FILENAME_COMPONENT(lib ${lib} NAME_WE)
-        STRING(REGEX REPLACE "^lib" "" lib ${lib})
-        ENDIF(ext STREQUAL .la)
-        SET(vars)
-        SET(vars ${vars} -no-undefined)
-        SET(vars ${vars} -lvtkWidgets)
-        IF(WINDOWS)
-        SET(vars ${vars} -module)
-        SET(vars ${vars} -Wl,-E)
-        SET(vars ${vars} -Xlinker)
-        SET(vars ${vars} -export-dynamic)
-        SET(vars ${vars} -lm)
-        SET(vars ${vars} -lboost_thread)
-        SET(vars ${vars} -lboost_signals)
-        SET(vars ${vars} -pthread -lpthread -ldl)
-        ENDIF(WINDOWS)
-        FOREACH(v ${vars})
-        IF(lib STREQUAL v)
-        SET(lib)
-        ENDIF(lib STREQUAL v)
-        ENDFOREACH(v ${vars})
-        SET(test OFF)
-        IF(lib)
-        STRING(REGEX MATCH "^-lQt" test ${lib})
-        ENDIF(lib)
-        IF(NOT test)
-        SET(libadd ${libadd} ${lib})
-        ENDIF(NOT test)
-        ENDFOREACH(lib ${libs})
-        TARGET_LINK_LIBRARIES(${name} ${libadd})
-        ''')
-        # --
-        newlines.append(r'''
-        IF(WINDOWS)
-        SET(targets)
-        SET(targets ${targets} MEFISTO2D)
-        FOREACH(target ${targets})
-        IF(name STREQUAL ${target})
-        IF(CMAKE_BUILD_TYPE STREQUAL Debug)
-        SET_TARGET_PROPERTIES(${name} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:MSVCRT")
-        ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)
-        ENDIF(name STREQUAL ${target})
-        ENDFOREACH(target ${targets})
-        ENDIF(WINDOWS)
-        ''')
-        # --
-        return
-    
-    def setCompilationFlags(self, key, newlines):
-        newlines.append(r'''
-        SET(var)
-        IF(WINDOWS)
-        SET(targets)
-        SET(targets ${targets} SalomeIDLKernel)
-        SET(targets ${targets} SalomeDS)
-        SET(targets ${targets} SALOMEDSTest)
-        SET(targets ${targets} SALOMEDS_Client_exe)
-        SET(targets ${targets} SalomeIDLGEOM)
-        SET(targets ${targets} GEOMEngine)
-        SET(targets ${targets} MEDEngine)
-        SET(targets ${targets} SMESHEngine)
-        SET(targets ${targets} SMESH)
-        SET(targets ${targets} SalomeIDLSPADDER)
-        SET(targets ${targets} MeshJobManagerEngine)
-        SET(targets ${targets} StdMeshersEngine)
-        SET(targets ${targets} VISUEngineImpl)
-        FOREACH(target ${targets})
-        IF(name STREQUAL ${target})
-        SET(var ${var} -DNOGDI)
-        ENDIF(name STREQUAL ${target})
-        ENDFOREACH(target ${targets})
-        ENDIF(WINDOWS)
-        ''')
-        # --
-        if self.module in ["medfile", "yacs"]:
-            newlines.append(r'''
-            IF(WINDOWS)
-            SET(var ${var} -DNOGDI)
-            ENDIF(WINDOWS)
-            ''')
-            pass
-        # --
-        newlines.append(r'''
-        IF(WINDOWS)
-        SET(targets)
-        SET(targets ${targets} MEFISTO2D)
-        FOREACH(target ${targets})
-        IF(name STREQUAL ${target})
-        SET(dir $ENV{F2CHOME})
-        STRING(REPLACE "\\\\" "/" dir ${dir})
-        SET(var ${var} -I${dir})
-        SET(var ${var} -DF2C_BUILD)
-        ENDIF(name STREQUAL ${target})
-        ENDFOREACH(target ${targets})
-        ENDIF(WINDOWS)
-        ''')
-        # --
-        if self.module in ["geom", "med"]:
-            newlines.append(r'''
-            SET(var ${var} -I${CMAKE_CURRENT_SOURCE_DIR})
-            SET(var ${var} -I${CMAKE_CURRENT_BINARY_DIR})
-            ''')
-            pass
-        newlines.append(r'''
-        SET(var ${var} ${AM_CPPFLAGS})
-        SET(var ${var} ${AM_CXXFLAGS})
-        ''')
-        # --
-        newlines.append(r'''
-        IF(type STREQUAL STATIC)
-        SET(var ${var} -fPIC)
-        ENDIF(type STREQUAL STATIC)
-        ''')
-        # --
-        if self.module == "yacs":
-            newlines.append(r'''
-            SET(var ${var} -DYACS_PTHREAD)
-            SET(var ${var} -DCMAKE_BUILD)
-            SET(var ${var} -DSALOME_KERNEL)
-            SET(var ${var} -DDSC_PORTS)
-            SET(var ${var} -DOMNIORB)
-            ''')
-            pass
-        newlines.append(r'''
-  SET(var ${var} ${PLATFORM_CPPFLAGS})
-  SET(var ${var} ${PTHREAD_CFLAGS})
-  SET(var ${var} ${${amname}_CPPFLAGS})
-  SET(var ${var} ${${amname}_CXXFLAGS})
-  SET(var ${var} ${${amname}_CFLAGS})
-        SET(vars)
-        IF(WINDOWS)
-        SET(vars ${vars} -include SALOMEconfig.h)
-        SET(vars ${vars} -ftemplate-depth-32)
-        SET(vars ${vars} -fPIC)
-        SET(vars ${vars} -g)
-        ENDIF(WINDOWS)
-        SET(flags)
-        FOREACH(f ${var})
-        FOREACH(v ${vars})
-        IF(f STREQUAL v)
-        SET(f)
-        ENDIF(f STREQUAL v)
-        ENDFOREACH(v ${vars})
-        IF(f)
-        string(REGEX MATCH "^-I" test_include ${f})
-        if(test_include)
-        string(REGEX REPLACE "^-I" "" include_dir ${f})
-        if(include_dir)
-        if(include_dir STREQUAL /usr/include)
-        else(include_dir STREQUAL /usr/include)
-        string(REGEX MATCH "^\\." test_dot ${include_dir})
-        if(test_dot)
-        set(include_dir ${CMAKE_CURRENT_BINARY_DIR}/${include_dir})
-        endif(test_dot)
-        include_directories(${include_dir})
-        endif(include_dir STREQUAL /usr/include)
-        endif(include_dir)
-        else(test_include)
-        SET(flags "${flags} ${f}")
-        endif(test_include)
-        ENDIF(f)
-        ENDFOREACH(f ${var})
-        SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "${flags}")
-        ''')
-        return
-    
-    def addLibTarget(self, key, newlines):
-        newlines.append(r'''
-        FOREACH(amname ${%s})
-        '''%(key))
-        # --
-        # Replace .la by _la ...
-        # --
-        newlines.append(r'''
-        STRING(REPLACE .la _la amname ${amname})
-        ''')
-        # --
-        # Remove the _la for the cmake name
-        # --
-        newlines.append(r'''
-        STRING(LENGTH ${amname} len)
-        MATH(EXPR newlen "${len}-3")
-        STRING(SUBSTRING ${amname} 0 ${newlen} name)
-        ''')
-        # --
-        # Does the target begins with lib ??
-        # If yes, remove lib at beginning for cmake name
-        # --
-        newlines.append(r'''
-        STRING(REGEX MATCH "^lib" BEGIN_WITH_lib ${name})
-        IF(BEGIN_WITH_lib)
-        STRING(LENGTH ${name} len)
-        MATH(EXPR newlen "${len}-3")
-        STRING(SUBSTRING ${name} 3 ${newlen} name)
-        ENDIF(BEGIN_WITH_lib)
-        ''')
-        # --
-        # Does the target is an idl library
-        # --
-        newlines.append(r'''
-        STRING(REGEX MATCH "IDL" ISIDL ${name})
-        ''')
-        # --
-        # Set the type of the library
-        # --
-        newlines.append(r'''
-        IF(ISIDL)
-        IF(WINDOWS)
-        SET(type STATIC)
-        ELSE(WINDOWS)
-        SET(type SHARED)
-        ENDIF(WINDOWS)
-        ELSE(ISIDL)
-        SET(type SHARED)
-        ENDIF(ISIDL)
-        ''')
-        if key == "noinst_LTLIBRARIES":
-            newlines.append(r'''
-            IF(WINDOWS)
-            SET(type STATIC)
-            ELSE(WINDOWS)
-            SET(type STATIC)
-            ENDIF(WINDOWS)
-            ''')
-            pass
-        # --
-        # Set sources for the library
-        # --
-        newlines.append(r'''
-        SET(srcs)
-        FOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES})
-        GET_FILENAME_COMPONENT(ext ${src} EXT)
-        IF(ext STREQUAL .f)
-        IF(src STREQUAL trte.f)
-        SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${src})
-        STRING(REPLACE ".f" ".c" src ${src})
-        SET(src ${CMAKE_CURRENT_BINARY_DIR}/${src})
-        SET(output ${src})
-        SET(cmd f2c)
-        IF(NOT WINDOWS)
-        IF(CMAKE_SIZEOF_VOID_P STREQUAL 8)
-        SET(cmd valgrind f2c)  # f2c seems to be buggy on 64 bits ... but with valgrind, it works :)
-        ENDIF()
-        ENDIF(NOT WINDOWS)
-        ADD_CUSTOM_COMMAND(
-        OUTPUT ${output}
-        COMMAND ${cmd} ${input}
-        MAIN_DEPENDENCY ${input}
-        )
-        ELSE(src STREQUAL trte.f)
-        SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${src})
-        STRING(REPLACE ".f" ".o" src ${src})
-        SET(src ${CMAKE_CURRENT_BINARY_DIR}/${src})
-        SET(output ${src})
-        IF(WINDOWS)
-        SET(F77 g77)
-        ELSE(WINDOWS)
-        SET(F77 gfortran)
-        ENDIF(WINDOWS)
-        ADD_CUSTOM_COMMAND(
-        OUTPUT ${output}
-        COMMAND ${F77} -c -o ${output} ${input}
-        MAIN_DEPENDENCY ${input}
-        )
-        ENDIF(src STREQUAL trte.f)
-        ENDIF(ext STREQUAL .f)
-        SET(srcs ${srcs} ${src})
-        ENDFOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES})
-        ''')
-        newlines.append(r'''
-        SET(l ${nodist_${amname}_SOURCES} ${UIC_FILES})
-        FOREACH(f ${l})
-        SET(src ${CMAKE_CURRENT_BINARY_DIR}/${f})
-        SET(srcs ${srcs} ${src})
-        ENDFOREACH(f ${l})
-        ''')
-        newlines.append(r'''
-        SET(build_srcs)
-        SET(l ${nodist_${amname}_SOURCES} ${BUILT_SOURCES})
-        FOREACH(f ${l})
-        GET_FILENAME_COMPONENT(ext ${f} EXT)
-        IF(ext STREQUAL .py)
-        SET(fff)
-        ELSE(ext STREQUAL .py)
-        SET(fff ${CMAKE_CURRENT_BINARY_DIR}/${f})
-        ENDIF(ext STREQUAL .py)
-        IF(fff)
-        IF(build_srcs)
-        LIST(FIND build_srcs ${fff} index)
-        IF(NOT index EQUAL -1)
-        SET(fff)
-        ENDIF(NOT index EQUAL -1)
-        ENDIF(build_srcs)
-        ENDIF(fff)
-        IF(fff)
-        SET(build_srcs ${build_srcs} ${fff})
-        ENDIF(fff)
-        ENDFOREACH(f ${l})
-        ''')
-        # --
-        # Add the library to cmake
-        # --
-        newlines.append(r'''
-        ADD_LIBRARY(${name} ${type} ${srcs})
-        ''')
-        # --
-        # The compilation flags
-        # --
-        self.setCompilationFlags(key, newlines)
-        # --
-        newlines.append(r'''
-        SET_TARGET_PROPERTIES(${name} PROPERTIES VERSION ${VERSION_INFO} SOVERSION ${SOVERSION_INFO})
-        ''')
-        # --
-        self.setLibAdd(key, newlines)
-        # --
-        if 1: # key != "noinst_LTLIBRARIES":
-            newlines.append(r'''
-            SET(key %s)
-            '''%(key))
-            newlines.append(r'''
-            SET(test ON)
-            IF(${key} STREQUAL noinst_LTLIBRARIES)
-            SET(test OFF)
-            ENDIF(${key} STREQUAL noinst_LTLIBRARIES)
-            ''')
-            if self.module == "netgen" :
-                newlines.append(r'''
-                IF(${key} STREQUAL noinst_LTLIBRARIES)
-                IF(WINDOWS)
-                SET(test ON)
-                ENDIF(WINDOWS)
-                ENDIF(${key} STREQUAL noinst_LTLIBRARIES)
-                ''')
-                pass
-            newlines.append(r'''
-            IF(test)
-            ''')
-            if self.module in ["medfile", "netgen"]:
-                newlines.append(r'''
-                SET(DEST lib)
-                ''')
-            elif key == "libparaview_LTLIBRARIES":
-                newlines.append(r'''
-                SET(DEST lib/paraview)
-                ''')                
-            else:
-                newlines.append(r'''
-                SET(DEST lib/salome)
-                ''')
-                pass
-            newlines.append(r'''
-            IF(BEGIN_WITH_lib)
-            INSTALL(TARGETS ${name} DESTINATION ${DEST})
-            ''')
-            if self.module == "gui":
-                newlines.append(r'''
-                FOREACH(lib SalomePyQt)
-                IF(name STREQUAL lib)
-                IF(WINDOWS)
-                IF(CMAKE_BUILD_TYPE STREQUAL Release)
-                INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME ${name}.pyd)
-                ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
-                INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME ${name}_d.pyd)
-                ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
-                ELSE(WINDOWS)
-                INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so DESTINATION ${DEST} RENAME ${name}.so)
-                ENDIF(WINDOWS)
-                ENDIF(name STREQUAL lib)
-                ENDFOREACH(lib SalomePyQt)
-                FOREACH(lib SalomePy)
-                IF(name STREQUAL lib)
-                IF(WINDOWS)
-                IF(CMAKE_BUILD_TYPE STREQUAL Release)
-                INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.pyd)
-                ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
-                INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}_d.pyd)
-                ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
-                ENDIF(WINDOWS)
-                ENDIF(name STREQUAL lib)
-                ENDFOREACH(lib SalomePy)
-                ''')
-                pass
-            if self.module == "geom":
-                newlines.append(r'''
-                IF(WINDOWS)
-                STRING(REGEX MATCH "Export" ISExport ${name})
-                IF(ISExport)
-                INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.dll)
-                ENDIF(ISExport)
-                STRING(REGEX MATCH "Import" ISImport ${name})
-                IF(ISImport)
-                INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.dll)
-                ENDIF(ISImport)
-                ENDIF(WINDOWS)
-                ''')
-                pass
-            newlines.append(r'''
-            ELSE(BEGIN_WITH_lib)
-            ''')
-            newlines.append(r'''
-            IF(WINDOWS)
-            INSTALL(TARGETS ${name} DESTINATION ${salomepythondir})
-            IF(CMAKE_BUILD_TYPE STREQUAL Release)
-            INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${salomepythondir}/${name}.dll DESTINATION ${salomepythondir} RENAME ${name}.pyd)
-            ELSE(CMAKE_BUILD_TYPE STREQUAL Release)
-            INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${salomepythondir}/${name}.dll DESTINATION ${salomepythondir} RENAME ${name}_d.pyd)
-            ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
-            ELSE(WINDOWS)
-            GET_TARGET_PROPERTY(version ${name} VERSION)
-            GET_TARGET_PROPERTY(soversion ${name} SOVERSION)
-            INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so.${version})
-            INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so.${soversion})
-            INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so)
-            ENDIF(WINDOWS)
-            ''')
-            newlines.append(r'''
-            ENDIF(BEGIN_WITH_lib)
-            ''')
-            newlines.append(r'''
-            ENDIF(test)
-            ''')
-            pass
-        # --
-        newlines.append(r'''
-        ENDFOREACH(amname ${%s})
-        '''%(key))
-        # --
-        return
-    
-    def addBinTarget(self, key, newlines):
-        # --
-        newlines.append(r'''
-        FOREACH(amname ${%s})
-        '''%(key))
-        # --
-        newlines.append(r'''
-        SET(test ON)
-        ''')
-        if key == "check_PROGRAMS":
-            newlines.append(r'''
-            IF(bin_PROGRAMS)
-            STRING(REGEX MATCH ${amname} is_present ${bin_PROGRAMS})
-            IF(is_present)
-            SET(test OFF)
-            ENDIF(is_present)
-            ENDIF(bin_PROGRAMS)
-            ''')
-            pass
-        newlines.append(r'''
-        IF(test)
-        ''')
-        # --
-        newlines.append(r'''
-        SET(name "${amname}_exe")
-        SET(srcs ${${amname}_SOURCES} ${dist_${amname}_SOURCES})
-        SET(l ${nodist_${amname}_SOURCES})
-        FOREACH(f ${l})
-        SET(src ${CMAKE_CURRENT_BINARY_DIR}/${f})
-        SET(srcs ${srcs} ${src})
-        ENDFOREACH(f ${l})
-        LIST(LENGTH srcs nb)
-        IF(nb)
-        ADD_EXECUTABLE(${name} ${srcs})
-        ''')
-        # --
-        self.setCompilationFlags(key, newlines)
-        # --
-        self.setLibAdd(key, newlines)
-        # --
-        if self.module in ["jobmanager", "medfile", "netgen"]:
-            newlines.append(r'''
-            SET(DEST bin)
-            ''')
-        else:
-            newlines.append(r'''
-            SET(DEST bin/salome)
-            ''')
-            pass
-        # --
-        if key == "bin_PROGRAMS":
-            newlines.append(r'''
-            IF(WINDOWS)
-            INSTALL(TARGETS ${name} DESTINATION ${DEST})
-            INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe DESTINATION ${DEST} RENAME ${amname}.exe)
-            INSTALL(CODE "FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe)")
-            ELSE(WINDOWS)
-            SET(PERMS)
-            SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)
-            SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)
-            SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)
-            INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name} DESTINATION ${DEST} PERMISSIONS ${PERMS} RENAME ${amname})
-            ENDIF(WINDOWS)
-            ''')
-            pass
-        # --
-        newlines.append(r'''
-        ENDIF(nb)
-        ''')
-        # --
-        newlines.append(r'''
-        ENDIF(test)
-        ''')
-        newlines.append(r'''
-        ENDFOREACH(amname ${%s})
-        '''%(key))
-        # --
-        return
-    
-    def addInstallTarget(self, key, destination, newlines):
-        newlines.append(r"FOREACH(f ${%s})"%(key))
-        newlines.append(r'''
-        SET(DEST %s)
-        '''%(destination))
-        newlines.append(r'''
-        STRING(COMPARE EQUAL ${f} SALOMEconfig.h.in test_SALOMEconfig.h.in)
-        IF(test_SALOMEconfig.h.in)
-        INSTALL(FILES SALOMEconfig.ref.in DESTINATION ${DEST} RENAME SALOMEconfig.h.in)
-        ELSE(test_SALOMEconfig.h.in)
-        SET(dummy dummy-NOTFOUND)
-        MARK_AS_ADVANCED(dummy)
-        # FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${f})
-        FIND_FILE(dummy ${f} PATHS ${CMAKE_CURRENT_SOURCE_DIR} NO_DEFAULT_PATH)
-        IF(dummy)
-        ''')
-        if key in ['dist_salomescript_SCRIPTS',
-                   'dist_appliskel_SCRIPTS',
-                   'dist_appliskel_PYTHON']:
-            newlines.append(r'''
-            SET(PERMS)
-            SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)
-            SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)
-            SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)
-            INSTALL(FILES ${f} DESTINATION ${DEST} PERMISSIONS ${PERMS})
-            ''')
-        else:
-            newlines.append(r'''
-            GET_FILENAME_COMPONENT(ext ${f} EXT)
-            IF(ext STREQUAL .py)
-            IF(DEST STREQUAL bin/salome)
-            SET(PERMS)
-            SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)
-            SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)
-            SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)
-            INSTALL(FILES ${f} DESTINATION ${DEST} PERMISSIONS ${PERMS})
-            ELSE(DEST STREQUAL bin/salome)
-            INSTALL(FILES ${f} DESTINATION ${DEST})
-            ENDIF(DEST STREQUAL bin/salome)
-            ELSE(ext STREQUAL .py)
-            INSTALL(FILES ${f} DESTINATION ${DEST})
-            ENDIF(ext STREQUAL .py)
-            ''')
-            pass
-        newlines.append(r'''
-        ELSE(dummy)
-        GET_FILENAME_COMPONENT(ext ${f} EXT)
-        IF(ext STREQUAL .qm)
-        STRING(REGEX REPLACE .qm .ts input ${f})
-        ''')
-        if self.module in ["kernel", "gui", "yacs"]:
-            newlines.append(r'''
-            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/resources/${input})
-            ''')
-        else:
-            newlines.append(r'''
-            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})
-            ''')
-            pass
-        newlines.append(r'''
-        SET(output ${CMAKE_CURRENT_BINARY_DIR}/${f})
-        # ADD_CUSTOM_COMMAND(
-        # OUTPUT ${output}
-        # COMMAND ${QT_LRELEASE_EXECUTABLE} ${input} -qm ${output}
-        # MAIN_DEPENDENCY ${input}
-        # )
-        EXECUTE_PROCESS(COMMAND ${QT_LRELEASE_EXECUTABLE} ${input} -qm ${output})
-        ENDIF(ext STREQUAL .qm)
-        INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${f} DESTINATION ${DEST})
-        ENDIF(dummy)
-        ENDIF(test_SALOMEconfig.h.in)
-        ''')
-        newlines.append(r'''
-        GET_FILENAME_COMPONENT(ext ${f} EXT)
-        IF(ext STREQUAL .py)
-        INSTALL(CODE "SET(PYTHON_FILE ${f})")
-        INSTALL(CODE "SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})")
-        INSTALL(CODE "SET(DEST ${DEST})")
-        INSTALL(CODE "SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})")
-        ''')
-        if self.module == "kernel":
-            newlines.append('''
-            IF(f STREQUAL SALOME_ContainerPy.py)
-            ELSE(f STREQUAL SALOME_ContainerPy.py)
-            IF(f STREQUAL am2cmake.py)
-            ELSE(f STREQUAL am2cmake.py)
-            INSTALL(SCRIPT ${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/install_and_compile_python_file.cmake)
-            ENDIF(f STREQUAL am2cmake.py)
-            ENDIF(f STREQUAL SALOME_ContainerPy.py)
-            ''')
-        else:
-            newlines.append('''
-            STRING(REPLACE "\\\\" "/" KERNEL_ROOT_DIR ${KERNEL_ROOT_DIR})
-            INSTALL(SCRIPT ${KERNEL_ROOT_DIR}/salome_adm/cmake_files/install_and_compile_python_file.cmake)
-            ''')
-            pass
-        newlines.append(r'''
-        ENDIF(ext STREQUAL .py)
-        ''') 
-        newlines.append(r"ENDFOREACH(f ${%s})"%(key))
-        return
-    
-    def writeListsFile(self):
-        f = open(self.listsFile, "w")
-        f.write(self.content)
-        f.close()
-        return
-
-    def writeEnvScript(self, upmod):
-        from sys import platform, version_info
-        p_version = """%s.%s"""%(version_info[0],version_info[1])
-        python_path ="PYTHONPATH"
-        path = ""
-        begin = ""
-        end = ""
-        delim = ""
-        cmd = ""
-        pdir = ""
-        omni = ""
-       omni_py = ""
-        if platform == "win32" :               
-            path = "PATH"
-            begin = "%"
-            end = "%"
-            delim = ";"
-            cmd = "@SET "
-            omni = "/x86_win32"
-            omni_py = "/python"
-            pdir = "PDIR"
-        else:
-            path = "LD_LIBRARY_PATH"
-            begin = "\${"
-            end = "}"
-            delim = ":"
-            cmd = "export "
-            omni_py = "/python" + p_version + "/" + "site-packages"
-            pdir = "INST_ROOT"
-
-            
-        path_ = begin + path + end
-        root_dir_ = begin + upmod + "_ROOT_DIR" + end  
-        python_path_ = begin + python_path + end
-        _python_path_ = delim + python_path_+ "\n"
-        _path_ = delim + path_+ "\n" 
-        _pdir = begin + pdir + end 
-           
-        
-        script = cmd + " " + python_path + "=" + root_dir_+"/lib/python" + p_version \
-        + "/site-packages/salome" + _python_path_ 
-        
-        script = script + cmd + " " + python_path + "=" + root_dir_+"/bin/salome" + \
-        _python_path_
-
-        script = script + cmd + " "+ path + "=" + root_dir_+"/lib/salome"+ _path_
-
-       if upmod == "KERNEL" :
-            script = script + cmd + " " +  python_path + "=" + _pdir + \
-            "/omniORB-4.1.5/lib" + omni + _python_path_
-        
-            script = script + cmd + " " + python_path + "=" + _pdir + \
-            "/omniORB-4.1.5/lib" + omni_py + _python_path_
-        
-            script = script + cmd + " "+ path + "=" + _pdir+ "/omniORB-4.1.5/lib" + \
-            omni + _path_
-
-        if upmod == "GEOM" :
-            script = self.writeEnvScript("KERNEL") + script
-            script = self.writeEnvScript("GUI") + script
-
-        if upmod == "SMESH" :
-            script = self.writeEnvScript("GEOM") + script
-
-        return script    
-    pass
-
-def convertAmFile(the_root, root, dirs, files, f, module):
-    cmake = CMakeFile(the_root, root, dirs, files, f, module)
-    cmake.writeListsFile()
-    return
-
-def usage(exit_status):
-    from sys import exit
-    from sys import argv
-    print "Usage: %s --module"%(argv[0])
-    exit(exit_status)
-    return
-
-if __name__ == "__main__":
-    #
-    from sys import argv
-    if len(argv) != 2:
-        usage(1)
-        pass
-    #
-    module = argv[1]
-    if module.find('--') != 0:
-        usage(1)
-        pass
-    module = module[2:]
-    if len(module) == 0:
-        usage(1)
-        pass
-    #
-    from os import getcwd
-    the_root = getcwd()
-    #
-    nok = 0
-    #
-    from os import getenv
-    from os import walk
-    for root, dirs, files in walk(the_root):
-        # --
-        # E.A. : Remove 'CVS' in dirs
-        # E.A. : It allows to not recurse in CVS dirs
-        # E.A. : See os module python documentation
-        # --
-        try:
-            dirs.remove('CVS')
-        except ValueError:
-            pass
-        # --
-        if "Makefile.am.cmake" in files:
-            if "Makefile.am" in files:
-                files.remove("Makefile.am")
-                pass
-            pass
-        # --
-        for f in files:
-            if f in ["Makefile.am", "Makefile.am.cmake"]:
-                convert = True
-                if getenv("AM2CMAKE_FORCE_GENERATION", "0")=="0":
-                    # detect if conversion should be done
-                    if "CMakeLists.txt" in files:
-                        from os.path import join
-                        ff = open(join(root, "CMakeLists.txt"))
-                        content = ff.read()
-                        ff.close()
-                        if content.find("generated by am2cmake") == -1:
-                            convert = False
-                            pass
-                        pass                       
-                    pass
-                if convert:
-                    convertAmFile(the_root, root, dirs, files, f, module)
-                    nok += 1
-                pass
-            pass
-        pass
-    #
-    from sys import stdout
-    if nok:
-        if nok == 1:
-            msg = "%s file has been converted to cmake"%(nok)
-        else:
-            msg = "%s files have been converted to cmake"%(nok)
-            pass
-        stdout.write(msg)
-        stdout.write("\n")
-        stdout.flush()
-        pass
-    pass
+#  -*- coding: iso-8859-1 -*-\r
+# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE\r
+#\r
+# This library is free software; you can redistribute it and/or\r
+# modify it under the terms of the GNU Lesser General Public\r
+# License as published by the Free Software Foundation; either\r
+# version 2.1 of the License.\r
+#\r
+# This library is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+# Lesser General Public License for more details.\r
+#\r
+# You should have received a copy of the GNU Lesser General Public\r
+# License along with this library; if not, write to the Free Software\r
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA\r
+#\r
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com\r
+#\r
+\r
+import re\r
+\r
+# ----\r
+# A set of regular expressions used ...\r
+# ----\r
+\r
+p_multiline = re.compile(r"""\r
+\\           # One backslash\r
+\s*          # 0 or more space\r
+\n           # One CR\r
+""", re.VERBOSE)\r
+\r
+p_dollar = re.compile(r"""\r
+\$\(           # a $ then a (\r
+(?P<val>       # open the group val\r
+[^)]*          # the group contain 0 or more non ) characters\r
+)              # close the group\r
+\)             # a ) at the end\r
+""", re.VERBOSE)\r
+\r
+p_arobas = re.compile(r"""\r
+@              # a @\r
+(?P<val>       # open the group val\r
+[^@]*            # the group contain 0 or more non @ characters\r
+)              # close the group\r
+@              # a @ at the end\r
+""", re.VERBOSE)\r
+\r
+p_if = re.compile(r"""\r
+^          # beginning of the string\r
+\s*        # 0 or more space\r
+if         # an if\r
+\s+        # 1 or more space\r
+(?P<val>   # open the group val\r
+.+         # the group contain 1 or more non space characters\r
+)          # close the group\r
+""", re.VERBOSE)\r
+\r
+p_else = re.compile(r"""\r
+^          # beginning of the line\r
+\s*        # 0 or more space\r
+else       #\r
+\s*        # 0 or more space\r
+""", re.VERBOSE)\r
+\r
+p_endif = re.compile(r"""\r
+^          # beginning of the line\r
+\s*        # 0 or more space\r
+endif      # a endif\r
+\s*        # 0 or more space\r
+""", re.VERBOSE)\r
+\r
+p_attribution = re.compile(r"""\r
+^              # beginning of the line\r
+(?P<spaces>    # open the group spaces\r
+\s*            # 0 or more space\r
+)              # close the group\r
+(?P<key>       # open the group key\r
+\w+            # the group contain 1 or more alphanumeric characters\r
+)              # close the group\r
+\s*            # 0 or more space\r
+(?P<method>    # open the group method\r
+\+?            # 0 or 1 +\r
+=              # One =\r
+)              # close the group\r
+(?P<value>     # open the group value\r
+.*             # 0 or more any characters \r
+)              # close the group\r
+""", re.VERBOSE)\r
+\r
+# -----\r
+\r
+class CMakeFile(object):\r
+    \r
+    def __init__(self, the_root, root, dirs, files, f, module):\r
+        #\r
+        self.the_root = the_root\r
+        self.root = root\r
+        self.dirs = dirs\r
+        self.files = files\r
+        self.module = module\r
+        #\r
+        from os.path import join\r
+        self.amFile = join(root, f)\r
+        self.listsFile = join(root, "CMakeLists.txt")\r
+        #\r
+        self.parseFile()\r
+        #\r
+        return\r
+    \r
+    def parseFile(self):\r
+        \r
+        # --\r
+        # Read the Makefile.am file\r
+        # --\r
+        amFile = self.amFile\r
+        stream = open(amFile)\r
+        content = stream.read()\r
+        stream.close()\r
+        \r
+        # --\r
+        # Replace the composed lines separated by "\\n" by an unique line\r
+        # --\r
+        content = p_multiline.sub(r' ', content)\r
+        \r
+        # --\r
+        # Compatibility netgen plugin\r
+        # --\r
+        content = content.replace("../NETGEN/libNETGEN.la", "${NETGEN_LIBS}")\r
+        \r
+        # --\r
+        cas_list = [\r
+            "BinLPlugin",\r
+            "BinPlugin",\r
+            "BinTObjPlugin",\r
+            "BinXCAFPlugin",\r
+            "FWOSPlugin",\r
+            "PTKernel",\r
+            "StdLPlugin",\r
+            "StdPlugin",\r
+            "TKAdvTools",\r
+            "TKBin",\r
+            "TKBinL",\r
+            "TKBinTObj",\r
+            "TKBinXCAF",\r
+            "TKBO",\r
+            "TKBool",\r
+            "TKBRep",\r
+            "TKCAF",\r
+            "TKCDF",\r
+            "TKernel",\r
+            "TKFeat",\r
+            "TKFillet",\r
+            "TKG2d",\r
+            "TKG3d",\r
+            "TKGeomAlgo",\r
+            "TKGeomBase",\r
+            "TKHLR",\r
+            "TKIGES",\r
+            "TKLCAF",\r
+            "TKMath",\r
+            "TKMesh",\r
+            "TKMeshVS",\r
+            "TKNIS",\r
+            "TKOffset",\r
+            "TKOpenGl",\r
+            "TKPCAF",\r
+            "TKPLCAF",\r
+            "TKPrim",\r
+            "TKPShape",\r
+            "TKService",\r
+            "TKShapeSchema",\r
+            "TKShHealing",\r
+            "TKStdLSchema",\r
+            "TKStdSchema",\r
+            "TKSTEP",\r
+            "TKSTEP209",\r
+            "TKSTEPAttr",\r
+            "TKSTEPBase",\r
+            "TKSTL",\r
+            "TKTObj",\r
+            "TKTopAlgo",\r
+            "TKV2d",\r
+            "TKV3d",\r
+            "TKVRML",\r
+            "TKXCAF",\r
+            "TKXCAFSchema",\r
+            "TKXDEIGES",\r
+            "TKXDESTEP",\r
+            "TKXMesh",\r
+            "TKXml",\r
+            "TKXmlL",\r
+            "TKXmlTObj",\r
+            "TKXmlXCAF",\r
+            "TKXSBase",\r
+            "XCAFPlugin",\r
+            "XmlLPlugin",\r
+            "XmlPlugin",\r
+            "XmlTObjPlugin",\r
+            "XmlXCAFPlugin",\r
+            ]\r
+        vtk_list = [\r
+            "vtkCommonPythonD",\r
+            "vtkGraphicsPythonD",\r
+            "vtkImagingPythonD",\r
+            "vtkPythonCore",\r
+            ]\r
+        kernel_list  = [\r
+            "CalciumC",\r
+            "DF",\r
+            "Launcher",\r
+            "LifeCycleCORBATest",\r
+            "NamingServiceTest",\r
+            "OpUtil",\r
+            "Registry",\r
+            "ResourcesManager",\r
+            "SALOMEBasics",\r
+            "SalomeCatalog",\r
+            "SalomeCommunication",\r
+            "SalomeContainer",\r
+            "SalomeDatastream",\r
+            "SalomeDSCContainer",\r
+            "SalomeDSClient",\r
+            "SalomeDSCSupervBasic",\r
+            "SalomeDSCSuperv",\r
+            "SalomeDSImpl",\r
+            "SALOMEDSImplTest",\r
+            "SalomeDS",\r
+            "SALOMEDSTest",\r
+            "SalomeGenericObj",\r
+            "SalomeHDFPersist",\r
+            "SalomeIDLKernel",\r
+            "SalomeLauncher",\r
+            "SalomeLifeCycleCORBA",\r
+            "SALOMELocalTrace",\r
+            "SALOMELocalTraceTest",\r
+            "SalomeLoggerServer",\r
+            "SalomeMPIContainer",\r
+            "SalomeNotification",\r
+            "SalomeNS",\r
+            "SalomeResourcesManager",\r
+            "SalomeTestComponentEngine",\r
+            "SalomeTestMPIComponentEngine",\r
+            "SALOMETraceCollectorTest",\r
+            "TOOLSDS",\r
+            "UtilsTest",\r
+            "with_loggerTraceCollector",\r
+            "SalomeKernelHelpers",\r
+            ]\r
+        gui_list = [\r
+            "caf",\r
+            "CAM",\r
+            "CASCatch",\r
+            "DDS",\r
+            "Event",\r
+            "GLViewer",\r
+            "LightApp",\r
+            "LogWindow",\r
+            "ObjBrowser",\r
+            "OCCViewer",\r
+            "OpenGLUtils",\r
+            "Plot2d",\r
+            "PyConsole",\r
+            "PyInterp",\r
+            "QDS",\r
+            "qtx",\r
+            "QxScene",\r
+            "SalomeApp",\r
+            "SalomeAppTest",\r
+            "SalomeIDLGUI",\r
+            "SalomeObject",\r
+            "SalomePrs",\r
+            "SalomePyQtGUILight",\r
+            "SalomePyQtGUI",\r
+            "SalomePyQt",\r
+            "SalomePy",\r
+            "SalomeSession",\r
+            "SalomeStyle",\r
+            "SOCC",\r
+            "SPlot2d",\r
+            "std",\r
+            "SUITApp",\r
+            "suit",\r
+            "SUPERVGraph",\r
+            "SVTK",\r
+            "ToolsGUI",\r
+            "ViewerTools",\r
+            "VTKViewer",\r
+            "vtkEDFOverloads",\r
+            "vtkTools"\r
+            ]\r
+        geom_list = [\r
+            "AdvancedGUI",\r
+            "BasicGUI",\r
+            "BlocksGUI",\r
+            "BooleanGUI",\r
+            "BREPExport",\r
+            "BREPImport",\r
+            "BuildGUI",\r
+            "DisplayGUI",\r
+            "DlgRef",\r
+            "EntityGUI",\r
+            "GenerationGUI",\r
+            "GEOMAlgo",\r
+            "GEOMAlgo_NEW",\r
+            "GEOMArchimede",\r
+            "GEOMBase",\r
+            "GEOMbasic",\r
+            "GEOMClient",\r
+            "GEOMEngine",\r
+            "GEOMFiltersSelection",\r
+            "GEOMimpl",\r
+            "GEOMObject",\r
+            "GEOMSketcher",\r
+            "GEOM",\r
+            "GEOM_SupervEngine",\r
+            "GEOMToolsGUI",\r
+            "GroupGUI",\r
+            "IGESExport",\r
+            "IGESImport",\r
+            "MeasureGUI",\r
+           "Material",\r
+            "NMTDS",\r
+            "NMTDS_NEW",\r
+            "NMTTools",\r
+            "NMTTools_NEW",\r
+            "OCC2VTK",\r
+            "OperationGUI",\r
+            "PrimitiveGUI",\r
+            "RepairGUI",\r
+            "SalomeIDLGEOM",\r
+            "ShHealOper",\r
+            "STEPExport",\r
+            "STEPImport",\r
+            "STLExport",\r
+            "TransformationGUI",\r
+            "VTKExport",\r
+            ]\r
+        med_list = [\r
+            "interpkernel",\r
+            "InterpKernelTest",\r
+            "MEDClientcmodule",\r
+            "medcouplingclient",\r
+            "medcouplingcorba",\r
+            "medcouplingremapper",\r
+            "medcoupling",\r
+            "MEDEngine",\r
+            "medloader",\r
+            "MEDMEMCppTest",\r
+            "MEDMEMImpl",\r
+            "medmem",\r
+            "MED",\r
+            "medsplitter",\r
+            "MEDSPLITTERTest",\r
+            "med_V2_1",\r
+            "MEDWrapperBase",\r
+            "MEDWrapper",\r
+            "MEDWrapper_V2_1",\r
+            "MEDWrapper_V2_2",\r
+            "paramedcouplingcorba",\r
+            "paramedloader",\r
+            "paramedmemcompo",\r
+            "paramedmem",\r
+            "ParaMEDMEMTest",\r
+            "SalomeIDLMED",\r
+            "SalomeIDLMEDTests",\r
+            ]\r
+        smesh_list = [\r
+            "GeomSelectionTools",\r
+            "MEFISTO2D",\r
+            "MeshDriverDAT",\r
+            "MeshDriverMED",\r
+            "MeshDriver",\r
+            "MeshDriverSTL",\r
+            "MeshDriverUNV",\r
+            "SalomeIDLSMESH",\r
+            "SMDS",\r
+            "SMESHClient",\r
+            "SMESHControls",\r
+            "SMESHDS",\r
+            "SMESHEngine",\r
+            "SMESHFiltersSelection",\r
+            "SMESHimpl",\r
+            "SMESHObject",\r
+            "SMESH",\r
+            "SMESHUtils",\r
+            "StdMeshersEngine",\r
+            "StdMeshersGUI",\r
+            "StdMeshers",\r
+            ]\r
+        full_list  = cas_list + vtk_list\r
+        full_list += kernel_list + gui_list\r
+        full_list += geom_list + med_list + smesh_list\r
+        # --\r
+        # E.A. : sort by len before substitution ...\r
+        # Why ? Thing to "-lMEDWrapper" then "-lMEDWrapper_V2_1" substition\r
+        # And you understand ...\r
+        # --\r
+        full_list.sort(cmp = lambda x, y : cmp(len(y), len(x)))\r
+        # --\r
+        for key in full_list:\r
+            content = content.replace("-l%s"%(key), "${%s}"%(key))\r
+         \r
+            pass\r
+        \r
+        # --\r
+        # Split content in lines to treat each one separately\r
+        # --\r
+        lines = content.split('\n')\r
+        \r
+        # --\r
+        # newlines contains the lines of the future CMakeLists.txt file\r
+        # --\r
+        newlines = []\r
+        \r
+        # --\r
+        # opened_ifs is used to deals with nested conditionnals\r
+        # --\r
+        opened_ifs = []\r
+        \r
+        # --\r
+        # the __thedict__ dictionnary contains key, val\r
+        # of the Makefile.am file\r
+        # --\r
+        self.__thedict__ = {}\r
+        \r
+        # --\r
+        # Initialize file ... mainly includes other cmake files\r
+        # --\r
+        self.initialize(newlines)\r
+        \r
+        # --\r
+        # Do the job for each line\r
+        # --\r
+        for line in lines:\r
+            self.treatLine(line, newlines, opened_ifs)\r
+            pass\r
+        \r
+        # --\r
+        # Finalize file ... it is in here the cmake job is done\r
+        # --\r
+        self.finalize(newlines)\r
+        \r
+        # --\r
+        # Concatenate newlines into content\r
+        # --\r
+        content = '\n'.join(newlines)\r
+        \r
+        # --\r
+        # Add a CR at end if necessary\r
+        # --\r
+        lines = content.split('\n')\r
+        # lines = [ l.strip() for l in lines ]\r
+        if len(lines[-1]) != 0:\r
+            lines.append('')\r
+            pass\r
+        content = '\n'.join(lines)\r
+        \r
+        # --\r
+        self.content  = "# ---------------------------------------------------------------------\n"\r
+        self.content += "# This file was automatically generated by am2cmake (erwan.adam@cea.fr)\n"\r
+        self.content += "# ---------------------------------------------------------------------\n"\r
+        self.content += content\r
+        \r
+        # --\r
+        return\r
+    \r
+    def initialize(self, newlines):\r
+        if self.root == self.the_root:\r
+            # --\r
+            newlines.append("""\r
+            CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR)\r
+            IF(COMMAND cmake_policy)\r
+            cmake_policy(SET CMP0003 NEW)\r
+            ENDIF(COMMAND cmake_policy)\r
+            """)\r
+            # --\r
+            newlines.append("""\r
+            ENABLE_TESTING()\r
+            """)\r
+            # --\r
+            newlines.append("""\r
+            SET(MODULE %s)\r
+            """%(self.module.upper()))\r
+            # --\r
+            if self.module == "netgen":\r
+                newlines.append("""\r
+                INCLUDE(${CMAKE_SOURCE_DIR}/cmake/FindPLATFORM.cmake)\r
+                INCLUDE(${CMAKE_SOURCE_DIR}/cmake/FindCAS.cmake)\r
+                """)\r
+            else:\r
+                if self.module == "kernel":\r
+                    newlines.append("""\r
+                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)\r
+                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPYTHON.cmake)\r
+                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake)\r
+                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake)\r
+                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindMPI.cmake)\r
+                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindHDF5.cmake)\r
+                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindBOOST.cmake)\r
+                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake)\r
+                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSWIG.cmake)\r
+                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)\r
+                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake)\r
+                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake)\r
+                    INCLUDE(${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)\r
+                    """)\r
+                    pass\r
+                else:\r
+                    if self.module == "med":\r
+                        newlines.append("""\r
+                        SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR})\r
+                        IF(KERNEL_ROOT_DIR)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPYTHON.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindMPI.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindHDF5.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindBOOST.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake)\r
+                        ELSE(KERNEL_ROOT_DIR)\r
+                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindPLATFORM.cmake)\r
+                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindMPI.cmake)\r
+                        ENDIF(KERNEL_ROOT_DIR)\r
+                        """)\r
+                    else:\r
+                        newlines.append("""\r
+                        SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR})\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPYTHON.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindMPI.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindHDF5.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindBOOST.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake)\r
+                        INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake)\r
+                        """)\r
+                        pass\r
+                    if self.module == "gui":\r
+                        newlines.append("""\r
+                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindCAS.cmake)\r
+                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindQT4.cmake)\r
+                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindOPENGL.cmake)\r
+                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindVTK.cmake)\r
+                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindQWT.cmake)\r
+                        INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSIPPYQT.cmake)\r
+                        """)\r
+                    else:\r
+                        newlines.append("""\r
+                        SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR})\r
+                        IF(GUI_ROOT_DIR)\r
+                        INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindCAS.cmake)\r
+                        INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindQT4.cmake)\r
+                        INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindOPENGL.cmake)\r
+                        INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindVTK.cmake)\r
+                        INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindQWT.cmake)\r
+                        INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindSIPPYQT.cmake)\r
+                        INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindGUI.cmake)\r
+                        ENDIF(GUI_ROOT_DIR)\r
+                        """)\r
+                        if self.module == "med":\r
+                            #METIS must be after PARMETIS to prevent to activate METIS if PARMETIS already exists\r
+                            newlines.append("""\r
+                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindPARMETIS.cmake)\r
+                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindMETIS.cmake)\r
+                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSCOTCH.cmake)\r
+                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindSPLITTER.cmake)\r
+                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindRENUMBER.cmake)\r
+                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)\r
+                            IF(WINDOWS)\r
+                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindXDR.cmake)\r
+                            ENDIF(WINDOWS)\r
+                            """)\r
+                            pass\r
+                        if self.module == "smesh":\r
+                            newlines.append("""\r
+                            SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})\r
+                            SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})\r
+                            INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)\r
+                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)\r
+                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)\r
+                            INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)\r
+                            """)\r
+                            pass\r
+                        if self.module == "geom":\r
+                            newlines.append("""\r
+                            INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)\r
+                            """)\r
+                            pass\r
+\r
+                        if self.module == "netgenplugin":\r
+                            newlines.append("""\r
+                            SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})\r
+                            SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})\r
+                            SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})\r
+                            INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)\r
+                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)\r
+                            INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)\r
+                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindNETGEN.cmake)\r
+                            """)\r
+                            pass\r
+                        if self.module == "blsurfplugin":\r
+                            newlines.append("""\r
+                            SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})\r
+                            SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})\r
+                            SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})\r
+                            INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)\r
+                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)\r
+                            INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)\r
+                            INCLUDE(${CMAKE_SOURCE_DIR}/adm_local/cmake_files/FindBLSURF.cmake)\r
+                            """)\r
+                            pass\r
+                        if self.module in ["ghs3dplugin", "hexoticplugin"]:\r
+                            newlines.append("""\r
+                            SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})\r
+                            SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})\r
+                            SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})\r
+                            INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)\r
+                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)\r
+                            INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)\r
+                            """)\r
+                            pass\r
+                        if self.module == "ghs3dprlplugin":\r
+                            newlines.append("""\r
+                            SET(GEOM_ROOT_DIR $ENV{GEOM_ROOT_DIR})\r
+                            SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})\r
+                            SET(SMESH_ROOT_DIR $ENV{SMESH_ROOT_DIR})\r
+                            INCLUDE(${GEOM_ROOT_DIR}/adm_local/cmake_files/FindGEOM.cmake)\r
+                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)\r
+                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)\r
+                            INCLUDE(${SMESH_ROOT_DIR}/adm_local/cmake_files/FindSMESH.cmake)\r
+                            """)\r
+                            pass\r
+                        if self.module == "visu":\r
+                            newlines.append("""\r
+                            SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})\r
+                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)\r
+                            """)\r
+                            pass\r
+                        if self.module == "yacs":\r
+                            newlines.append("""\r
+                            INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindEXPAT.cmake)\r
+                            INCLUDE(${CMAKE_SOURCE_DIR}/adm/cmake/FindGRAPHVIZ.cmake)\r
+                            INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)\r
+                            """)\r
+                            pass\r
+                        if self.module == "hxx2salome":\r
+                            newlines.append("""\r
+                            SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR})\r
+                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMEDFILE.cmake)\r
+                            INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)\r
+                            """)\r
+                            pass\r
+                        if self.module == "ppgp":\r
+                            newlines.append("""\r
+                            INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)\r
+                            """)\r
+                            pass\r
+                        pass\r
+                    pass\r
+                pass\r
+            # --\r
+            newlines.append("""\r
+            SET(DOXYGEN_IS_OK 0)\r
+            """)\r
+            if self.module not in ['med']:\r
+                newlines.append("""\r
+                IF(WINDOWS)\r
+                SET(CPPUNIT_IS_OK 0)\r
+                ENDIF(WINDOWS)\r
+                """)\r
+                pass\r
+            # --\r
+            if self.module == "kernel":\r
+                newlines.append("""\r
+                SET(WITH_LOCAL 1)\r
+                SET(WITH_BATCH 1)\r
+                SET(CALCIUM_IDL_INT_F77 long)\r
+                SET(CALCIUM_CORBA_INT_F77 CORBA::Long)\r
+                SET(LONG_OR_INT int)\r
+                """)\r
+            elif self.module == "gui":\r
+                newlines.append("""\r
+                SET(GUI_ENABLE_CORBA ${CORBA_GEN})\r
+                SET(ENABLE_VTKVIEWER ON)\r
+                SET(ENABLE_SALOMEOBJECT ON)\r
+                SET(ENABLE_OCCVIEWER ON)\r
+                SET(ENABLE_GLVIEWER ON)\r
+                SET(ENABLE_PLOT2DVIEWER ON)\r
+                SET(ENABLE_PYCONSOLE ON)\r
+                SET(ENABLE_SUPERVGRAPHVIEWER ON)\r
+                SET(ENABLE_QXGRAPHVIEWER ON)\r
+                """)\r
+                pass\r
+            elif self.module == "jobmanager":\r
+                newlines.append("""\r
+                IF(GUI_ROOT_DIR)\r
+                SET(HAS_GUI ON)\r
+                ENDIF(GUI_ROOT_DIR)\r
+                """)\r
+                pass\r
+            elif self.module == "geom":\r
+                newlines.append("""\r
+                IF(GUI_ROOT_DIR)\r
+                SET(GEOM_ENABLE_GUI ON)\r
+                ENDIF(GUI_ROOT_DIR)\r
+                """)\r
+                pass\r
+            elif self.module == "medfile":\r
+                newlines.append("""\r
+                SET(MED_NUM_MAJEUR 3)\r
+                SET(MED_NUM_MINEUR 0)\r
+                SET(MED_NUM_RELEASE 3)\r
+                SET(LONG_OR_INT int)\r
+                IF(NOT WINDOWS)\r
+                SET(FLIBS -lgfortranbegin -lgfortran)\r
+                ENDIF(NOT WINDOWS)\r
+                """)\r
+                pass\r
+            elif self.module == "med":\r
+                newlines.append("""\r
+                IF(KERNEL_ROOT_DIR)\r
+                SET(MED_ENABLE_KERNEL ON)\r
+                IF(NOT WINDOWS)\r
+                SET(MED_ENABLE_SPLITTER ON)\r
+                ENDIF(NOT WINDOWS)\r
+                ENDIF(KERNEL_ROOT_DIR)\r
+                IF(GUI_ROOT_DIR)\r
+                SET(MED_ENABLE_GUI ON)\r
+                ENDIF(GUI_ROOT_DIR)\r
+                """)\r
+                pass\r
+            elif self.module == "smesh":\r
+                newlines.append("""\r
+                IF(GUI_ROOT_DIR)\r
+                SET(SMESH_ENABLE_GUI ON)\r
+                ENDIF(GUI_ROOT_DIR)\r
+                """)\r
+                pass\r
+            elif self.module == "netgen":\r
+                newlines.append("""\r
+                SET(OCCFLAGS ${CAS_CPPFLAGS})\r
+                SET(OCCLIBS ${CAS_LDPATH})\r
+                SET(OCCLIBS ${OCCLIBS} ${TKernel} ${TKGeomBase} ${TKMath} ${TKG2d} ${TKG3d} ${TKXSBase} ${TKOffset} ${TKFillet} ${TKShHealing})\r
+                SET(OCCLIBS ${OCCLIBS} ${TKMesh} ${TKMeshVS} ${TKTopAlgo} ${TKGeomAlgo} ${TKBool} ${TKPrim} ${TKBO} ${TKIGES} ${TKBRep})\r
+                SET(OCCLIBS ${OCCLIBS} ${TKSTEPBase} ${TKSTEP} ${TKSTL} ${TKSTEPAttr} ${TKSTEP209} ${TKXDESTEP} ${TKXDEIGES} ${TKXCAF} ${TKLCAF} ${FWOSPlugin})\r
+                """)\r
+                pass\r
+            elif self.module == "netgenplugin":\r
+                newlines.append("""\r
+                IF(GUI_ROOT_DIR)\r
+                SET(NETGENPLUGIN_ENABLE_GUI ON)\r
+                ENDIF(GUI_ROOT_DIR)\r
+                """)\r
+                pass\r
+            elif self.module == "blsurfplugin":\r
+                newlines.append("""\r
+                IF(GUI_ROOT_DIR)\r
+                SET(BLSURFPLUGIN_ENABLE_GUI ON)\r
+                ENDIF(GUI_ROOT_DIR)\r
+                """)\r
+                pass\r
+            elif self.module == "ghs3dplugin":\r
+                newlines.append("""\r
+                IF(GUI_ROOT_DIR)\r
+                SET(GHS3DPLUGIN_ENABLE_GUI ON)\r
+                ENDIF(GUI_ROOT_DIR)\r
+                """)\r
+                pass\r
+            elif self.module == "hexoticplugin":\r
+                newlines.append("""\r
+                IF(GUI_ROOT_DIR)\r
+                SET(HEXOTICPLUGIN_ENABLE_GUI ON)\r
+                ENDIF(GUI_ROOT_DIR)\r
+                """)\r
+                pass\r
+            elif self.module == "ghs3dprlplugin":\r
+                newlines.append("""\r
+                IF(GUI_ROOT_DIR)\r
+                SET(GHS3DPRLPLUGIN_ENABLE_GUI ON)\r
+                ENDIF(GUI_ROOT_DIR)\r
+                """)\r
+                pass\r
+            elif self.module == "yacs":\r
+                newlines.append("""\r
+                SET(SALOME_KERNEL ON)\r
+                SET(HAS_GUI ON)\r
+                SET(WITH_QT4 ON)\r
+                """)\r
+                pass\r
+            # --\r
+            newlines.append("""\r
+            set(VERSION 6.5.0)\r
+            set(SHORT_VERSION 6.5)\r
+            set(XVERSION 0x060500)\r
+            """)\r
+            pass\r
+        # --\r
+        newlines.append("""\r
+        SET(VERSION_INFO 0.0.0)\r
+        SET(SOVERSION_INFO 0)\r
+        SET(SUBDIRS)\r
+        SET(bin_PROGRAMS)\r
+        SET(AM_CPPFLAGS -I${CMAKE_BINARY_DIR} )\r
+        SET(AM_CXXFLAGS -I${CMAKE_BINARY_DIR})\r
+        SET(LDADD)\r
+        SET(pythondir lib/python${PYTHON_VERSION}/site-packages)\r
+        SET(salomepythondir ${pythondir}/salome)\r
+        SET(salomepypkgdir ${salomepythondir}/salome)\r
+        """)\r
+        \r
+        if self.module == "smesh" and self.root[-len('SMESH_PY'):] == 'SMESH_PY':\r
+           newlines.append("""\r
+           SET(smeshpypkgdir ${salomepythondir}/salome/smesh)\r
+           """)\r
+           pass\r
+        if self.module == "netgen":\r
+            newlines.append(r'''\r
+            SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DNO_PARALLEL_THREADS -DOCCGEOMETRY -I${CMAKE_CURRENT_SOURCE_DIR})\r
+            ''')\r
+        elif self.module == "kernel":\r
+            newlines.append(r'''\r
+            SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h)\r
+            SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${CMAKE_BINARY_DIR}/salome_adm/unix -include SALOMEconfig.h)\r
+            ''')\r
+        else:\r
+            if self.module not in ["yacs"]:\r
+                newlines.append(r'''\r
+                IF(KERNEL_ROOT_DIR)\r
+                SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h)\r
+                SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DHAVE_SALOME_CONFIG -I${KERNEL_ROOT_DIR}/include/salome -include SALOMEconfig.h)\r
+                ENDIF(KERNEL_ROOT_DIR)\r
+                ''')\r
+                pass\r
+            if self.module == "gui":\r
+                newlines.append(r'''\r
+                IF(KERNEL_ROOT_DIR)\r
+                SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DWITH_SALOMEDS_OBSERVER -DSUIT_ENABLE_PYTHON)\r
+                SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DWITH_SALOMEDS_OBSERVER -DSUIT_ENABLE_PYTHON)\r
+                ENDIF(KERNEL_ROOT_DIR)\r
+                ''')\r
+                pass\r
+            if self.module in ["smesh", "netgenplugin", "blsurfplugin", "ghs3dplugin", "hexoticplugin"]:\r
+                newlines.append(r'''\r
+                SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DWITH_SMESH_CANCEL_COMPUTE)\r
+                SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DWITH_SMESH_CANCEL_COMPUTE)\r
+                ''')\r
+                pass\r
+            if self.module == "ghs3dplugin":\r
+    # TODO: Auto-detect TetGen-GHS3D version automatically\r
+                newlines.append(r'''\r
+                SET(AM_CPPFLAGS ${AM_CPPFLAGS} -DGHS3D_VERSION=42)\r
+                SET(AM_CXXFLAGS ${AM_CXXFLAGS} -DGHS3D_VERSION=42)\r
+                ''')\r
+                pass              \r
+            if self.module == "hxx2salome":\r
+                key = "_SRC"\r
+                if self.the_root[-len(key):] != key:\r
+                    msg = "Source dir must finished with %s !"%(key)\r
+                    raise Exception(msg)\r
+                hxxmodule = self.the_root[:-len(key)]\r
+                from os.path import basename\r
+                hxxmodule = basename(hxxmodule)\r
+                hxxmodule = hxxmodule.lower()\r
+                self.hxxmodule = hxxmodule\r
+                newlines.append(r'''\r
+                SET(HXXCPP_ROOT_DIR $ENV{%sCPP_ROOT_DIR})\r
+                SET(AM_CPPFLAGS ${AM_CPPFLAGS} -I${HXXCPP_ROOT_DIR}/include)\r
+                SET(AM_CXXFLAGS ${AM_CXXFLAGS} -I${HXXCPP_ROOT_DIR}/include)\r
+                SET(LDADD ${LDADD} -L${HXXCPP_ROOT_DIR}/lib)\r
+                '''%(hxxmodule.upper()))\r
+                pass\r
+            pass\r
+        # --\r
+        return\r
+    \r
+    def treatLine(self, line, newlines, opened_ifs):\r
+        \r
+        # --\r
+        # Print the comment above the line itself\r
+        # --\r
+        if line.find('#') >= 0:\r
+            fields = line.split('#')\r
+            line = fields[0]\r
+            comment = '#'.join([''] + fields[1:])\r
+            newlines.append(comment)\r
+            if len(line) == 0:\r
+                return\r
+            pass\r
+        \r
+        # --\r
+        # If the line begins with 'include ', just comment it\r
+        # --\r
+        if line.find("include ") == 0:\r
+            if line.find("include $(top_srcdir)/config/automake.common") == 0:\r
+                for l in [\r
+                    "MAINTAINERCLEANFILES = Makefile.in",\r
+                    "AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_builddir)/include",\r
+                    "AM_FFLAGS=-I$(top_srcdir)/include  -I$(top_builddir)/include",\r
+                    "AM_FCFLAGS=-I$(top_srcdir)/include  -I$(top_builddir)/include",\r
+                    "AM_CPPFLAGS+=@HDF5_CPPFLAGS@",\r
+                    "AM_LDFLAGS=@HDF5_LDFLAGS@",\r
+                    ]:\r
+                    self.treatLine(l, newlines, opened_ifs)\r
+                    pass\r
+                pass\r
+            else:\r
+                newlines.append("# " + line)\r
+                pass\r
+            return\r
+        \r
+        # --\r
+        # If the line begins with '-include', just comment it\r
+        # --\r
+        if line.find("-include") == 0:\r
+            newlines.append("# " + line)\r
+            return\r
+        \r
+        # --\r
+        # If the line is a definition of a make rule, just comment it\r
+        # --\r
+        if line.count(':') == 1:\r
+            newlines.append("# " + line)\r
+            return\r
+        \r
+        # --\r
+        # A particuliar case where there are two ":" on the same line\r
+        # --\r
+        if line.find('install-exec-local:') == 0:\r
+            newlines.append("# " + line)\r
+            return\r
+        \r
+        # --\r
+        # If the line begin by a tabulation, consider it's a makefile command and comment it\r
+        # --\r
+        if line.find("\t") == 0:\r
+            newlines.append("# " + line)\r
+            return\r
+        \r
+        # --\r
+        # --\r
+        key = "-version-info"\r
+        if line.find(key) >= 0:\r
+            # --\r
+            before = line.split(key)[0]\r
+            after = line[len(before)+len(key):]\r
+            sep = after[0]\r
+            after = after[1:]\r
+            version_info = after.split()[0]\r
+            line = line.replace(key+sep+version_info, "")\r
+            # --\r
+            version_info = version_info.replace(':', '.')\r
+            soversion_info = version_info.split('.')[0]\r
+            newlines.append("SET(VERSION_INFO " + version_info + ")")\r
+            newlines.append("SET(SOVERSION_INFO " + soversion_info + ")")\r
+            # --\r
+            pass\r
+        \r
+        # --\r
+        # Replace the $(TOTO) by ${TOTO}\r
+        # Replace the @TOTO@  by ${TOTO}\r
+        # --\r
+        line = p_dollar.sub(r"${\1}", line)\r
+        line = p_arobas.sub(r"${\1}", line)\r
+        \r
+        # --\r
+        line = line.replace(r"${top_builddir}", r"${CMAKE_BINARY_DIR}")\r
+        line = line.replace(r"${top_srcdir}", r"${CMAKE_SOURCE_DIR}")\r
+        line = line.replace(r"${srcdir}", r"${CMAKE_CURRENT_SOURCE_DIR}")\r
+        line = line.replace(r"${builddir}", r"${CMAKE_CURRENT_BINARY_DIR}")\r
+        line = line.replace(r"${datadir}", r"${CMAKE_INSTALL_PREFIX}/share")\r
+        \r
+        # --\r
+        # Check if the line is a 'if' condition\r
+        # If yes, replace it by a cmake grammar\r
+        # --\r
+        match = p_if.match(line)\r
+        if match:\r
+            theif = match.group("val")\r
+            if theif[0] == "!":\r
+                theif = "NOT " + theif[1:]\r
+                pass\r
+            line = p_if.sub(r"IF(%s)"%(theif), line)\r
+            opened_ifs.append(theif)\r
+            newlines.append(line)\r
+            return\r
+        \r
+        # --\r
+        # Check if the line is a 'else' condition\r
+        # If yes, replace it by a cmake grammar\r
+        # --\r
+        match = p_else.match(line)\r
+        if match:\r
+            line = "ELSE(%s)"%(opened_ifs[-1])\r
+            newlines.append(line)\r
+            return\r
+        \r
+        # --\r
+        # Check if the line is a 'endif' condition\r
+        # If yes, replace it by a cmake grammar\r
+        # --\r
+        match = p_endif.match(line)\r
+        if match:\r
+            line = "ENDIF(%s)"%(opened_ifs[-1])\r
+            opened_ifs[-1:] = []\r
+            newlines.append(line)\r
+            return\r
+        \r
+        # --\r
+        # Check if the line is an attribution '=' or '+='\r
+        # --\r
+        match = p_attribution.match(line)\r
+        if match:\r
+            self.treatAttribution(match, newlines)\r
+            return\r
+        \r
+        # --\r
+        newlines.append(line)\r
+        \r
+        # --\r
+        return\r
+    \r
+    def treatAttribution(self, match, newlines):\r
+        \r
+        spaces = match.group("spaces")\r
+        key = match.group("key")\r
+        method = match.group("method")\r
+        value = match.group("value")\r
+        # print [spaces, key, method, value]\r
+        \r
+        # --\r
+        # Open cmake SET command\r
+        # --\r
+        newlines.append(spaces + "SET(" + key)\r
+        \r
+        # --\r
+        # If method is '+=', put the previous definition as first value\r
+        # --\r
+        if method == "+=":\r
+            newlines.append("%s    ${%s}"%(spaces, key))\r
+            pass\r
+        \r
+        # --\r
+        fields = value.split()\r
+        \r
+        for i in range(len(fields)):\r
+            newlines.append("%s    %s"%(spaces, fields[i]))\r
+            pass\r
+        \r
+        # --\r
+        if method == "+=":\r
+            # --\r
+            # The try: except KeyError is here if the +=\r
+            # is an error which occurs in salome ...\r
+            # --\r
+            try:\r
+                self.__thedict__[key] += fields[:]\r
+            except KeyError:\r
+                self.__thedict__[key] = fields[:]\r
+                pass\r
+            pass\r
+        else:\r
+            self.__thedict__[key]  = fields[:]\r
+            pass\r
+        \r
+        # --\r
+        # Close cmake SET command\r
+        # --\r
+        \r
+        newlines.append("%s)"%(spaces))\r
+        \r
+        return\r
+    \r
+    def finalize(self, newlines):\r
+      \r
+        # --\r
+        # Convert the .in files in build dir\r
+        # --\r
+        upmod = ""\r
+        if self.module == "hexoticplugin" :\r
+          upmod = "HexoticPLUGIN"\r
+        else :\r
+          upmod = self.module.upper()\r
+\r
+        import operator\r
+        mod = self.module\r
+        if mod in ['kernel', 'gui'] and self.root[-len('gui'):] == 'gui' or mod == 'med' and operator.contains(self.root, 'doxygen'):\r
+            newlines.append(r'''\r
+            SET(top_builddir\r
+                ${CMAKE_BINARY_DIR}\r
+            )\r
+            SET(top_srcdir \r
+                ${CMAKE_SOURCE_DIR}\r
+            )\r
+            SET(srcdir \r
+                ${CMAKE_CURRENT_SOURCE_DIR}\r
+            )\r
+            SET(builddir \r
+                ${CMAKE_CURRENT_BINARY_DIR}\r
+            )\r
+            SET(datadir\r
+                ${CMAKE_INSTALL_PREFIX}/share\r
+            )\r
+            SET(docdir \r
+                ${datadir}/doc/salome\r
+            )\r
+            ''')\r
+            self.files.append("static/header.html.in")\r
+        elif self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc') or mod in ['kernel', 'gui', 'geom', 'med', 'smesh', 'visu'] and self.root[-len('tui'):] == 'tui':\r
+            newlines.append(r'''\r
+            SET(top_builddir\r
+                ${CMAKE_BINARY_DIR}\r
+            )\r
+            SET(top_srcdir \r
+                ${CMAKE_SOURCE_DIR}\r
+            )\r
+            SET(srcdir \r
+                ${CMAKE_CURRENT_SOURCE_DIR}\r
+            )\r
+            SET(builddir \r
+                ${CMAKE_CURRENT_BINARY_DIR}\r
+            )\r
+            SET(datadir\r
+                ${CMAKE_INSTALL_PREFIX}/share\r
+            )\r
+            SET(docdir \r
+                ${datadir}/doc/salome\r
+            )\r
+            ''')\r
+            self.files.append("static/header.html.in")\r
+            if mod in ['geom', 'smesh', 'visu','netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin',"ghs3dprlplugin"] and self.root[-len(mod):] == upmod:\r
+              self.files.append("static/header_py.html.in")\r
+     \r
+        if self.module == "yacs":\r
+            key = "salomegui"\r
+            if self.root[-len(key):] == key:\r
+                self.files.append("resources/YACSCatalog.xml.in")\r
+                self.files.append("resources/SalomeApp.xml.in")\r
+                pass\r
+            pass\r
+            from os import path\r
+            if operator.contains(self.root, 'YACS_SRC'+path.sep+'doc'):\r
+                newlines.append(r'''\r
+                SET(srcdir \r
+                  ${CMAKE_CURRENT_SOURCE_DIR}\r
+                )\r
+                ''')\r
+            \r
+        if self.module == "jobmanager":\r
+            key = "salomegui"\r
+            if self.root[-len(key):] == key:\r
+                self.files.append("resources/SalomeApp.xml.in")\r
+                pass\r
+            pass\r
+        for f in self.files:\r
+            if f[-3:] == ".in":\r
+                if self.module == 'yacs' and f == "Doxyfile.in":\r
+                    continue\r
+                if f == "sstream.in":\r
+                    continue\r
+                if f in ["runContainer.in", "stopContainer.in"]:\r
+                    if self.module == "med":\r
+                        if self.root[-3:] == "csh":\r
+                            continue\r
+                        pass\r
+                    pass\r
+                if f == "SALOMEconfig.ref.in":\r
+                    out = "SALOMEconfig.h"\r
+                else:\r
+                    out = f[:-3]\r
+                    pass\r
+                newlines.append(r'''\r
+                SET(input ${CMAKE_CURRENT_SOURCE_DIR}/%s)\r
+                '''%(f))\r
+                newlines.append(r'''\r
+                SET(output ${CMAKE_CURRENT_BINARY_DIR}/%s)\r
+                '''%(out))\r
+                newlines.append(r'''\r
+                MESSAGE(STATUS "Creation of ${output}")\r
+                CONFIGURE_FILE(${input} ${output})\r
+                ''')\r
+                pass\r
+            pass\r
+\r
+        # --\r
+        # add commands for generating of user's documentation\r
+        # --\r
+        doc_gui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/%s"%(upmod)\r
+        doc_tui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/%s"%(upmod)\r
+        doc_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome"\r
+        head_source = "${CMAKE_CURRENT_SOURCE_DIR}/images/head.png"\r
+        if mod == 'kernel':\r
+            prepare_generating_doc_src = "${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/prepare_generating_doc.py"\r
+        else:\r
+            prepare_generating_doc_src = "$ENV{KERNEL_ROOT_DIR}/bin/salome/prepare_generating_doc.py"\r
+        if mod in ['kernel', 'gui'] and self.root[-len('gui'):] == 'gui' or mod == 'med' and operator.contains(self.root, 'doxygen'):\r
+            if mod == 'med':\r
+                doc_source = "${CMAKE_CURRENT_BINARY_DIR}/doc_ref_user/html"\r
+                input = "Doxyfile_med_user"\r
+            else:\r
+                doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod)\r
+                input = ""\r
+            newlines.append("""\t    ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} %s\r
+            COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''', True); shutil.copytree(r'''%s''', r'''%s'''); shutil.copy(r'''%s''', r'''%s''')"\r
+            VERBATIM \r
+            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}             \r
+            )"""%(input, doc_gui_destination, doc_source, doc_gui_destination, head_source, doc_gui_destination))\r
+        from os import path\r
+        if mod in ['geom', 'smesh', 'visu', 'netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin','ghs3dprlplugin'] and self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc'):\r
+            ign = r"""'*usr_docs*', '*CMakeFiles*', '*.cmake', 'doxyfile*', '*.vcproj', 'static', 'Makefile*'"""\r
+            if mod in ['geom', 'smesh']:\r
+                if mod == 'geom':\r
+                    tmp = 'geompy'\r
+                    input = "COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_tui \n\t\t"\r
+                else:\r
+                    tmp =  'smesh' \r
+                    input = ''\r
+                newlines.append(r"""\r
+                IF(WINDOWS)\r
+                  STRING(REPLACE "/" "\\" f "%s")\r
+               ELSE(WINDOWS)\r
+                 SET(f "%s")                       \r
+                ENDIF(WINDOWS)\r
+                ADD_CUSTOM_TARGET(usr_docs ${PYTHON_EXECUTABLE} ${f} %s.py ${CMAKE_SOURCE_DIR}/src/%s_SWIG/%sDC.py %s\r
+                %sCOMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py\r
+                COMMAND ${DOXYGEN_EXECUTABLE} doxyfile\r
+                COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''%s.py''')"\r
+                COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''', True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''', r'''%s''', ignore=shutil.ignore_patterns(%s)); shutil.copy(r'''%s''', r'''%s''')"\r
+                VERBATIM \r
+                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}             \r
+                )"""%(prepare_generating_doc_src, prepare_generating_doc_src, tmp, upmod, tmp, tmp, input, tmp, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination))\r
+            else:\r
+                config_f = ""\r
+               if mod in ['netgenplugin','blsurfplugin','hexoticplugin','ghs3dplugin', "ghs3dprlplugin"] :\r
+                    config_f = "doxyfile_py"\r
+                else:\r
+                    config_f = "doxyfile_idl"\r
+                newlines.append("""\t    ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} %s\r
+                COMMAND ${DOXYGEN_EXECUTABLE} doxyfile\r
+                COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''',True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''',r'''%s''', ignore=shutil.ignore_patterns(%s)); shutil.copy(r'''%s''',r'''%s''')"\r
+                VERBATIM \r
+                WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}\r
+                )"""%(config_f, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination))\r
+        elif mod in ['yacs', 'ppgp'] and operator.contains(self.root, upmod + '_SRC'+path.sep+'doc'):\r
+            from sys import platform\r
+            params = '';\r
+            if platform == "win32":\r
+                params = '-Q';\r
+            newlines.append(r"""\r
+            ADD_CUSTOM_TARGET(html_docs ${SPHINX_EXECUTABLE} %s -c ${CMAKE_BINARY_DIR}/doc -b html ${ALLSPHINXOPTS} html\r
+            COMMAND ${PYTHON_EXECUTABLE} -c \"import shutil\;shutil.rmtree('''%s''', True)\;shutil.copytree('''${CMAKE_CURRENT_BINARY_DIR}/html''', '''%s''')\"\r
+            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"""%(params, doc_gui_destination, doc_gui_destination))              \r
+       elif mod in ['kernel', 'smesh', 'geom'] and operator.contains(self.root, upmod + '_SRC'+path.sep+'doc'+path.sep+'docutils'):\r
+            from sys import platform\r
+            params = ""\r
+            ext = ""\r
+            prf = ""\r
+            if platform == "win32":\r
+                params = '-Q';\r
+                ext = "bat"\r
+                prf = "call"\r
+            else:\r
+                ext = "sh"\r
+                prf = ". "\r
+            doc_gui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/%s/docutils"%(upmod)\r
+            scr = self.writeEnvScript(upmod)                   \r
+            newlines.append(r"""\r
+            IF(WINDOWS)\r
+               STRING(REPLACE "/" "\\" SCR "%s")\r
+           ELSE(WINDOWS)\r
+               SET(SCR "%s")\r
+            ENDIF(WINDOWS)\r
+            FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/env_s.%s "${SCR}")\r
+            ADD_CUSTOM_TARGET(html_docs %s ${CMAKE_CURRENT_BINARY_DIR}/env_s.%s && ${SPHINX_EXECUTABLE} %s -c ${CMAKE_BINARY_DIR}/doc/docutils -W -b html ${ALLSPHINXOPTS} html\r
+            COMMAND ${PYTHON_EXECUTABLE} -c \"import shutil\;shutil.rmtree('''%s''', True)\;shutil.copytree('''${CMAKE_CURRENT_BINARY_DIR}/html''', '''%s''')\"\r
+            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"""%(scr,scr,ext,prf,ext,params, doc_gui_destination, doc_gui_destination))\r
+\r
+\r
+\r
+\r
+  # --\r
+  # add commands for generating of developer's documentation\r
+  # --\r
+  \r
+        upmod = self.module.upper()\r
+        if mod in ['kernel', 'gui', 'med', 'smesh', 'visu'] and self.root[-len('tui'):] == 'tui':\r
+            if mod == 'kernel':\r
+                tmp = """\tADD_CUSTOM_TARGET(dev_docs ${DOXYGEN_EXECUTABLE} -u\r
+            COMMAND ${DOXYGEN_EXECUTABLE}\r
+            COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''${CMAKE_CURRENT_BINARY_DIR}/doxyfile.bak''')"  """\r
+                tmp1=""\r
+            else: \r
+                tmp = """\tADD_CUSTOM_TARGET(dev_docs ${DOXYGEN_EXECUTABLE}"""\r
+                if mod == 'visu':\r
+                    tmp1= r"""\n           COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/visuscreen.png''', r'''%s''')" """%(doc_tui_destination)\r
+                elif mod == 'smesh':\r
+                    extra_srcdir = "${CMAKE_CURRENT_SOURCE_DIR}/extra"\r
+                    tmp1= """\n            COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/smeshscreen.png''', r'''%s'''); copy(r'''%s/AddNetgenInSalome2.pdf''', r'''%s'''); copy(r'''%s/PluginMeshers.html''', r'''%s''')" \r
+            COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''%s/AddNetgenInSalome2.ps''', r'''%s'''); copy(r'''%s/AddNetgenInSalome2.sxw''', r'''%s''')" """%(doc_tui_destination, extra_srcdir,doc_destination, extra_srcdir,doc_destination, extra_srcdir,doc_destination,extra_srcdir,doc_destination)\r
+                else:\r
+                    tmp1=""\r
+            doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod)\r
+            newlines.append(tmp + """\r
+            COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''', True); shutil.copytree(r'''%s''', r'''%s'''); shutil.copy(r'''%s''', r'''%s''')" """%(doc_tui_destination, doc_source, doc_tui_destination, head_source, doc_tui_destination) + tmp1 + """\r
+            VERBATIM \r
+            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}             \r
+            )""")\r
+        if mod == 'geom' and self.root[-len('tui'):] == 'tui':\r
+            tmp = 'geompy'\r
+            doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod)\r
+            newlines.append(r"""\r
+            IF(WINDOWS)\r
+              STRING(REPLACE "/" "\\" f "%s")\r
+            ELSE(WINDOWS)\r
+              SET(f "%s")\r
+           ENDIF(WINDOWS)\r
+            ADD_CUSTOM_TARGET(dev_docs ${PYTHON_EXECUTABLE} ${f} ${CMAKE_BINARY_DIR}/src/%s_SWIG/%s.py ${CMAKE_SOURCE_DIR}/src/%s_SWIG/%sDC.py %s\r
+            COMMAND ${DOXYGEN_EXECUTABLE} doxyfile\r
+            COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''${CMAKE_BINARY_DIR}/src/%s_SWIG/%s.py''')"\r
+            COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''%s''', True); shutil.copytree(r'''%s''', r'''%s'''); shutil.copy(r'''%s''', r'''%s'''); shutil.copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/geomscreen.png''', r'''%s''')"\r
+            VERBATIM \r
+            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}             \r
+            )"""%(prepare_generating_doc_src, prepare_generating_doc_src, upmod, tmp, upmod, tmp, tmp, upmod, tmp, doc_tui_destination, doc_source, doc_tui_destination, head_source, doc_tui_destination, doc_tui_destination))\r
+\r
+        # --\r
+        # convert the SUBDIRS in cmake grammar\r
+        # --\r
+        if 1: # self.__thedict__.has_key("SUBDIRS"):\r
+            newlines.append(r'''\r
+            FOREACH(dir ${SUBDIRS})\r
+            IF(NOT dir STREQUAL .)\r
+            ADD_SUBDIRECTORY(${dir})\r
+            ENDIF(NOT dir STREQUAL .)\r
+            ENDFOREACH(dir ${SUBDIRS})\r
+            ''')\r
+            pass\r
+        \r
+        # --\r
+        # --\r
+        for key in ["lib_LTLIBRARIES", "noinst_LTLIBRARIES", "salomepyexec_LTLIBRARIES", "libparaview_LTLIBRARIES"] :\r
+            if self.__thedict__.has_key(key):\r
+                self.addLibTarget(key, newlines)\r
+                pass\r
+            pass\r
+        \r
+        # --\r
+        # --\r
+        for key in ["bin_PROGRAMS", "check_PROGRAMS"]:\r
+            if self.__thedict__.has_key(key):\r
+                self.addBinTarget(key, newlines)\r
+                pass\r
+            pass\r
+        \r
+        # --\r
+        # --\r
+        if self.__thedict__.has_key("BASEIDL_FILES"):\r
+            if not self.__thedict__.has_key("IDL_FILES"):\r
+                self.__thedict__["IDL_FILES"] = self.__thedict__["BASEIDL_FILES"]\r
+                newlines.append('''\r
+                SET(IDL_FILES ${BASEIDL_FILES})\r
+                ''')\r
+                pass\r
+            pass\r
+        \r
+        # --\r
+        # --\r
+        \r
+        key = "IDL_FILES"\r
+        if self.__thedict__.has_key(key):\r
+            if self.module == "kernel":\r
+                newlines.append('''\r
+                SET(IDL_FILES ${IDL_FILES} Calcium_Ports.idl)\r
+                ''')\r
+                pass\r
+            newlines.append('''\r
+            FOREACH(input ${IDL_FILES})\r
+            STRING(REGEX REPLACE ".idl" "" base ${input})\r
+            SET(src ${CMAKE_CURRENT_BINARY_DIR}/${base}SK.cc)\r
+            SET(outputs ${src})\r
+            SET(dynsrc ${CMAKE_CURRENT_BINARY_DIR}/${base}DynSK.cc)\r
+            SET(outputs ${outputs} ${dynsrc})\r
+            SET(inc ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh)\r
+            SET(outputs ${outputs} ${inc})\r
+            IF(input STREQUAL Calcium_Ports.idl)\r
+            SET(input ${CMAKE_CURRENT_BINARY_DIR}/${input})\r
+            ELSE(input STREQUAL Calcium_Ports.idl)\r
+            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})\r
+            ENDIF(input STREQUAL Calcium_Ports.idl)\r
+            SET(flags ${IDLCXXFLAGS} ${OMNIORB_IDLCXXFLAGS})\r
+            STRING(REGEX MATCH "-bcxx" ISBCXX ${flags})\r
+            IF(NOT ISBCXX)\r
+            SET(flags -bcxx ${flags})\r
+            ENDIF(NOT ISBCXX)\r
+            ADD_CUSTOM_COMMAND(\r
+            OUTPUT ${outputs}\r
+            COMMAND ${OMNIORB_IDL} ${flags} ${input}\r
+            MAIN_DEPENDENCY ${input}\r
+            )\r
+            ''')\r
+            newlines.append('''\r
+            install(FILES ${input} DESTINATION idl/salome)\r
+            ''')\r
+            if self.module not in ["pyhello"]:\r
+                newlines.append('''\r
+                SET(IDL_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh)\r
+                install(FILES ${IDL_HEADER} DESTINATION include/salome)\r
+                ''')\r
+                pass\r
+            newlines.append('''\r
+            INSTALL(CODE "SET(IDL_FILE ${input})")\r
+            INSTALL(CODE "SET(DIR ${salomepythondir})")\r
+            IF(WINDOWS)\r
+            INSTALL(CODE "SET(DIR bin/salome)")\r
+            ENDIF(WINDOWS)\r
+            INSTALL(CODE "SET(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})")\r
+            INSTALL(CODE "SET(OMNIORB_IDL_PYTHON ${OMNIORB_IDL_PYTHON})")\r
+            # --\r
+            SET(flags)\r
+            FOREACH(f ${IDLPYFLAGS})\r
+            SET(flags "${flags} ${f}")\r
+            ENDFOREACH(f ${IDLPYFLAGS})\r
+            STRING(REGEX MATCH "-bpython" ISBPYTHON ${flags})\r
+            IF(NOT ISBPYTHON)\r
+            SET(flags "-bpython ${flags}")\r
+            ENDIF(NOT ISBPYTHON)\r
+            SET(IDLPYFLAGS ${flags})\r
+            STRING(REPLACE "\\\\" "/" IDLPYFLAGS ${IDLPYFLAGS})\r
+            INSTALL(CODE "SET(IDLPYFLAGS ${IDLPYFLAGS})")\r
+            # --\r
+            ''')\r
+            if self.module == "kernel":\r
+                newlines.append('''\r
+                INSTALL(SCRIPT ${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/install_python_from_idl.cmake)\r
+                ''')\r
+            else:\r
+                newlines.append('''\r
+                STRING(REPLACE "\\\\" "/" KERNEL_ROOT_DIR ${KERNEL_ROOT_DIR})\r
+                INSTALL(SCRIPT ${KERNEL_ROOT_DIR}/salome_adm/cmake_files/install_python_from_idl.cmake)\r
+                ''')\r
+                pass\r
+            newlines.append('''\r
+            ENDFOREACH(input ${IDL_FILES})\r
+            ''')\r
+            pass\r
+        \r
+        # --\r
+        # --\r
+        for key in ["SWIG_SRC", "SWIGSOURCES", "SWIG_DEF"]:\r
+            if self.__thedict__.has_key(key):\r
+                newlines.append('''\r
+                SET(SWIG_SOURCES ${%s})\r
+                '''%(key))\r
+                self.__thedict__["SWIG_SOURCES"] = self.__thedict__[key]\r
+                pass\r
+            pass\r
+        \r
+        # --\r
+        # --\r
+        if self.__thedict__.has_key("SWIG_SOURCES"):\r
+            newlines.append('''\r
+            IF(SWIG_SOURCES MATCHES ";")\r
+            STRING(REGEX REPLACE ";.*" "" SWIG_SOURCES_FIRST "${SWIG_SOURCES}")\r
+            ELSE(SWIG_SOURCES MATCHES ";")\r
+            SET(SWIG_SOURCES_FIRST "${SWIG_SOURCES}")\r
+            ENDIF(SWIG_SOURCES MATCHES ";")\r
+            SET(flags)\r
+            FOREACH(f ${SWIG_FLAGS} ${MY_SWIG_FLAGS})\r
+            SET(test ON)\r
+            IF(flags)\r
+            LIST(FIND flags ${f} index)\r
+            IF(NOT index EQUAL -1)\r
+            SET(test OFF)\r
+            ENDIF(NOT index EQUAL -1)\r
+            ENDIF(flags)\r
+            IF(test)\r
+            SET(flags ${flags} ${f})\r
+            ENDIF(test)\r
+            ENDFOREACH(f ${SWIG_FLAGS} ${MY_SWIG_FLAGS})\r
+            ADD_CUSTOM_COMMAND(\r
+            OUTPUT ${build_srcs}\r
+            COMMAND ${SWIG_EXECUTABLE} ${flags} -o ${build_srcs} ${CMAKE_CURRENT_SOURCE_DIR}/${SWIG_SOURCES_FIRST}\r
+            MAIN_DEPENDENCY ${SWIG_SOURCES}\r
+            )\r
+            ''')\r
+            pass\r
+        \r
+        # --\r
+        # --\r
+        if self.__thedict__.has_key("BUILT_SOURCES"):\r
+            newlines.append('''\r
+            FOREACH(f ${BUILT_SOURCES})\r
+            IF(f MATCHES "WRAP.cxx$")\r
+            # STRING(REGEX REPLACE "WRAP.cxx" "WRAP.h" inc ${f})\r
+            STRING(REGEX REPLACE "WRAP.cxx" ".i" input ${f})\r
+            ADD_CUSTOM_COMMAND(\r
+            OUTPUT ${f} # ${inc}\r
+            COMMAND ${SWIG_EXECUTABLE} ${SWIG_FLAGS} ${SWIG_PYTHON_INCLUDES} ${MYSWIG_FLAGS} -o ${f} ${CMAKE_CURRENT_SOURCE_DIR}/${input}\r
+            MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${input}\r
+            )\r
+            ENDIF(f MATCHES "WRAP.cxx$")\r
+            ENDFOREACH(f ${BUILT_SOURCES})\r
+            ''')\r
+            pass\r
+\r
+        # --\r
+        # --\r
+        key = "MOC_FILES"\r
+        if self.__thedict__.has_key(key):\r
+            newlines.append('''\r
+            FOREACH(output ${MOC_FILES})\r
+            ''')\r
+            if self.module in ["jobmanager", "yacs"]:\r
+                newlines.append('''\r
+                STRING(REGEX REPLACE _moc.cxx .hxx input ${output})\r
+                ''')\r
+            else:\r
+                newlines.append('''\r
+                STRING(REGEX REPLACE _moc.cxx .h input ${output})\r
+                ''')\r
+                pass\r
+            newlines.append('''\r
+            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})\r
+            SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output})\r
+            ADD_CUSTOM_COMMAND(\r
+            OUTPUT ${output}\r
+            COMMAND ${QT_MOC_EXECUTABLE} ${MOC_FLAGS} ${input} -o ${output}\r
+            MAIN_DEPENDENCY ${input}\r
+            )\r
+            ENDFOREACH(output ${MOC_FILES})\r
+            ''')\r
+            pass\r
+        \r
+        # --\r
+        # --\r
+        key = "MOC_FILES_HXX"\r
+        if self.__thedict__.has_key(key):\r
+            newlines.append('''\r
+            FOREACH(output ${MOC_FILES_HXX})\r
+            ''')\r
+            newlines.append('''\r
+            STRING(REGEX REPLACE _moc.cxx .hxx input ${output})\r
+            ''')\r
+            newlines.append('''\r
+            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})\r
+            SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output})\r
+            ADD_CUSTOM_COMMAND(\r
+            OUTPUT ${output}\r
+            COMMAND ${QT_MOC_EXECUTABLE} ${MOC_FLAGS} ${input} -o ${output}\r
+            MAIN_DEPENDENCY ${input}\r
+            )\r
+            ENDFOREACH(output ${MOC_FILES_HXX})\r
+            ''')\r
+            pass\r
+        \r
+        # --\r
+        # --\r
+        key = "UIC_FILES"\r
+        if self.__thedict__.has_key(key):\r
+            newlines.append('''\r
+            FOREACH(output ${UIC_FILES})\r
+            STRING(REPLACE "ui_" "" input ${output})\r
+            STRING(REPLACE ".h" ".ui" input ${input})\r
+            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})\r
+            SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output})\r
+            ADD_CUSTOM_COMMAND(\r
+            OUTPUT ${output}\r
+            COMMAND ${QT_UIC_EXECUTABLE} -o ${output} ${input}\r
+            MAIN_DEPENDENCY ${input}\r
+            )\r
+            ENDFOREACH(output ${UIC_FILES})\r
+            ''')\r
+            pass\r
+        \r
+        # --\r
+        # --\r
+        key = "PYUIC_FILES"\r
+        if self.__thedict__.has_key(key):\r
+            newlines.append('''\r
+            FOREACH(output ${PYUIC_FILES})\r
+            STRING(REPLACE "_ui.py" ".ui" input ${output})\r
+            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})\r
+            SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output})\r
+            ADD_CUSTOM_COMMAND(\r
+            OUTPUT ${output}\r
+            COMMAND ${PYUIC_EXECUTABLE} -o ${output} ${input}\r
+            MAIN_DEPENDENCY ${input}\r
+            )\r
+            ENDFOREACH(output ${PYUIC_FILES})\r
+            ADD_CUSTOM_TARGET(BUILD_PY_UI_FILES ALL DEPENDS ${PYUIC_FILES})\r
+            ''')\r
+            pass\r
+\r
+        # --\r
+        # --\r
+        key = "PYQRC_FILES"        \r
+        if self.__thedict__.has_key(key):\r
+            newlines.append('''\r
+            FOREACH(output ${PYQRC_FILES})\r
+            STRING(REPLACE "_qrc.py" ".qrc" input ${output})\r
+            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})\r
+            SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output})\r
+            ADD_CUSTOM_COMMAND(\r
+            OUTPUT ${output}\r
+            COMMAND ${PYRCC_EXECUTABLE} -o ${output} ${input}\r
+            MAIN_DEPENDENCY ${input}\r
+            )\r
+            ENDFOREACH(output ${PYQRC_FILES})\r
+            ADD_CUSTOM_TARGET(BUILD_PY_QRC_FILES ALL DEPENDS ${PYQRC_FILES})\r
+            ''')\r
+            pass\r
+        \r
+        # --\r
+        # --\r
+        key = "QRC_FILES"\r
+        if self.__thedict__.has_key(key):\r
+            newlines.append('''\r
+            FOREACH(output ${QRC_FILES})\r
+            STRING(REGEX REPLACE "qrc_" "" input ${output})\r
+            STRING(REGEX REPLACE ".cxx" ".qrc" input ${input})\r
+            STRING(REGEX REPLACE ".qrc" "" name ${input})\r
+            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})\r
+            SET(output ${CMAKE_CURRENT_BINARY_DIR}/${output})\r
+            ADD_CUSTOM_COMMAND(\r
+            OUTPUT ${output}\r
+            COMMAND ${QT_RCC_EXECUTABLE} ${input} -o ${output} -name ${name}\r
+            MAIN_DEPENDENCY ${input}\r
+            )\r
+            ENDFOREACH(output ${QRC_FILES})\r
+            ''')\r
+            pass\r
+        \r
+        # --\r
+        # --\r
+        key = "SIP_FILES"\r
+        if self.__thedict__.has_key(key):\r
+            newlines.append('''\r
+            FOREACH(input ${SIP_FILES})\r
+            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})\r
+            SET(output)\r
+            FOREACH(out ${SIP_SRC})\r
+            SET(output ${output} ${CMAKE_CURRENT_BINARY_DIR}/${out})\r
+            ENDFOREACH(out ${SIP_SRC})\r
+            ADD_CUSTOM_COMMAND(\r
+            OUTPUT ${output}\r
+            COMMAND ${SIP_EXECUTABLE} ${PYQT_SIPFLAGS} ${input}\r
+            MAIN_DEPENDENCY ${input}\r
+            )\r
+            ENDFOREACH(input ${SIP_FILES})\r
+            ''')\r
+            pass\r
+\r
+        # --\r
+        # For GUI/tools/dlgfactory\r
+        # --\r
+        key = "UIC_FILES_QDIALOG"\r
+        if self.__thedict__.has_key(key):\r
+            newlines.append('''\r
+            FOREACH(output ${UIC_FILES_QDIALOG} ${UIC_FILES_GDIALOG})\r
+            STRING(REPLACE "ui_" "" input ${output})\r
+            STRING(REPLACE ".hxx" ".ui" input ${input})\r
+            SET(input_path ${CMAKE_CURRENT_SOURCE_DIR}/${input})\r
+            IF (NOT EXISTS ${input_path})\r
+              SET(input_path ${CMAKE_CURRENT_BINARY_DIR}/${input})\r
+            ENDIF (NOT EXISTS ${input_path})\r
+            ADD_CUSTOM_COMMAND(\r
+            OUTPUT ${output}\r
+            COMMAND ${QT_UIC_EXECUTABLE} -o ${output} ${input_path}\r
+            MAIN_DEPENDENCY ${input}\r
+            )\r
+            ENDFOREACH(output ${UIC_FILES})\r
+\r
+            FOREACH(output ${MOC_FILES_QDIALOG} ${MOC_FILES_GDIALOG})\r
+            STRING(REGEX REPLACE _moc.cxx .hxx input ${output})\r
+            SET(input_path ${CMAKE_CURRENT_SOURCE_DIR}/${input})\r
+            IF (NOT EXISTS ${input_path})\r
+              SET(input_path ${CMAKE_CURRENT_BINARY_DIR}/${input})\r
+            ENDIF (NOT EXISTS ${input_path})\r
+            ADD_CUSTOM_COMMAND(\r
+            OUTPUT ${output}\r
+            COMMAND ${QT_MOC_EXECUTABLE} ${MOC_FLAGS} ${input_path} -o ${output}\r
+            MAIN_DEPENDENCY ${input}\r
+            )\r
+            ENDFOREACH(output ${MOC_FILES})\r
+            \r
+            ADD_CUSTOM_COMMAND(\r
+            OUTPUT QDialogTest.ui QDialogTest.hxx QDialogTest.cxx\r
+            COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dlgfactory.py -n QDialogTest -t qdialog\r
+            DEPENDS __QDIALOG__.ui __QDIALOG__.hxx __QDIALOG__.cxx dlgfactory.py\r
+            )\r
+            \r
+            ADD_CUSTOM_COMMAND(\r
+            OUTPUT GDialogTest.ui GDialogTest.hxx GDialogTest.cxx\r
+            COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dlgfactory.py -n GDialogTest -t gdialog\r
+            DEPENDS __GDIALOG__.ui __GDIALOG__.hxx __GDIALOG__.cxx dlgfactory.py\r
+            )\r
+            ''')\r
+            pass\r
+\r
+        # --\r
+        # For make check\r
+        # --\r
+        for key in ["TESTS"]:\r
+            if self.__thedict__.has_key(key):\r
+                newlines.append('''\r
+                SET(UNIT_TEST_PROG ${%s})\r
+                '''%(key))\r
+                self.__thedict__["UNIT_TEST_PROG"] = self.__thedict__[key]\r
+                pass\r
+            pass\r
+        key = "UNIT_TEST_PROG"\r
+        if self.__thedict__.has_key(key):\r
+            newlines.append('''\r
+            FOREACH(input ${UNIT_TEST_PROG})\r
+            GET_FILENAME_COMPONENT(ext ${input} EXT)\r
+            IF(ext STREQUAL .py)\r
+            SET(test ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${input})\r
+            ELSE(ext STREQUAL .py)\r
+            IF(WINDOWS)\r
+            SET(test ${CMAKE_CURRENT_BINARY_DIR}/${input}_exe.exe)\r
+            ELSE()\r
+            SET(test ${CMAKE_CURRENT_BINARY_DIR}/${input}_exe)\r
+            ENDIF()\r
+            ENDIF(ext STREQUAL .py)\r
+            ADD_TEST(${input} ${test})\r
+            SET(fail_regex "KO")\r
+            SET_PROPERTY(TEST ${input} PROPERTY FAIL_REGULAR_EXPRESSION "${fail_regex}")\r
+            # IF(NOT WINDOWS)\r
+            # ADD_TEST(${input}_valgrind valgrind ${test})\r
+            # SET_PROPERTY(TEST ${input}_valgrind PROPERTY FAIL_REGULAR_EXPRESSION "${fail_regex}")\r
+            # SET_PROPERTY(TEST ${input}_valgrind PROPERTY PASS_REGULAR_EXPRESSION "no leaks are possible")\r
+            # ENDIF()\r
+            ENDFOREACH(input ${UNIT_TEST_PROG})\r
+            ''')\r
+            pass\r
+        \r
+        # --\r
+        # Treat the install targets\r
+        # --\r
+        resdir = self.module\r
+        if resdir == "hxx2salome":\r
+            resdir = self.hxxmodule\r
+            pass\r
+        d = {\r
+            "salomeadmux_DATA"                 :  "salome_adm/unix",\r
+            "dist_salomeadmux_DATA"            :  "salome_adm/unix",\r
+            "dist_salome_cmake_DATA"           :  "salome_adm/cmake_files",\r
+            "dist_salomem4_DATA"               :  "salome_adm/unix/config_files",\r
+            "dist_salome4depr_DATA"            :  "salome_adm/unix/config_files/DEPRECATED",\r
+            "dist_admlocalm4_DATA"             :  "adm_local/unix/config_files",\r
+            "dist_admlocal_cmake_DATA"         :  "adm_local/cmake_files",\r
+            "salomeinclude_DATA"               :  "include/salome",\r
+            "salomeinclude_HEADERS"            :  "include/salome",\r
+            "nodist_salomeinclude_HEADERS"     :  "include/salome",\r
+            "dist_salomeres_DATA"              :  "share/salome/resources/%s"%(resdir),\r
+            "nodist_salomeres_DATA"            :  "share/salome/resources/%s"%(resdir),\r
+            "nodist_salomeres_SCRIPTS"         :  "share/salome/resources/%s"%(resdir),\r
+            "dist_salomescript_SCRIPTS"        :  "bin/salome",\r
+            "dist_salomescript_DATA"           :  "bin/salome",\r
+            "dist_salomescript_PYTHON"         :  "bin/salome",\r
+            "dist_appliskel_SCRIPTS"           :  "bin/salome/appliskel",\r
+            "dist_appliskel_PYTHON"            :  "bin/salome/appliskel",\r
+            "nodist_salomescript_DATA"         :  "bin/salome",\r
+            "salomepython_PYTHON"              :  "${salomepythondir}",\r
+            "nodist_salomepython_PYTHON"       :  "${salomepythondir}",\r
+            "dist_salomepython_DATA"           :  "${salomepythondir}",\r
+            "sharedpkgpython_PYTHON"           :  "${salomepythondir}/shared_modules",\r
+            "salomepypkg_PYTHON"               :  "${salomepypkgdir}",\r
+            "mypkgpython_PYTHON"               :  "${mypkgpythondir}",\r
+            "nodist_mypkgpython_PYTHON"        :  "${mypkgpythondir}",\r
+            }\r
+        if self.module == "jobmanager":\r
+            d["bin_SCRIPTS"] = "bin"\r
+            pass\r
+        if self.module == "medfile":\r
+            d = {\r
+                "include_HEADERS"        :  "include",\r
+                "nodist_include_HEADERS" :  "include",\r
+                "bin_SCRIPTS"            :  "bin",\r
+                "doc_DATA"               :  "${docdir}",\r
+                }\r
+            pass\r
+        if self.module == "netgen":\r
+            d = {\r
+                "include_HEADERS"        :  "include",\r
+                "noinst_HEADERS"         :  "share/netgen/include",\r
+                "dist_pkgdata_DATA"      :  "share/netgen",\r
+                "dist_doc_DATA"          :  "share/doc/netgen",\r
+                }\r
+            pass\r
+        # Win32 PPGP porting: custom variable containing tests installation path\r
+        if self.module == "ppgp":\r
+            d["ppgptests"] = "."\r
+            pass\r
+        for key, value in d.items():\r
+            if self.__thedict__.has_key(key):\r
+                self.addInstallTarget(key, value, newlines)\r
+                pass\r
+            pass\r
+        \r
+        # --\r
+        return\r
+    \r
+    def setLibAdd(self, key, newlines):\r
+        # --\r
+        newlines.append(r'''\r
+        SET(libadd)\r
+        ''')\r
+        # --\r
+        newlines.append(r'''\r
+        IF(WINDOWS)\r
+        SET(targets)\r
+        SET(targets ${targets} MEFISTO2D)\r
+        FOREACH(target ${targets})\r
+        IF(name STREQUAL ${target})\r
+        SET(dir $ENV{F2CHOME})\r
+        STRING(REPLACE "\\\\" "/" dir ${dir})\r
+        SET(libadd ${libadd} ${dir}/LIBF77.lib)\r
+        SET(libadd ${libadd} ${dir}/LIBI77.lib)\r
+        ENDIF(name STREQUAL ${target})\r
+        ENDFOREACH(target ${targets})\r
+        ELSE(WINDOWS)\r
+        SET(targets)\r
+        SET(targets ${targets} MEFISTO2D)\r
+        FOREACH(target ${targets})\r
+        IF(name STREQUAL ${target})\r
+        SET(libadd ${libadd} -lf2c)\r
+        ENDIF(name STREQUAL ${target})\r
+        ENDFOREACH(target ${targets})\r
+        ENDIF(WINDOWS)\r
+        ''')\r
+        # --\r
+        newlines.append(r'''\r
+        SET(libs ${PLATFORM_LIBADD} ${PLATFORM_LDFLAGS} ${LDADD} ${${amname}_LIBADD} ${${amname}_LDADD} ${${amname}_LDFLAGS})\r
+        FOREACH(lib SALOMEBasics SalomeBatch)\r
+        IF(name STREQUAL lib)\r
+        SET(libs ${libs} ${PTHREAD_LIBS})\r
+        ENDIF(name STREQUAL lib)\r
+        ENDFOREACH(lib SALOMEBasics SalomeBatch)\r
+        ''')\r
+        # --\r
+        newlines.append(r'''\r
+        FOREACH(lib ${libs})\r
+        GET_FILENAME_COMPONENT(ext ${lib} EXT)\r
+        IF(ext STREQUAL .la)\r
+        GET_FILENAME_COMPONENT(lib ${lib} NAME_WE)\r
+        STRING(REGEX REPLACE "^lib" "" lib ${lib})\r
+        ENDIF(ext STREQUAL .la)\r
+        SET(vars)\r
+        SET(vars ${vars} -no-undefined)\r
+        SET(vars ${vars} -lvtkWidgets)\r
+        IF(WINDOWS)\r
+        SET(vars ${vars} -module)\r
+        SET(vars ${vars} -Wl,-E)\r
+        SET(vars ${vars} -Xlinker)\r
+        SET(vars ${vars} -export-dynamic)\r
+        SET(vars ${vars} -lm)\r
+        SET(vars ${vars} -lboost_thread)\r
+        SET(vars ${vars} -lboost_signals)\r
+        SET(vars ${vars} -pthread -lpthread -ldl)\r
+        ENDIF(WINDOWS)\r
+        FOREACH(v ${vars})\r
+        IF(lib STREQUAL v)\r
+        SET(lib)\r
+        ENDIF(lib STREQUAL v)\r
+        ENDFOREACH(v ${vars})\r
+        SET(test OFF)\r
+        IF(lib)\r
+        STRING(REGEX MATCH "^-lQt" test ${lib})\r
+        ENDIF(lib)\r
+        IF(NOT test)\r
+        SET(libadd ${libadd} ${lib})\r
+        ENDIF(NOT test)\r
+        ENDFOREACH(lib ${libs})\r
+        TARGET_LINK_LIBRARIES(${name} ${libadd})\r
+        ''')\r
+        # --\r
+        newlines.append(r'''\r
+        IF(WINDOWS)\r
+        SET(targets)\r
+        SET(targets ${targets} MEFISTO2D)\r
+        FOREACH(target ${targets})\r
+        IF(name STREQUAL ${target})\r
+        IF(CMAKE_BUILD_TYPE STREQUAL Debug)\r
+        SET_TARGET_PROPERTIES(${name} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:MSVCRT")\r
+        ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)\r
+        ENDIF(name STREQUAL ${target})\r
+        ENDFOREACH(target ${targets})\r
+        ENDIF(WINDOWS)\r
+        ''')\r
+        # --\r
+        return\r
+    \r
+    def setCompilationFlags(self, key, newlines):\r
+        newlines.append(r'''\r
+        SET(var)\r
+        IF(WINDOWS)\r
+        SET(targets)\r
+        SET(targets ${targets} SalomeIDLKernel)\r
+        SET(targets ${targets} SalomeDS)\r
+        SET(targets ${targets} SALOMEDSTest)\r
+        SET(targets ${targets} SALOMEDS_Client_exe)\r
+        SET(targets ${targets} SalomeIDLGEOM)\r
+        SET(targets ${targets} GEOMEngine)\r
+        SET(targets ${targets} MEDEngine)\r
+        SET(targets ${targets} SMESHEngine)\r
+        SET(targets ${targets} SMESH)\r
+        SET(targets ${targets} SalomeIDLSPADDER)\r
+        SET(targets ${targets} MeshJobManagerEngine)\r
+        SET(targets ${targets} StdMeshersEngine)\r
+        SET(targets ${targets} VISUEngineImpl)\r
+        FOREACH(target ${targets})\r
+        IF(name STREQUAL ${target})\r
+        SET(var ${var} -DNOGDI)\r
+        ENDIF(name STREQUAL ${target})\r
+        ENDFOREACH(target ${targets})\r
+        ENDIF(WINDOWS)\r
+        ''')\r
+        # --\r
+        if self.module in ["medfile", "yacs"]:\r
+            newlines.append(r'''\r
+            IF(WINDOWS)\r
+            SET(var ${var} -DNOGDI)\r
+            ENDIF(WINDOWS)\r
+            ''')\r
+            pass\r
+        # --\r
+        newlines.append(r'''\r
+        IF(WINDOWS)\r
+        SET(targets)\r
+        SET(targets ${targets} MEFISTO2D)\r
+        FOREACH(target ${targets})\r
+        IF(name STREQUAL ${target})\r
+        SET(dir $ENV{F2CHOME})\r
+        STRING(REPLACE "\\\\" "/" dir ${dir})\r
+        SET(var ${var} -I${dir})\r
+        SET(var ${var} -DF2C_BUILD)\r
+        ENDIF(name STREQUAL ${target})\r
+        ENDFOREACH(target ${targets})\r
+        ENDIF(WINDOWS)\r
+        ''')\r
+        # --\r
+        if self.module in ["geom", "med"]:\r
+            newlines.append(r'''\r
+            SET(var ${var} -I${CMAKE_CURRENT_SOURCE_DIR})\r
+            SET(var ${var} -I${CMAKE_CURRENT_BINARY_DIR})\r
+            ''')\r
+            pass\r
+        newlines.append(r'''\r
+        SET(var ${var} ${AM_CPPFLAGS})\r
+        SET(var ${var} ${AM_CXXFLAGS})\r
+        ''')\r
+        # --\r
+        newlines.append(r'''\r
+        IF(type STREQUAL STATIC)\r
+        SET(var ${var} -fPIC)\r
+        ENDIF(type STREQUAL STATIC)\r
+        ''')\r
+        # --\r
+        if self.module == "yacs":\r
+            newlines.append(r'''\r
+            SET(var ${var} -DYACS_PTHREAD)\r
+            SET(var ${var} -DCMAKE_BUILD)\r
+            SET(var ${var} -DSALOME_KERNEL)\r
+            SET(var ${var} -DDSC_PORTS)\r
+            SET(var ${var} -DOMNIORB)\r
+            ''')\r
+            pass\r
+        newlines.append(r'''\r
+  SET(var ${var} ${PLATFORM_CPPFLAGS})\r
+  SET(var ${var} ${PTHREAD_CFLAGS})\r
+  SET(var ${var} ${${amname}_CPPFLAGS})\r
+  SET(var ${var} ${${amname}_CXXFLAGS})\r
+  SET(var ${var} ${${amname}_CFLAGS})\r
+        SET(vars)\r
+        IF(WINDOWS)\r
+        SET(vars ${vars} -include SALOMEconfig.h)\r
+        SET(vars ${vars} -ftemplate-depth-32)\r
+        SET(vars ${vars} -fPIC)\r
+        SET(vars ${vars} -g)\r
+        ENDIF(WINDOWS)\r
+        SET(flags)\r
+        FOREACH(f ${var})\r
+        FOREACH(v ${vars})\r
+        IF(f STREQUAL v)\r
+        SET(f)\r
+        ENDIF(f STREQUAL v)\r
+        ENDFOREACH(v ${vars})\r
+        IF(f)\r
+        string(REGEX MATCH "^-I" test_include ${f})\r
+        if(test_include)\r
+        string(REGEX REPLACE "^-I" "" include_dir ${f})\r
+        if(include_dir)\r
+        if(include_dir STREQUAL /usr/include)\r
+        else(include_dir STREQUAL /usr/include)\r
+        string(REGEX MATCH "^\\." test_dot ${include_dir})\r
+        if(test_dot)\r
+        set(include_dir ${CMAKE_CURRENT_BINARY_DIR}/${include_dir})\r
+        endif(test_dot)\r
+        include_directories(${include_dir})\r
+        endif(include_dir STREQUAL /usr/include)\r
+        endif(include_dir)\r
+        else(test_include)\r
+        SET(flags "${flags} ${f}")\r
+        endif(test_include)\r
+        ENDIF(f)\r
+        ENDFOREACH(f ${var})\r
+        SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "${flags}")\r
+        ''')\r
+        return\r
+    \r
+    def addLibTarget(self, key, newlines):\r
+        newlines.append(r'''\r
+        FOREACH(amname ${%s})\r
+        '''%(key))\r
+        # --\r
+        # Replace .la by _la ...\r
+        # --\r
+        newlines.append(r'''\r
+        STRING(REPLACE .la _la amname ${amname})\r
+        ''')\r
+        # --\r
+        # Remove the _la for the cmake name\r
+        # --\r
+        newlines.append(r'''\r
+        STRING(LENGTH ${amname} len)\r
+        MATH(EXPR newlen "${len}-3")\r
+        STRING(SUBSTRING ${amname} 0 ${newlen} name)\r
+        ''')\r
+        # --\r
+        # Does the target begins with lib ??\r
+        # If yes, remove lib at beginning for cmake name\r
+        # --\r
+        newlines.append(r'''\r
+        STRING(REGEX MATCH "^lib" BEGIN_WITH_lib ${name})\r
+        IF(BEGIN_WITH_lib)\r
+        STRING(LENGTH ${name} len)\r
+        MATH(EXPR newlen "${len}-3")\r
+        STRING(SUBSTRING ${name} 3 ${newlen} name)\r
+        ENDIF(BEGIN_WITH_lib)\r
+        ''')\r
+        # --\r
+        # Does the target is an idl library\r
+        # --\r
+        newlines.append(r'''\r
+        STRING(REGEX MATCH "IDL" ISIDL ${name})\r
+        ''')\r
+        # --\r
+        # Set the type of the library\r
+        # --\r
+        newlines.append(r'''\r
+        IF(ISIDL)\r
+        IF(WINDOWS)\r
+        SET(type STATIC)\r
+        ELSE(WINDOWS)\r
+        SET(type SHARED)\r
+        ENDIF(WINDOWS)\r
+        ELSE(ISIDL)\r
+        SET(type SHARED)\r
+        ENDIF(ISIDL)\r
+        ''')\r
+        if key == "noinst_LTLIBRARIES":\r
+            newlines.append(r'''\r
+            IF(WINDOWS)\r
+            SET(type STATIC)\r
+            ELSE(WINDOWS)\r
+            SET(type STATIC)\r
+            ENDIF(WINDOWS)\r
+            ''')\r
+            pass\r
+        # --\r
+        # Set sources for the library\r
+        # --\r
+        newlines.append(r'''\r
+        SET(srcs)\r
+        FOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES})\r
+        GET_FILENAME_COMPONENT(ext ${src} EXT)\r
+        IF(ext STREQUAL .f)\r
+        IF(src STREQUAL trte.f)\r
+        SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${src})\r
+        STRING(REPLACE ".f" ".c" src ${src})\r
+        SET(src ${CMAKE_CURRENT_BINARY_DIR}/${src})\r
+        SET(output ${src})\r
+        SET(cmd f2c)\r
+        IF(NOT WINDOWS)\r
+        IF(CMAKE_SIZEOF_VOID_P STREQUAL 8)\r
+        SET(cmd valgrind f2c)  # f2c seems to be buggy on 64 bits ... but with valgrind, it works :)\r
+        ENDIF()\r
+        ENDIF(NOT WINDOWS)\r
+        ADD_CUSTOM_COMMAND(\r
+        OUTPUT ${output}\r
+        COMMAND ${cmd} ${input}\r
+        MAIN_DEPENDENCY ${input}\r
+        )\r
+        ELSE(src STREQUAL trte.f)\r
+        SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${src})\r
+        STRING(REPLACE ".f" ".o" src ${src})\r
+        SET(src ${CMAKE_CURRENT_BINARY_DIR}/${src})\r
+        SET(output ${src})\r
+        IF(WINDOWS)\r
+        SET(F77 g77)\r
+        ELSE(WINDOWS)\r
+        SET(F77 gfortran)\r
+        ENDIF(WINDOWS)\r
+        ADD_CUSTOM_COMMAND(\r
+        OUTPUT ${output}\r
+        COMMAND ${F77} -c -o ${output} ${input}\r
+        MAIN_DEPENDENCY ${input}\r
+        )\r
+        ENDIF(src STREQUAL trte.f)\r
+        ENDIF(ext STREQUAL .f)\r
+        SET(srcs ${srcs} ${src})\r
+        ENDFOREACH(src ${${amname}_SOURCES} ${dist_${amname}_SOURCES})\r
+        ''')\r
+        newlines.append(r'''\r
+        SET(l ${nodist_${amname}_SOURCES} ${UIC_FILES})\r
+        FOREACH(f ${l})\r
+        SET(src ${CMAKE_CURRENT_BINARY_DIR}/${f})\r
+        SET(srcs ${srcs} ${src})\r
+        ENDFOREACH(f ${l})\r
+        ''')\r
+        newlines.append(r'''\r
+        SET(build_srcs)\r
+        SET(l ${nodist_${amname}_SOURCES} ${BUILT_SOURCES})\r
+        FOREACH(f ${l})\r
+        GET_FILENAME_COMPONENT(ext ${f} EXT)\r
+        IF(ext STREQUAL .py)\r
+        SET(fff)\r
+        ELSE(ext STREQUAL .py)\r
+        SET(fff ${CMAKE_CURRENT_BINARY_DIR}/${f})\r
+        ENDIF(ext STREQUAL .py)\r
+        IF(fff)\r
+        IF(build_srcs)\r
+        LIST(FIND build_srcs ${fff} index)\r
+        IF(NOT index EQUAL -1)\r
+        SET(fff)\r
+        ENDIF(NOT index EQUAL -1)\r
+        ENDIF(build_srcs)\r
+        ENDIF(fff)\r
+        IF(fff)\r
+        SET(build_srcs ${build_srcs} ${fff})\r
+        ENDIF(fff)\r
+        ENDFOREACH(f ${l})\r
+        ''')\r
+        # --\r
+        # Add the library to cmake\r
+        # --\r
+        newlines.append(r'''\r
+        ADD_LIBRARY(${name} ${type} ${srcs})\r
+        ''')\r
+        # --\r
+        # The compilation flags\r
+        # --\r
+        self.setCompilationFlags(key, newlines)\r
+        # --\r
+        newlines.append(r'''\r
+        SET_TARGET_PROPERTIES(${name} PROPERTIES VERSION ${VERSION_INFO} SOVERSION ${SOVERSION_INFO})\r
+        ''')\r
+        # --\r
+        self.setLibAdd(key, newlines)\r
+        # --\r
+        if 1: # key != "noinst_LTLIBRARIES":\r
+            newlines.append(r'''\r
+            SET(key %s)\r
+            '''%(key))\r
+            newlines.append(r'''\r
+            SET(test ON)\r
+            IF(${key} STREQUAL noinst_LTLIBRARIES)\r
+            SET(test OFF)\r
+            ENDIF(${key} STREQUAL noinst_LTLIBRARIES)\r
+            ''')\r
+            if self.module == "netgen" :\r
+                newlines.append(r'''\r
+                IF(${key} STREQUAL noinst_LTLIBRARIES)\r
+                IF(WINDOWS)\r
+                SET(test ON)\r
+                ENDIF(WINDOWS)\r
+                ENDIF(${key} STREQUAL noinst_LTLIBRARIES)\r
+                ''')\r
+                pass\r
+            newlines.append(r'''\r
+            IF(test)\r
+            ''')\r
+            if self.module in ["medfile", "netgen"]:\r
+                newlines.append(r'''\r
+                SET(DEST lib)\r
+                ''')\r
+            elif key == "libparaview_LTLIBRARIES":\r
+                newlines.append(r'''\r
+                SET(DEST lib/paraview)\r
+                ''')                \r
+            else:\r
+                newlines.append(r'''\r
+                SET(DEST lib/salome)\r
+                ''')\r
+                pass\r
+            newlines.append(r'''\r
+            IF(BEGIN_WITH_lib)\r
+            INSTALL(TARGETS ${name} DESTINATION ${DEST})\r
+            ''')\r
+            if self.module == "gui":\r
+                newlines.append(r'''\r
+                FOREACH(lib SalomePyQt)\r
+                IF(name STREQUAL lib)\r
+                IF(WINDOWS)\r
+                IF(CMAKE_BUILD_TYPE STREQUAL Release)\r
+                INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME ${name}.pyd)\r
+                ELSE(CMAKE_BUILD_TYPE STREQUAL Release)\r
+                INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME ${name}_d.pyd)\r
+                ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)\r
+                ELSE(WINDOWS)\r
+                INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so DESTINATION ${DEST} RENAME ${name}.so)\r
+                ENDIF(WINDOWS)\r
+                ENDIF(name STREQUAL lib)\r
+                ENDFOREACH(lib SalomePyQt)\r
+                FOREACH(lib SalomePy)\r
+                IF(name STREQUAL lib)\r
+                IF(WINDOWS)\r
+                IF(CMAKE_BUILD_TYPE STREQUAL Release)\r
+                INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.pyd)\r
+                ELSE(CMAKE_BUILD_TYPE STREQUAL Release)\r
+                INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}_d.pyd)\r
+                ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)\r
+                ENDIF(WINDOWS)\r
+                ENDIF(name STREQUAL lib)\r
+                ENDFOREACH(lib SalomePy)\r
+                ''')\r
+                pass\r
+            if self.module == "geom":\r
+                newlines.append(r'''\r
+                IF(WINDOWS)\r
+                STRING(REGEX MATCH "Export" ISExport ${name})\r
+                IF(ISExport)\r
+                INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.dll)\r
+                ENDIF(ISExport)\r
+                STRING(REGEX MATCH "Import" ISImport ${name})\r
+                IF(ISImport)\r
+                INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.dll DESTINATION ${DEST} RENAME lib${name}.dll)\r
+                ENDIF(ISImport)\r
+                ENDIF(WINDOWS)\r
+                ''')\r
+                pass\r
+            newlines.append(r'''\r
+            ELSE(BEGIN_WITH_lib)\r
+            ''')\r
+            newlines.append(r'''\r
+            IF(WINDOWS)\r
+            INSTALL(TARGETS ${name} DESTINATION ${salomepythondir})\r
+            IF(CMAKE_BUILD_TYPE STREQUAL Release)\r
+            INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${salomepythondir}/${name}.dll DESTINATION ${salomepythondir} RENAME ${name}.pyd)\r
+            ELSE(CMAKE_BUILD_TYPE STREQUAL Release)\r
+            INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${salomepythondir}/${name}.dll DESTINATION ${salomepythondir} RENAME ${name}_d.pyd)\r
+            ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)\r
+            ELSE(WINDOWS)\r
+            GET_TARGET_PROPERTY(version ${name} VERSION)\r
+            GET_TARGET_PROPERTY(soversion ${name} SOVERSION)\r
+            INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so.${version})\r
+            INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so.${soversion})\r
+            INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so)\r
+            ENDIF(WINDOWS)\r
+            ''')\r
+            newlines.append(r'''\r
+            ENDIF(BEGIN_WITH_lib)\r
+            ''')\r
+            newlines.append(r'''\r
+            ENDIF(test)\r
+            ''')\r
+            pass\r
+        # --\r
+        newlines.append(r'''\r
+        ENDFOREACH(amname ${%s})\r
+        '''%(key))\r
+        # --\r
+        return\r
+    \r
+    def addBinTarget(self, key, newlines):\r
+        # --\r
+        newlines.append(r'''\r
+        FOREACH(amname ${%s})\r
+        '''%(key))\r
+        # --\r
+        newlines.append(r'''\r
+        SET(test ON)\r
+        ''')\r
+        if key == "check_PROGRAMS":\r
+            newlines.append(r'''\r
+            IF(bin_PROGRAMS)\r
+            STRING(REGEX MATCH ${amname} is_present ${bin_PROGRAMS})\r
+            IF(is_present)\r
+            SET(test OFF)\r
+            ENDIF(is_present)\r
+            ENDIF(bin_PROGRAMS)\r
+            ''')\r
+            pass\r
+        newlines.append(r'''\r
+        IF(test)\r
+        ''')\r
+        # --\r
+        newlines.append(r'''\r
+        SET(name "${amname}_exe")\r
+        SET(srcs ${${amname}_SOURCES} ${dist_${amname}_SOURCES})\r
+        SET(l ${nodist_${amname}_SOURCES})\r
+        FOREACH(f ${l})\r
+        SET(src ${CMAKE_CURRENT_BINARY_DIR}/${f})\r
+        SET(srcs ${srcs} ${src})\r
+        ENDFOREACH(f ${l})\r
+        LIST(LENGTH srcs nb)\r
+        IF(nb)\r
+        ADD_EXECUTABLE(${name} ${srcs})\r
+        ''')\r
+        # --\r
+        self.setCompilationFlags(key, newlines)\r
+        # --\r
+        self.setLibAdd(key, newlines)\r
+        # --\r
+        if self.module in ["jobmanager", "medfile", "netgen"]:\r
+            newlines.append(r'''\r
+            SET(DEST bin)\r
+            ''')\r
+        else:\r
+            newlines.append(r'''\r
+            SET(DEST bin/salome)\r
+            ''')\r
+            pass\r
+        # --\r
+        if key == "bin_PROGRAMS":\r
+            newlines.append(r'''\r
+            IF(WINDOWS)\r
+            INSTALL(TARGETS ${name} DESTINATION ${DEST})\r
+            INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe DESTINATION ${DEST} RENAME ${amname}.exe)\r
+            INSTALL(CODE "FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${name}.exe)")\r
+            ELSE(WINDOWS)\r
+            SET(PERMS)\r
+            SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)\r
+            SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)\r
+            SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)\r
+            INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${name} DESTINATION ${DEST} PERMISSIONS ${PERMS} RENAME ${amname})\r
+            ENDIF(WINDOWS)\r
+            ''')\r
+            pass\r
+        # --\r
+        newlines.append(r'''\r
+        ENDIF(nb)\r
+        ''')\r
+        # --\r
+        newlines.append(r'''\r
+        ENDIF(test)\r
+        ''')\r
+        newlines.append(r'''\r
+        ENDFOREACH(amname ${%s})\r
+        '''%(key))\r
+        # --\r
+        return\r
+    \r
+    def addInstallTarget(self, key, destination, newlines):\r
+        newlines.append(r"FOREACH(f ${%s})"%(key))\r
+        newlines.append(r'''\r
+        SET(DEST %s)\r
+        '''%(destination))\r
+        newlines.append(r'''\r
+        STRING(COMPARE EQUAL ${f} SALOMEconfig.h.in test_SALOMEconfig.h.in)\r
+        IF(test_SALOMEconfig.h.in)\r
+        INSTALL(FILES SALOMEconfig.ref.in DESTINATION ${DEST} RENAME SALOMEconfig.h.in)\r
+        ELSE(test_SALOMEconfig.h.in)\r
+        SET(dummy dummy-NOTFOUND)\r
+        MARK_AS_ADVANCED(dummy)\r
+        # FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEST}/${f})\r
+        FIND_FILE(dummy ${f} PATHS ${CMAKE_CURRENT_SOURCE_DIR} NO_DEFAULT_PATH)\r
+        IF(dummy)\r
+        ''')\r
+        if key in ['dist_salomescript_SCRIPTS',\r
+                   'dist_appliskel_SCRIPTS',\r
+                   'dist_appliskel_PYTHON']:\r
+            newlines.append(r'''\r
+            SET(PERMS)\r
+            SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)\r
+            SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)\r
+            SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)\r
+            INSTALL(FILES ${f} DESTINATION ${DEST} PERMISSIONS ${PERMS})\r
+            ''')\r
+        # Win32 PPGP porting\r
+        elif key == 'ppgptests':\r
+            newlines.append(r'''\r
+            SET(PERMS)\r
+            SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)\r
+            SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)\r
+            SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)\r
+            INSTALL(DIRECTORY ${f} DESTINATION ${DEST} FILE_PERMISSIONS ${PERMS} PATTERN "CVS" EXCLUDE)\r
+            ''')\r
+        else:\r
+            newlines.append(r'''\r
+            GET_FILENAME_COMPONENT(ext ${f} EXT)\r
+            IF(ext STREQUAL .py)\r
+            IF(DEST STREQUAL bin/salome)\r
+            SET(PERMS)\r
+            SET(PERMS ${PERMS} OWNER_READ OWNER_WRITE OWNER_EXECUTE)\r
+            SET(PERMS ${PERMS} GROUP_READ GROUP_EXECUTE)\r
+            SET(PERMS ${PERMS} WORLD_READ WORLD_EXECUTE)\r
+            INSTALL(FILES ${f} DESTINATION ${DEST} PERMISSIONS ${PERMS})\r
+            ELSE(DEST STREQUAL bin/salome)\r
+            INSTALL(FILES ${f} DESTINATION ${DEST})\r
+            ENDIF(DEST STREQUAL bin/salome)\r
+            ELSE(ext STREQUAL .py)\r
+            INSTALL(FILES ${f} DESTINATION ${DEST})\r
+            ENDIF(ext STREQUAL .py)\r
+            ''')\r
+            pass\r
+        newlines.append(r'''\r
+        ELSE(dummy)\r
+        GET_FILENAME_COMPONENT(ext ${f} EXT)\r
+        IF(ext STREQUAL .qm)\r
+        STRING(REGEX REPLACE .qm .ts input ${f})\r
+        ''')\r
+        if self.module in ["kernel", "gui", "yacs"]:\r
+            newlines.append(r'''\r
+            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/resources/${input})\r
+            ''')\r
+        else:\r
+            newlines.append(r'''\r
+            SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input})\r
+            ''')\r
+            pass\r
+        newlines.append(r'''\r
+        SET(output ${CMAKE_CURRENT_BINARY_DIR}/${f})\r
+        # ADD_CUSTOM_COMMAND(\r
+        # OUTPUT ${output}\r
+        # COMMAND ${QT_LRELEASE_EXECUTABLE} ${input} -qm ${output}\r
+        # MAIN_DEPENDENCY ${input}\r
+        # )\r
+        EXECUTE_PROCESS(COMMAND ${QT_LRELEASE_EXECUTABLE} ${input} -qm ${output})\r
+        ENDIF(ext STREQUAL .qm)\r
+        INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${f} DESTINATION ${DEST})\r
+        ENDIF(dummy)\r
+        ENDIF(test_SALOMEconfig.h.in)\r
+        ''')\r
+        newlines.append(r'''\r
+        GET_FILENAME_COMPONENT(ext ${f} EXT)\r
+        IF(ext STREQUAL .py)\r
+        INSTALL(CODE "SET(PYTHON_FILE ${f})")\r
+        INSTALL(CODE "SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})")\r
+        INSTALL(CODE "SET(DEST ${DEST})")\r
+        INSTALL(CODE "SET(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})")\r
+        ''')\r
+        if self.module == "kernel":\r
+            newlines.append('''\r
+            IF(f STREQUAL SALOME_ContainerPy.py)\r
+            ELSE(f STREQUAL SALOME_ContainerPy.py)\r
+            IF(f STREQUAL am2cmake.py)\r
+            ELSE(f STREQUAL am2cmake.py)\r
+            INSTALL(SCRIPT ${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/install_and_compile_python_file.cmake)\r
+            ENDIF(f STREQUAL am2cmake.py)\r
+            ENDIF(f STREQUAL SALOME_ContainerPy.py)\r
+            ''')\r
+        else:\r
+            newlines.append('''\r
+            STRING(REPLACE "\\\\" "/" KERNEL_ROOT_DIR ${KERNEL_ROOT_DIR})\r
+            INSTALL(SCRIPT ${KERNEL_ROOT_DIR}/salome_adm/cmake_files/install_and_compile_python_file.cmake)\r
+            ''')\r
+            pass\r
+        newlines.append(r'''\r
+        ENDIF(ext STREQUAL .py)\r
+        ''') \r
+        newlines.append(r"ENDFOREACH(f ${%s})"%(key))\r
+        return\r
+    \r
+    def writeListsFile(self):\r
+        f = open(self.listsFile, "w")\r
+        f.write(self.content)\r
+        f.close()\r
+        return\r
+\r
+    def writeEnvScript(self, upmod):\r
+        from sys import platform, version_info\r
+        p_version = """%s.%s"""%(version_info[0],version_info[1])\r
+        python_path ="PYTHONPATH"\r
+        path = ""\r
+        begin = ""\r
+        end = ""\r
+        delim = ""\r
+        cmd = ""\r
+        pdir = ""\r
+        omni = ""\r
+       omni_py = ""\r
+        if platform == "win32" :               \r
+            path = "PATH"\r
+            begin = "%"\r
+            end = "%"\r
+            delim = ";"\r
+            cmd = "@SET "\r
+            omni = "/x86_win32"\r
+            omni_py = "/python"\r
+            pdir = "PDIR"\r
+        else:\r
+            path = "LD_LIBRARY_PATH"\r
+            begin = "\${"\r
+            end = "}"\r
+            delim = ":"\r
+            cmd = "export "\r
+            omni_py = "/python" + p_version + "/" + "site-packages"\r
+            pdir = "INST_ROOT"\r
+\r
+            \r
+        path_ = begin + path + end\r
+        root_dir_ = begin + upmod + "_ROOT_DIR" + end  \r
+        python_path_ = begin + python_path + end\r
+        _python_path_ = delim + python_path_+ "\n"\r
+        _path_ = delim + path_+ "\n" \r
+        _pdir = begin + pdir + end \r
+           \r
+        \r
+        script = cmd + " " + python_path + "=" + root_dir_+"/lib/python" + p_version \\r
+        + "/site-packages/salome" + _python_path_ \r
+        \r
+        script = script + cmd + " " + python_path + "=" + root_dir_+"/bin/salome" + \\r
+        _python_path_\r
+\r
+        script = script + cmd + " "+ path + "=" + root_dir_+"/lib/salome"+ _path_\r
+\r
+       if upmod == "KERNEL" :\r
+            script = script + cmd + " " +  python_path + "=" + _pdir + \\r
+            "/omniORB-4.1.5/lib" + omni + _python_path_\r
+        \r
+            script = script + cmd + " " + python_path + "=" + _pdir + \\r
+            "/omniORB-4.1.5/lib" + omni_py + _python_path_\r
+        \r
+            script = script + cmd + " "+ path + "=" + _pdir+ "/omniORB-4.1.5/lib" + \\r
+            omni + _path_\r
+\r
+        if upmod == "GEOM" :\r
+            script = self.writeEnvScript("KERNEL") + script\r
+            script = self.writeEnvScript("GUI") + script\r
+\r
+        if upmod == "SMESH" :\r
+            script = self.writeEnvScript("GEOM") + script\r
+\r
+        return script    \r
+    pass\r
+\r
+def convertAmFile(the_root, root, dirs, files, f, module):\r
+    cmake = CMakeFile(the_root, root, dirs, files, f, module)\r
+    cmake.writeListsFile()\r
+    return\r
+\r
+def usage(exit_status):\r
+    from sys import exit\r
+    from sys import argv\r
+    print "Usage: %s --module"%(argv[0])\r
+    exit(exit_status)\r
+    return\r
+\r
+if __name__ == "__main__":\r
+    #\r
+    from sys import argv\r
+    if len(argv) != 2:\r
+        usage(1)\r
+        pass\r
+    #\r
+    module = argv[1]\r
+    if module.find('--') != 0:\r
+        usage(1)\r
+        pass\r
+    module = module[2:]\r
+    if len(module) == 0:\r
+        usage(1)\r
+        pass\r
+    #\r
+    from os import getcwd\r
+    the_root = getcwd()\r
+    #\r
+    nok = 0\r
+    #\r
+    from os import getenv\r
+    from os import walk\r
+    for root, dirs, files in walk(the_root):\r
+        # --\r
+        # E.A. : Remove 'CVS' in dirs\r
+        # E.A. : It allows to not recurse in CVS dirs\r
+        # E.A. : See os module python documentation\r
+        # --\r
+        try:\r
+            dirs.remove('CVS')\r
+        except ValueError:\r
+            pass\r
+        # --\r
+        if "Makefile.am.cmake" in files:\r
+            if "Makefile.am" in files:\r
+                files.remove("Makefile.am")\r
+                pass\r
+            pass\r
+        # --\r
+        for f in files:\r
+            if f in ["Makefile.am", "Makefile.am.cmake"]:\r
+                convert = True\r
+                if getenv("AM2CMAKE_FORCE_GENERATION", "0")=="0":\r
+                    # detect if conversion should be done\r
+                    if "CMakeLists.txt" in files:\r
+                        from os.path import join\r
+                        ff = open(join(root, "CMakeLists.txt"))\r
+                        content = ff.read()\r
+                        ff.close()\r
+                        if content.find("generated by am2cmake") == -1:\r
+                            convert = False\r
+                            pass\r
+                        pass                       \r
+                    pass\r
+                if convert:\r
+                    convertAmFile(the_root, root, dirs, files, f, module)\r
+                    nok += 1\r
+                pass\r
+            pass\r
+        pass\r
+    #\r
+    from sys import stdout\r
+    if nok:\r
+        if nok == 1:\r
+            msg = "%s file has been converted to cmake"%(nok)\r
+        else:\r
+            msg = "%s files have been converted to cmake"%(nok)\r
+            pass\r
+        stdout.write(msg)\r
+        stdout.write("\n")\r
+        stdout.flush()\r
+        pass\r
+    pass\r