diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4778d73b74494f142418602be52c5123a4d7af0..4fea37413fbb8ab6d5dd24bb07e74481bbd42c30 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,6 @@ message (STATUS "***** Configuring CxRoot/CONEX version")
 set (MODEL_HEADERS
   src/conexConfig.h
   src/conexHEModels.h
-  ${CMAKE_CURRENT_BINARY_DIR}/src/conexConfigAuto.h
   )
 
 
@@ -28,14 +27,27 @@ else (TARGET CorsikaData)
   add_subdirectory (${TABDIR} tabs)
 endif (TARGET CorsikaData)
 
+# we need two version of conexConfigAuto.h. One for the build and one for install area.
+# build version:
 set (CFG_CONEX_CONFIG_PATH "${CMAKE_CURRENT_BINARY_DIR}/cfg/")
 configure_file (src/conexConfigAuto.h.in src/conexConfigAuto.h) 
+# install version:
+set (CFG_CONEX_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/share/corsika/cfg/")
+configure_file (src/conexConfigAuto.h.in
+  ${CMAKE_CURRENT_BINARY_DIR}/src/conexConfigAuto_install.h
+  )
+install (
+  FILES ${CMAKE_CURRENT_BINARY_DIR}/src/conexConfigAuto_install.h 
+  RENAME conexConfigAuto.h 
+  DESTINATION include/corsika_modules/conex/
+  )
 
 
 #+++++++++++++++++++++++++++++
 # Config file generation
+# Note: if we also copy/relocate TABDIR we have to rething this, too:
 #
-file (GLOB CONFIG_FILES "${PROJECT_SOURCE_DIR}/src/*.paramin")
+file (GLOB CONFIG_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.paramin")
 
 foreach (CONFIG_FILE_ABS ${CONFIG_FILES})
   get_filename_component (CONFIG_FILE ${CONFIG_FILE_ABS} NAME)
@@ -43,7 +55,7 @@ foreach (CONFIG_FILE_ABS ${CONFIG_FILES})
   message (STATUS "==[make]==> generating cfg/${CONFIG_OUT} from : src/${CONFIG_FILE}")
   set (CONEXTABROOT ${TABDIR})
   set (BZ2 ".bz2")
-  configure_file (src/${CONFIG_FILE} cfg/${CONFIG_OUT})
+  configure_file (src/${CONFIG_FILE} ${CMAKE_CURRENT_BINARY_DIR}/cfg/${CONFIG_OUT})
 endforeach ()
 
 
@@ -148,4 +160,7 @@ install (
   DESTINATION include/corsika_modules/conex
   )
 
-
+install (
+  DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cfg
+  DESTINATION share/corsika
+  )