[Cmake-commits] CMake branch, next, updated. v3.6.0-rc3-584-gc2b11d8

Brad King brad.king at kitware.com
Tue Jun 28 09:44:34 EDT 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  c2b11d8dcb21a881e3b8df37bf54aca8c3dad6c8 (commit)
       via  843402b04a72ec1f99f0f712c4eb73abbcb67cba (commit)
      from  db92ed4ef202cabc08e89e30ddf9d5253b196980 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c2b11d8dcb21a881e3b8df37bf54aca8c3dad6c8
commit c2b11d8dcb21a881e3b8df37bf54aca8c3dad6c8
Merge: db92ed4 843402b
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Jun 28 09:44:33 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Jun 28 09:44:33 2016 -0400

    Merge topic 'GenerateExportHeader-custom-content' into next
    
    843402b0 GenerateExportHeader: Add option to specify custom content


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=843402b04a72ec1f99f0f712c4eb73abbcb67cba
commit 843402b04a72ec1f99f0f712c4eb73abbcb67cba
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Jun 28 09:42:08 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Jun 28 09:43:52 2016 -0400

    GenerateExportHeader: Add option to specify custom content

diff --git a/Help/release/dev/GenerateExportHeader-custom-content.rst b/Help/release/dev/GenerateExportHeader-custom-content.rst
new file mode 100644
index 0000000..161261c
--- /dev/null
+++ b/Help/release/dev/GenerateExportHeader-custom-content.rst
@@ -0,0 +1,6 @@
+GenerateExportHeader-custom-content
+-----------------------------------
+
+* The :module:`GenerateExportHeader` module learned a new
+  ``CUSTOM_CONTENT_FROM_VARIABLE`` option to specify a variable
+  containing custom content for inclusion in the generated header.
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index 6389d30..6205b8c 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -20,6 +20,7 @@
 #              [NO_DEPRECATED_MACRO_NAME <no_deprecated_macro_name>]
 #              [DEFINE_NO_DEPRECATED]
 #              [PREFIX_NAME <prefix_name>]
+#              [CUSTOM_CONTENT_FROM_VARIABLE <variable>]
 #    )
 #
 #
@@ -60,8 +61,10 @@
 # The CMake fragment will generate a file in the
 # ``${CMAKE_CURRENT_BINARY_DIR}`` called ``somelib_export.h`` containing the
 # macros ``SOMELIB_EXPORT``, ``SOMELIB_NO_EXPORT``, ``SOMELIB_DEPRECATED``,
-# ``SOMELIB_DEPRECATED_EXPORT`` and ``SOMELIB_DEPRECATED_NO_EXPORT``.  The
-# resulting file should be installed with other headers in the library.
+# ``SOMELIB_DEPRECATED_EXPORT`` and ``SOMELIB_DEPRECATED_NO_EXPORT``.
+# They will be followed by content taken from the variable specified by
+# the ``CUSTOM_CONTENT_FROM_VARIABLE`` option, if any.
+# The resulting file should be installed with other headers in the library.
 #
 # The ``BASE_NAME`` argument can be used to override the file name and the
 # names used for the macros:
@@ -288,7 +291,7 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY)
   set(options DEFINE_NO_DEPRECATED)
   set(oneValueArgs PREFIX_NAME BASE_NAME EXPORT_MACRO_NAME EXPORT_FILE_NAME
     DEPRECATED_MACRO_NAME NO_EXPORT_MACRO_NAME STATIC_DEFINE
-    NO_DEPRECATED_MACRO_NAME)
+    NO_DEPRECATED_MACRO_NAME CUSTOM_CONTENT_FROM_VARIABLE)
   set(multiValueArgs)
 
   cmake_parse_arguments(_GEH "${options}" "${oneValueArgs}" "${multiValueArgs}"
@@ -361,6 +364,14 @@ macro(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY)
   endif()
   string(MAKE_C_IDENTIFIER ${EXPORT_IMPORT_CONDITION} EXPORT_IMPORT_CONDITION)
 
+  if(_GEH_CUSTOM_CONTENT_FROM_VARIABLE)
+    if(DEFINED "${_GEH_CUSTOM_CONTENT_FROM_VARIABLE}")
+      set(CUSTOM_CONTENT "${${_GEH_CUSTOM_CONTENT_FROM_VARIABLE}}")
+    else()
+      set(CUSTOM_CONTENT "")
+    endif()
+  endif()
+
   configure_file("${_GENERATE_EXPORT_HEADER_MODULE_DIR}/exportheader.cmake.in"
     "${EXPORT_FILE_NAME}" @ONLY)
 endmacro()
diff --git a/Modules/exportheader.cmake.in b/Modules/exportheader.cmake.in
index 7cfbcbd..9dd75bf 100644
--- a/Modules/exportheader.cmake.in
+++ b/Modules/exportheader.cmake.in
@@ -38,5 +38,5 @@
 #    define @NO_DEPRECATED_MACRO_NAME@
 #  endif
 #endif
-
+ at CUSTOM_CONTENT@
 #endif
diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt b/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt
index c1be125..a057746 100644
--- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt
+++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/CMakeLists.txt
@@ -25,9 +25,12 @@ add_library(shared_variant SHARED ${lib_SRCS})
 set_target_properties(shared_variant PROPERTIES DEFINE_SYMBOL SHARED_VARIANT_MAKEDLL)
 add_library(static_variant ${lib_SRCS})
 
+set(MY_CUSTOM_CONTENT "#define MY_CUSTOM_CONTENT_ADDED")
+
 generate_export_header(shared_variant
   BASE_NAME libshared_and_static
   PREFIX_NAME MYPREFIX_
+  CUSTOM_CONTENT_FROM_VARIABLE MY_CUSTOM_CONTENT
 )
 
 set_target_properties(static_variant PROPERTIES COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE)
diff --git a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp
index 2764905..83b8f98 100644
--- a/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp
+++ b/Tests/Module/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp
@@ -1,6 +1,10 @@
 
 #include "libshared_and_static.h"
 
+#ifndef MY_CUSTOM_CONTENT_ADDED
+# error "MY_CUSTOM_CONTENT_ADDED not defined!"
+#endif
+
 int LibsharedAndStatic::libshared_and_static() const
 {
   return 0;

-----------------------------------------------------------------------

Summary of changes:
 .../dev/GenerateExportHeader-custom-content.rst       |    6 ++++++
 Modules/GenerateExportHeader.cmake                    |   17 ++++++++++++++---
 Modules/exportheader.cmake.in                         |    2 +-
 .../lib_shared_and_static/CMakeLists.txt              |    3 +++
 .../lib_shared_and_static/libshared_and_static.cpp    |    4 ++++
 5 files changed, 28 insertions(+), 4 deletions(-)
 create mode 100644 Help/release/dev/GenerateExportHeader-custom-content.rst


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list