[Cmake-commits] CMake branch, next, updated. v3.0.0-4090-gb723147

Stephen Kelly steveire at gmail.com
Wed Jul 2 13:39:23 EDT 2014


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  b72314722defab702e034288f06941157206a668 (commit)
       via  b47c125ff7f088c87183e6ad60850aefdaf43757 (commit)
      from  93704c1fe754edf720125be6992e404438ee8014 (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b72314722defab702e034288f06941157206a668
commit b72314722defab702e034288f06941157206a668
Merge: 93704c1 b47c125
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Jul 2 13:39:22 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Jul 2 13:39:22 2014 -0400

    Merge topic 'WriteCompilerDetectionHeader-valid-prefix' into next
    
    b47c125f WCDH: Ensure that the prefix argument to the macro is valid.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b47c125ff7f088c87183e6ad60850aefdaf43757
commit b47c125ff7f088c87183e6ad60850aefdaf43757
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Jun 13 11:39:47 2014 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Jul 2 19:37:04 2014 +0200

    WCDH: Ensure that the prefix argument to the macro is valid.
    
    The prefix must be a C-identifier because it is written as the
    prefix of preprocessor macros and possibly structs.

diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index 593176c..86137e2 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -235,6 +235,14 @@ function(write_compiler_detection_header
     message(FATAL_ERROR "Unparsed arguments: ${_WCD_UNPARSED_ARGUMENTS}")
   endif()
 
+  if (prefix_arg STREQUAL "")
+    message(FATAL_ERROR "A prefix must be specified")
+  endif()
+  string(MAKE_C_IDENTIFIER ${prefix_arg} cleaned_prefix)
+  if (NOT prefix_arg STREQUAL cleaned_prefix)
+    message(FATAL_ERROR "The prefix must be a valid C identifier.")
+  endif()
+
   if(NOT _WCD_VERSION)
     set(_WCD_VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})
   endif()
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt
new file mode 100644
index 0000000..cf8578e
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at .*/Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\):
+  A prefix must be specified
+Call Stack \(most recent call first\):
+  EmptyPrefix.cmake:[0-9]+ \(write_compiler_detection_header\)
+  CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix.cmake
new file mode 100644
index 0000000..eda6b18
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix.cmake
@@ -0,0 +1,10 @@
+
+include(WriteCompilerDetectionHeader)
+
+write_compiler_detection_header(
+  FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile"
+  PREFIX ""
+  VERSION 3.1
+  COMPILERS GNU
+  FEATURES cxx_final
+)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt
new file mode 100644
index 0000000..ea1bf67
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at .*/Modules/WriteCompilerDetectionHeader.cmake:[0-9]+ \(message\):
+  The prefix must be a valid C identifier.
+Call Stack \(most recent call first\):
+  InvalidPrefix.cmake:[0-9]+ \(write_compiler_detection_header\)
+  CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix.cmake
new file mode 100644
index 0000000..6599f35
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix.cmake
@@ -0,0 +1,10 @@
+
+include(WriteCompilerDetectionHeader)
+
+write_compiler_detection_header(
+  FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile"
+  PREFIX "0compile"
+  VERSION 3.1
+  COMPILERS GNU
+  FEATURES cxx_final
+)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake
index be79d41..6dded44 100644
--- a/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake
@@ -10,3 +10,5 @@ run_cmake(OldVersion)
 run_cmake(InvalidCompiler)
 run_cmake(InvalidFeature)
 run_cmake(InvalidCXXFeature)
+run_cmake(EmptyPrefix)
+run_cmake(InvalidPrefix)

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

Summary of changes:
 Modules/WriteCompilerDetectionHeader.cmake                     |    8 ++++++++
 .../EmptyPrefix-result.txt}                                    |    0
 .../WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt        |    5 +++++
 .../{ExtraArgs.cmake => EmptyPrefix.cmake}                     |    4 ++--
 .../InvalidPrefix-result.txt}                                  |    0
 .../WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt      |    5 +++++
 .../{ExtraArgs.cmake => InvalidPrefix.cmake}                   |    4 ++--
 Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake |    2 ++
 8 files changed, 24 insertions(+), 4 deletions(-)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => WriteCompilerDetectionHeader/EmptyPrefix-result.txt} (100%)
 create mode 100644 Tests/RunCMake/WriteCompilerDetectionHeader/EmptyPrefix-stderr.txt
 copy Tests/RunCMake/WriteCompilerDetectionHeader/{ExtraArgs.cmake => EmptyPrefix.cmake} (85%)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => WriteCompilerDetectionHeader/InvalidPrefix-result.txt} (100%)
 create mode 100644 Tests/RunCMake/WriteCompilerDetectionHeader/InvalidPrefix-stderr.txt
 copy Tests/RunCMake/WriteCompilerDetectionHeader/{ExtraArgs.cmake => InvalidPrefix.cmake} (82%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list