diff --git a/Build/AtlasCMake/modules/AtlasFunctions.cmake b/Build/AtlasCMake/modules/AtlasFunctions.cmake
index 68067eab2746f5b841283555838a47a3496b79c6..bfc2e4ca3a5aa6f3ff103a639ef9d890f86fcd1f 100644
--- a/Build/AtlasCMake/modules/AtlasFunctions.cmake
+++ b/Build/AtlasCMake/modules/AtlasFunctions.cmake
@@ -1,6 +1,6 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
-# $Id: AtlasFunctions.cmake 746543 2016-05-12 11:31:22Z krasznaa $
+# $Id: AtlasFunctions.cmake 753396 2016-06-07 15:36:05Z krasznaa $
 #
 # This is the main file that needs to be included in order to get access to the
 # ATLAS CMake functions.
@@ -79,6 +79,10 @@ function( atlas_project name version )
    # Do not set any rpath values on any of the files:
    set( CMAKE_SKIP_RPATH ON )
    set( CMAKE_SKIP_RPATH ON PARENT_SCOPE )
+   set( CMAKE_SKIP_BUILD_RPATH ON )
+   set( CMAKE_SKIP_BUILD_RPATH ON PARENT_SCOPE )
+   set( CMAKE_SKIP_INSTALL_RPATH ON )
+   set( CMAKE_SKIP_INSTALL_RPATH ON PARENT_SCOPE )
 
    # Do not consider the includes associated with imported targets as system
    # includes. System includes on imported targets are explicitly marked as
@@ -317,6 +321,13 @@ function( atlas_project name version )
          list( GET _bases 0 _base_project )
          list( GET _bases 1 _base_version )
          list( REMOVE_AT _bases 0 1 )
+         # Make sure that the project version is a regular version number:
+         if( NOT _base_version MATCHES "^[0-9]+[0-9.]*" )
+            # Let's not specify a version in this case...
+            message( STATUS "Using base project \"${_base_project}\" without "
+               "its \"${_base_version}\" version name/number" )
+            set( _base_version )
+         endif()
          # Find the base release:
          find_package( ${_base_project} ${_base_version} QUIET )
          # Remember what projects, and what exact versions we found:
@@ -372,6 +383,13 @@ function( atlas_project name version )
          list( GET _bases ${_projNameIdx} _base_project )
          list( GET _bases ${_projVersIdx} _base_version )
          list( REMOVE_AT _bases ${_projNameIdx} ${_projVersIdx} )
+         # Make sure that the project version is a regular version number:
+         if( NOT _base_version MATCHES "^[0-9]+[0-9.]*" )
+            # Let's not specify a version in this case...
+            message( STATUS "Using base project \"${_base_project}\" without "
+               "its \"${_base_version}\" version name/number" )
+            set( _base_version )
+         endif()
          # Find the base release:
          find_package( ${_base_project} ${_base_version}
             COMPONENTS ${_include_mode} QUIET )
@@ -664,6 +682,19 @@ function( atlas_project name version )
    if( "$ENV{NICOS_PROJECT_RELNAME_COPY}" STREQUAL "" )
       set( ENV{NICOS_PROJECT_RELNAME_COPY} "private" )
    endif()
+   if( "$ENV{NICOS_VAL_MODE}" STREQUAL "" )
+      set( ENV{NICOS_VAL_MODE} "None" )
+   endif()
+   if( "$ENV{NICOS_ATLAS_ALT_RELEASE}" STREQUAL "" )
+      set( ENV{NICOS_ATLAS_ALT_RELEASE} "None" )
+   endif()
+   if( "$ENV{NICOS_JOBID}" STREQUAL "" )
+      set( ENV{NICOS_JOBID} "0000" )
+   endif()
+   if( "$ENV{gcc_version}" STREQUAL "" )
+      set( ENV{gcc_version}
+         "${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}" )
+   endif()
 
    # And now generate/install the ReleaseData file:
    find_file( _releaseData ReleaseData.in
@@ -675,24 +706,32 @@ function( atlas_project name version )
    install( FILES ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}/ReleaseData
       DESTINATION . )
 
+   # Check if Doxygen is available. With a minimum version.
+   find_package( Doxygen 1.8.9.1 )
+
    # Create a Doxyfile for the project:
+   # We should be setting up CMAKE_INPUT_TAGFILES here...
    set( CMAKE_OUTPUT_TAGFILE
-      ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}/${CMAKE_PROJECT_NAME}.tag )
+      ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}/doc/${CMAKE_PROJECT_NAME}.tag )
+   install( FILES
+      ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}/doc/${CMAKE_PROJECT_NAME}.tag
+      DESTINATION doc OPTIONAL )
    find_file( _doxyfile Doxyfile.in
       PATH_SUFFIXES skeletons PATHS ${CMAKE_MODULE_PATH} )
    configure_file( ${_doxyfile} ${CMAKE_BINARY_DIR}/Doxyfile @ONLY )
    mark_as_advanced( _doxyfile )
 
-   # Check if Doxygen is available. With a minimum version.
-   find_package( Doxygen 1.8.9.1 )
-
-   # If yes, set up a target with it:
+   # If Doxygen is available, set up a target with it:
    if( DOXYGEN_FOUND )
       message( STATUS "Creating the \"doc\" target" )
       add_custom_target( doc
-         COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
+         COMMAND ${CMAKE_BINARY_DIR}/atlas_build_run.sh
+         ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
          WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
          COMMENT "Generating the Doxygen documentation" )
+      # Also set up an installation rule for the files created by this rule:
+      install( DIRECTORY ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}/doc
+         DESTINATION . USE_SOURCE_PERMISSIONS OPTIONAL )
    endif()
 
    # Set up all project-wide operations, which come after all the packages
@@ -1331,6 +1370,10 @@ function( atlas_add_test testName )
       # Allow wildcards in the source names:
       file( GLOB _sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
          ${ARG_SOURCES} )
+      if( NOT _sources )
+         message( WARNING "No sources available for test ${testName}" )
+         return()
+      endif()
 
       # Put the files into source groups. So they would show up in a ~reasonable
       # way in an IDE like Xcode:
diff --git a/Build/AtlasCMake/modules/AtlasInternals.cmake b/Build/AtlasCMake/modules/AtlasInternals.cmake
index a7f799242cbca7d71b4ac496ec682197b970b4bf..e2c6559038948fa3e908f8434b3d9c0874c97109 100644
--- a/Build/AtlasCMake/modules/AtlasInternals.cmake
+++ b/Build/AtlasCMake/modules/AtlasInternals.cmake
@@ -1,6 +1,6 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
-# $Id: AtlasInternals.cmake 744659 2016-05-03 20:18:40Z krasznaa $
+# $Id: AtlasInternals.cmake 751680 2016-06-02 08:25:55Z krasznaa $
 #
 # Functions used internally by functions declared in AtlasFunctions.
 # Which are for general use inside the package descriptions.
@@ -836,7 +836,8 @@ macro( atlas_external_module )
             NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH
             ${ARG_EXTRA_OPTIONS} )
          # Deal with the search result:
-         if( ${nameUpper}_${component}_LIBRARY )
+         if( ${nameUpper}_${component}_LIBRARY AND
+               EXISTS "${${nameUpper}_${component}_LIBRARY}" )
             set( ${nameUpper}_${component}_FOUND TRUE )
             list( APPEND ${nameUpper}_FOUND_COMPONENTS ${component} )
             list( APPEND ${nameUpper}_LIBRARIES
diff --git a/Build/AtlasCMake/modules/AtlasLibraryFunctions.cmake b/Build/AtlasCMake/modules/AtlasLibraryFunctions.cmake
index a2b4988caaefdd7853b603d485104209935ba3e5..485b9f4eb6a8a9fe1ffcdd439861dba3c9c964b2 100644
--- a/Build/AtlasCMake/modules/AtlasLibraryFunctions.cmake
+++ b/Build/AtlasCMake/modules/AtlasLibraryFunctions.cmake
@@ -1,6 +1,6 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
-# $Id: AtlasLibraryFunctions.cmake 744366 2016-05-03 07:50:36Z krasznaa $
+# $Id: AtlasLibraryFunctions.cmake 749913 2016-05-26 15:04:41Z krasznaa $
 #
 # This file collects the ATLAS CMake helper functions that set up the build and
 # installation of all the different kinds of libraries that we create in offline
@@ -384,7 +384,7 @@ function( atlas_add_component libName )
       "LINK_LIBRARIES" ${ARGN} )
 
    # We need Gaudi for this:
-   find_package( Gaudi REQUIRED )
+   find_package( Gaudi QUIET )
 
    # Get this package's name:
    atlas_get_package_name( pkgName )
@@ -393,16 +393,25 @@ function( atlas_add_component libName )
    atlas_get_package_dir( pkgDir )
 
    # Build a library using the athena_add_library function:
-   atlas_add_library( ${libName} ${ARG_UNPARSED_ARGUMENTS}
-      NO_PUBLIC_HEADERS MODULE
-      LINK_LIBRARIES ${ARG_LINK_LIBRARIES} GaudiPluginService )
+   if( GAUDI_FOUND )
+      atlas_add_library( ${libName} ${ARG_UNPARSED_ARGUMENTS}
+         NO_PUBLIC_HEADERS MODULE
+         LINK_LIBRARIES ${ARG_LINK_LIBRARIES} GaudiPluginService )
+   else()
+      # If Gaudi is not available, then just build the library,
+      # and don't do anything else.
+      atlas_add_library( ${libName} ${ARG_UNPARSED_ARGUMENTS}
+         NO_PUBLIC_HEADERS MODULE
+         LINK_LIBRARIES ${ARG_LINK_LIBRARIES} )
+      return()
+   endif()
 
    # If we are in "release mode" and the library doesn't need to be
    # recompiled, then let's not bother with the rest.
    if( ATLAS_RELEASE_MODE AND NOT ATLAS_PACKAGE_RECOMPILE )
       return()
    endif()
-
+   
    # Generate a .components file from the library:
    atlas_generate_componentslist( ${libName} )
 
@@ -871,6 +880,12 @@ endfunction( atlas_generate_componentslist )
 #
 function( atlas_generate_cliddb libName )
 
+   # Don't do anything here in standalone build mode:
+   find_package( Gaudi QUIET )
+   if( NOT GAUDI_FOUND )
+      return()
+   endif()
+
    # Get this package's name:
    atlas_get_package_name( pkgName )
 
diff --git a/Build/AtlasCMake/modules/FindGaudi.cmake b/Build/AtlasCMake/modules/FindGaudi.cmake
index 41a88d9c7941c2617f7f33b16a183c1974ba6bf1..67ab62aa24a0a0167139d4bc48f989b6abcecf55 100644
--- a/Build/AtlasCMake/modules/FindGaudi.cmake
+++ b/Build/AtlasCMake/modules/FindGaudi.cmake
@@ -1,6 +1,6 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
-# $Id: FindGaudi.cmake 734809 2016-04-08 10:37:12Z krasznaa $
+# $Id: FindGaudi.cmake 753396 2016-06-07 15:36:05Z krasznaa $
 #
 # CMake script attempting to find a Gaudi installation that we can build
 # the offline code against. Without making any use of the CMake code
@@ -25,8 +25,8 @@ endif()
 if( NOT GAUDI_ROOT )
    if( NOT "$ENV{GAUDI_ROOT}" STREQUAL "" )
       set( GAUDI_ROOT $ENV{GAUDI_ROOT} )
-   else()
-      message( SEND_ERROR "GAUDI_ROOT not set" )
+   elseif( NOT Gaudi_FIND_QUIETLY )
+      message( WARNING "GAUDI_ROOT not set" )
       return()
    endif()
 endif()
@@ -127,11 +127,15 @@ set_target_properties( genconf PROPERTIES
 # Set up the RPM dependency for Gaudi:
 if( GAUDI_VERSION )
    set( version ${GAUDI_VERSION} )
-elseif( ENV{GAUDI_VERSION} )
+elseif( NOT "$ENV{GAUDI_VERSION}" STREQUAL "" )
    set( version $ENV{GAUDI_VERSION} )
+elseif( PROJECT_VERSION )
+   # This should kick in when building a release with NICOS:
+   set( version ${PROJECT_VERSION} )
 else()
-   set( version "21.0.0" )
+   set( version "${CMAKE_PROJECT_VERSION}" )
 endif()
 set_property( GLOBAL APPEND PROPERTY ATLAS_EXTERNAL_RPMS
    "GAUDI_${version}_${ATLAS_PLATFORM}" )
+message( "Added dependency: GAUDI_${version}_${ATLAS_PLATFORM}" )
 unset( version )
diff --git a/Build/AtlasCMake/modules/scripts/atlas_ctest.sh.in b/Build/AtlasCMake/modules/scripts/atlas_ctest.sh.in
index 45b7a478638141ba7bfcd1f3b7a45b17117d4059..9a90bf088336c36d5c2c25dfdebb986d3a513355 100755
--- a/Build/AtlasCMake/modules/scripts/atlas_ctest.sh.in
+++ b/Build/AtlasCMake/modules/scripts/atlas_ctest.sh.in
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# $Id: atlas_ctest.sh.in 725483 2016-02-22 12:38:45Z krasznaa $
+# $Id: atlas_ctest.sh.in 749821 2016-05-26 09:52:35Z krasznaa $
 #
 # This is a custom wrapper around the ctest command, to enable us to
 # capure the full build log of the individual packages.
@@ -56,5 +56,12 @@ echo "# CMake ---> $*" >> ${LOG_DIR}/${LOG_FILE}
 # to the specified log file. Note that the exit status of the actual command
 # is not in $? in the end. As that's populated by the exit status of the tee
 # command...
-@CMAKE_CTEST_COMMAND@ ${CMD_LINE_ARGS} 2>&1 | tee -a ${LOG_DIR}/${LOG_FILE}; \
-    test ${PIPESTATUS[0]} -eq 0
+@CMAKE_CTEST_COMMAND@ ${CMD_LINE_ARGS} 2>&1 | tee -a ${LOG_DIR}/${LOG_FILE}
+
+# Check if the command succeeded:
+returnCode=${PIPESTATUS[0]}
+if [ ${returnCode} != 0 ]; then
+    echo "error: Failed to execute $* (return code: ${returnCode})" \
+        >> ${LOG_DIR}/${LOG_FILE}
+    exit ${returnCode}
+fi
diff --git a/Build/AtlasCMake/modules/skeletons/ClientCMakeLists.txt.in b/Build/AtlasCMake/modules/skeletons/ClientCMakeLists.txt.in
index fce32036710a6ab6f5207f986fd9be26d2a6410a..8882f5b6a9b916dfaa83e76f9805e025a6683a22 100644
--- a/Build/AtlasCMake/modules/skeletons/ClientCMakeLists.txt.in
+++ b/Build/AtlasCMake/modules/skeletons/ClientCMakeLists.txt.in
@@ -1,4 +1,4 @@
-# $Id: ClientCMakeLists.txt.in 748556 2016-05-20 07:50:41Z krasznaa $
+# $Id: ClientCMakeLists.txt.in 751112 2016-05-31 12:00:21Z krasznaa $
 #
 # This is a template for a CMakeLists.txt file that can be used in a client
 # project (work area) to set up building ATLAS packages against the configured
@@ -28,7 +28,7 @@ endif()
 find_package( AtlasCMake QUIET )
 
 # Find the project that we depend on:
-find_package( @CMAKE_PROJECT_NAME@ @CMAKE_PROJECT_VERSION@ )
+find_package( @CMAKE_PROJECT_NAME@ )
 
 # Set up CTest:
 atlas_ctest_setup()
diff --git a/Build/AtlasCMake/modules/skeletons/ProjectConfig.cmake.in b/Build/AtlasCMake/modules/skeletons/ProjectConfig.cmake.in
index 6f14859fcb50f7570dae530a250ddec03d0cddf0..ba6b5b7fadf31e66f6b3e9f332025088c7ff8fc1 100644
--- a/Build/AtlasCMake/modules/skeletons/ProjectConfig.cmake.in
+++ b/Build/AtlasCMake/modules/skeletons/ProjectConfig.cmake.in
@@ -1,4 +1,4 @@
-# $Id: ProjectConfig.cmake.in 739623 2016-04-12 10:56:29Z krasznaa $
+# $Id: ProjectConfig.cmake.in 751112 2016-05-31 12:00:21Z krasznaa $
 #
 # Configuration file for a RootCore CMake release installation.
 # It defines the following variables:
@@ -79,13 +79,21 @@ while( _baseProjects@CMAKE_PROJECT_NAME@ )
    list( GET _baseProjects@CMAKE_PROJECT_NAME@ 1
       _base_version@CMAKE_PROJECT_NAME@ )
    list( REMOVE_AT _baseProjects@CMAKE_PROJECT_NAME@ 0 1 )
+   # Make sure that the project version is a regular version number:
+   if( NOT _base_version@CMAKE_PROJECT_NAME@ MATCHES "^[0-9]+[0-9.]*" )
+      # Let's not specify a version in this case...
+      message( STATUS "Using base project "
+         "\"${_base_project@CMAKE_PROJECT_NAME@}\" without "
+         "its \"${_base_version@CMAKE_PROJECT_NAME@}\" version name/number" )
+      set( _base_version@CMAKE_PROJECT_NAME@ )
+   endif()
    # Find the base release:
    if( @CMAKE_PROJECT_NAME@_FIND_QUIETLY )
       find_package( ${_base_project@CMAKE_PROJECT_NAME@}
-         ${_base_version@CMAKE_PROJECT_NAME@} EXACT QUIET )
+         ${_base_version@CMAKE_PROJECT_NAME@} QUIET )
    else()
       find_package( ${_base_project@CMAKE_PROJECT_NAME@}
-         ${_base_version@CMAKE_PROJECT_NAME@} EXACT )
+         ${_base_version@CMAKE_PROJECT_NAME@} )
    endif()
 endwhile()
 unset( _baseProjects@CMAKE_PROJECT_NAME@ )
@@ -231,11 +239,10 @@ if( @CMAKE_PROJECT_NAME@_FIND_COMPONENTS )
                list( REMOVE_AT _baseProjects@CMAKE_PROJECT_NAME@ 0 1 )
                if( @CMAKE_PROJECT_NAME@_FIND_QUIETLY )
                   find_package( ${_base_project@CMAKE_PROJECT_NAME@}
-                     ${_base_version@CMAKE_PROJECT_NAME@} EXACT QUIET
+                     QUIET
                      COMPONENTS RECOMPILE_DRYRUN )
                else()
                   find_package( ${_base_project@CMAKE_PROJECT_NAME@}
-                     ${_base_version@CMAKE_PROJECT_NAME@} EXACT
                      COMPONENTS RECOMPILE_DRYRUN )
                endif()
             endwhile()
@@ -459,17 +466,13 @@ if( @CMAKE_PROJECT_NAME@_FIND_COMPONENTS )
       # Find the base release:
       if( ${@CMAKE_PROJECT_NAME@_FIND_COMPONENTS} STREQUAL "INCLUDE" )
          find_package( ${_base_project@CMAKE_PROJECT_NAME@}
-            ${_base_version@CMAKE_PROJECT_NAME@}
-            COMPONENTS INCLUDE
-            EXACT QUIET )
+            COMPONENTS INCLUDE QUIET )
       elseif( ${@CMAKE_PROJECT_NAME@_FIND_COMPONENTS} STREQUAL "RECOMPILE" OR
             ${@CMAKE_PROJECT_NAME@_FIND_COMPONENTS} STREQUAL "RECOMPILE_SETUP" )
          # By this time all the dry running has been done. So let's just
          # set up the packages for recompilation already.
          find_package( ${_base_project@CMAKE_PROJECT_NAME@}
-            ${_base_version@CMAKE_PROJECT_NAME@}
-            COMPONENTS RECOMPILE_SETUP
-            EXACT QUIET )
+            COMPONENTS RECOMPILE_SETUP QUIET )
       endif()
    endwhile()
    unset( _baseProjects@CMAKE_PROJECT_NAME@ )
diff --git a/Build/AtlasCMake/modules/skeletons/ReleaseData.in b/Build/AtlasCMake/modules/skeletons/ReleaseData.in
index 41b474e96c908b648ae293a0f2a324f1cab575fe..fe22757eeec895352cfee9665448797d68ca076a 100644
--- a/Build/AtlasCMake/modules/skeletons/ReleaseData.in
+++ b/Build/AtlasCMake/modules/skeletons/ReleaseData.in
@@ -1,9 +1,10 @@
 [release_metadata]
 release:${CMAKE_PROJECT_VERSION}
-validation:None
-base release:None
+validation:$ENV{NICOS_VAL_MODE}
+base release:$ENV{NICOS_ATLAS_ALT_RELEASE}
 nightly name:$ENV{NICOS_NIGHTLY_NAME}
 project name:${CMAKE_PROJECT_NAME}
 nightly release:$ENV{NICOS_PROJECT_RELNAME_COPY}
-nightly jobid:0000
+nightly jobid:$ENV{NICOS_JOBID}
 date:${CMAKE_BUILD_DATE}
+compiler:$ENV{gcc_version}