]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Fix problem with the PY compiling: names of targets in some cases are not unique
authorana <ana@opencascade.com>
Wed, 17 Jun 2015 15:20:58 +0000 (18:20 +0300)
committerana <ana@opencascade.com>
Wed, 17 Jun 2015 15:20:58 +0000 (18:20 +0300)
salome_adm/cmake_files/SalomeMacros.cmake

index 557a5a548d5f38e489ddac782562d87986e9922d..0463a8a3645e3022a65bfb1325311a9ceb803f91 100644 (file)
@@ -125,7 +125,7 @@ MACRO(SALOME_INSTALL_SCRIPTS file_list path)
     INSTALL(FILES ${PREFIX}${file} DESTINATION ${path} PERMISSIONS ${PERMS})
     GET_FILENAME_COMPONENT(ext ${file} EXT)
     GET_FILENAME_COMPONENT(we_ext ${file} NAME_WE)
-    GET_FILENAME_COMPONENT(single_dir ${CMAKE_CURRENT_SOURCE_DIR} NAME_WE) 
+
     IF(ext STREQUAL .py)    
       # Generate and install the pyc and pyo
       # [ABN] Important: we avoid references or usage of CMAKE_INSTALL_PREFIX which is not correctly set 
@@ -150,15 +150,21 @@ MACRO(SALOME_INSTALL_SCRIPTS file_list path)
       INSTALL(FILES ${_pyc_file} DESTINATION ${path} PERMISSIONS ${PERMS})
       INSTALL(FILES ${_pyo_file} DESTINATION ${path} PERMISSIONS ${PERMS})
     ENDIF(ext STREQUAL .py)
+
+  # get relativa path (from CMAKE_SOURCE_DIR to CMAKE_CURRENT_SOURCE_DIR)
+  STRING(REGEX REPLACE ${CMAKE_SOURCE_DIR} "" rel_dir ${CMAKE_CURRENT_SOURCE_DIR})
+  # convert "/" to "_"
+  STRING(REGEX REPLACE "/" "_" unique_name ${rel_dir})
+
   ENDFOREACH(file ${file_list})
   # Generate only one target for all requested Python script compilation.
   # Make sure that the target name is unique too. 
   IF(_all_pyc)
      SET(_cnt 0)
-     WHILE(TARGET "PYCOMPILE_${single_dir}_${_cnt}")
+     WHILE(TARGET "PYCOMPILE${unique_name}_${_cnt}")
        MATH(EXPR _cnt ${_cnt}+1)
      ENDWHILE()
-     ADD_CUSTOM_TARGET("PYCOMPILE_${single_dir}_${_cnt}" ALL DEPENDS ${_all_pyc} ${_all_pyo})
+     ADD_CUSTOM_TARGET("PYCOMPILE${unique_name}_${_cnt}" ALL DEPENDS ${_all_pyc} ${_all_pyo})
   ENDIF()
 ENDMACRO(SALOME_INSTALL_SCRIPTS)