From 96654e290cdf45c6f82beb0cd2280fd890dc49ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <gruenich@dune-project.org>
Date: Thu, 2 Jul 2015 11:47:25 +0200
Subject: [PATCH] [CMake] Rename the generated config.h.cmake.

Otherwise it collides with the config.h.cmake for in-source builds.
The generated file is called config_collected.h.cmake.
Thanks to Robert for the heads-up.
---
 cmake/modules/DuneMacros.cmake | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/cmake/modules/DuneMacros.cmake b/cmake/modules/DuneMacros.cmake
index 9bcc835da..d0f5acbea 100644
--- a/cmake/modules/DuneMacros.cmake
+++ b/cmake/modules/DuneMacros.cmake
@@ -38,11 +38,11 @@
 #
 # dune_regenerate_config_cmake()
 #
-# Creates a new config.h.cmake file in ${CMAKE_CURRENT_BINARY_DIR) that
+# Creates a new config_collected.h.cmake file in ${CMAKE_CURRENT_BINARY_DIR) that
 # consists of entries from ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
-# and includes non-private entries from the files config.h.cmake files
+# and includes non-private entries from the files config_collected.h.cmake files
 # of all dependent modules.
-# Finally config.h is created from config.h.cmake.
+# Finally config.h is created from config_collected.h.cmake.
 #
 #
 # dune_add_library(<basename> [NO_EXPORT] [ADD_LIBS <lib1> [<lib2> ...]]
@@ -689,7 +689,7 @@ endmacro(dune_project)
 
 # create a new config.h file and overwrite the existing one
 macro(dune_regenerate_config_cmake)
-  set(CONFIG_H_CMAKE_FILE "${CMAKE_BINARY_DIR}/config.h.cmake")
+  set(CONFIG_H_CMAKE_FILE "${CMAKE_BINARY_DIR}/config_collected.h.cmake")
   if(EXISTS ${CMAKE_SOURCE_DIR}/config.h.cmake)
     file(READ ${CMAKE_SOURCE_DIR}/config.h.cmake _file)
     string(REGEX MATCH
@@ -697,8 +697,8 @@ macro(dune_regenerate_config_cmake)
       _myfile "${_file}")
   endif(EXISTS ${CMAKE_SOURCE_DIR}/config.h.cmake)
   # overwrite file with new content
-  file(WRITE ${CONFIG_H_CMAKE_FILE} "/* config.h.  Generated from config.h.cmake by CMake.
-   It was generated from config.h.cmake which in turn is generated automatically
+  file(WRITE ${CONFIG_H_CMAKE_FILE} "/* config.h.  Generated from config_collected.h.cmake by CMake.
+   It was generated from config_collected.h.cmake which in turn is generated automatically
    from the config.h.cmake files of modules this module depends on. */"
    )
 
@@ -869,12 +869,12 @@ endif()
     message(STATUS "Adding custom target for config.h generation")
     dune_regenerate_config_cmake()
     # add a target to generate config.h.cmake
-    add_custom_target(OUTPUT config.h.cmake
+    add_custom_target(OUTPUT config_collected.h.cmake
       COMMAND dune_regenerate_config_cmake()
       DEPENDS stamp-regenerate-config-h)
     # actually write the config.h file to disk
     # using generated file
-    configure_file(${CMAKE_CURRENT_BINARY_DIR}/config.h.cmake
+    configure_file(${CMAKE_CURRENT_BINARY_DIR}/config_collected.h.cmake
       ${CMAKE_CURRENT_BINARY_DIR}/config.h)
   else("${ARGC}" EQUAL "1")
     message(STATUS "Not adding custom target for config.h generation")
-- 
GitLab