diff --git a/cmake/GaudiProjectConfig.cmake b/cmake/GaudiProjectConfig.cmake
index 101b228df44db07d79b1e6def21fa0a17c2e538b..244de896bac445faf96af7b978899f647e86b256 100644
--- a/cmake/GaudiProjectConfig.cmake
+++ b/cmake/GaudiProjectConfig.cmake
@@ -700,8 +700,8 @@ macro(gaudi_project project version)
         file(WRITE ${CMAKE_BINARY_DIR}/python/${pypack}/__init__.py "
 import os, sys
 __path__ = [d for d in [os.path.join(os.path.realpath(d), '${pypack}') for d in sys.path if d]
-            if (d.startswith('${CMAKE_BINARY_DIR}') or
-                d.startswith('${CMAKE_SOURCE_DIR}')) and
+            if (d.startswith(os.path.realpath('${CMAKE_BINARY_DIR}')) or
+                d.startswith(os.path.realpath('${CMAKE_SOURCE_DIR}'))) and
                (os.path.exists(d) or 'python.zip' in d)]
 if os.path.exists('${CMAKE_SOURCE_DIR}/${package}/python/${pypack}/__init__.py'):
     execfile('${CMAKE_SOURCE_DIR}/${package}/python/${pypack}/__init__.py')