-# Temporary backward compatibility:
-SET(VERSION ${${PROJECT_NAME_UC}_VERSION})
-SET(XVERSION 0x0${${PROJECT_NAME_UC}_MAJOR_VERSION}0${${PROJECT_NAME_UC}_MINOR_VERSION}0${${PROJECT_NAME_UC}_PATCH_VERSION})
-SET(VERSION_DEV "0")
+SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
+
+#
+# Kernel detection comes before user options to be
+# able to take previous values of global options ...
+#
+SET(_default_MPI OFF)
+IF(NOT SALOME_MED_STANDALONE)
+ SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL")
+ IF(EXISTS ${KERNEL_ROOT_DIR})
+ LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
+ INCLUDE(SalomeMacros)
+ FIND_PACKAGE(SalomeKERNEL REQUIRED)
+ ADD_DEFINITIONS(${KERNEL_DEFINITIONS})
+ INCLUDE_DIRECTORIES(${KERNEL_INCLUDE_DIRS})
+ SET(_default_MPI ${SALOME_USE_MPI})
+ ELSE(EXISTS ${KERNEL_ROOT_DIR})
+ MESSAGE(FATAL_ERROR "We absolutely need a Salome KERNEL, please define KERNEL_ROOT_DIR or turn option SALOME_MED_STANDALONE to ON !")
+ ENDIF(EXISTS ${KERNEL_ROOT_DIR})
+ LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files")
+ELSE(NOT SALOME_MED_STANDALONE)
+ LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm_local_without_kernel/cmake_files")
+ INCLUDE(SalomeMacros)
+ENDIF(NOT SALOME_MED_STANDALONE)