[Cmake-commits] CMake branch, next, updated. v3.0.0-rc4-2715-gcf14243

Stephen Kelly steveire at gmail.com
Fri May 2 11:53:58 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  cf142433265f35bece5d7a36437f076ea038218f (commit)
       via  4ec1439ae0197fa11879032eac0b1aba4ffe50fb (commit)
      from  d42c7f0495d74cf5207e8729f083163c48ac6dbf (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=cf142433265f35bece5d7a36437f076ea038218f
commit cf142433265f35bece5d7a36437f076ea038218f
Merge: d42c7f0 4ec1439
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri May 2 11:53:57 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri May 2 11:53:57 2014 -0400

    Merge topic 'WriteCompilerDetectionHeader-module' into next
    
    4ec1439a Optimize, simplify, extend tests.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4ec1439ae0197fa11879032eac0b1aba4ffe50fb
commit 4ec1439ae0197fa11879032eac0b1aba4ffe50fb
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri May 2 12:24:56 2014 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Fri May 2 17:53:07 2014 +0200

    Optimize, simplify, extend tests.

diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index 87f9b64..acb393c 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -213,9 +213,8 @@ function(write_compiler_detection_header
   foreach(feature ${_WCD_FEATURES})
     if (feature MATCHES "^cxx_")
       list(APPEND _langs CXX)
-    endif()
-    if (feature MATCHES "^c_")
-      list(APPEND _langs C)
+    else()
+      message(FATAL_ERROR "Unsupported feature ${feature}.")
     endif()
   endforeach()
   list(REMOVE_DUPLICATES _langs)
@@ -234,24 +233,28 @@ function(write_compiler_detection_header
 
     get_property(known_features GLOBAL PROPERTY CMAKE_${_lang}_KNOWN_FEATURES)
 
+    foreach(feature ${_WCD_FEATURES})
+      list(FIND known_features ${feature} idx)
+      if (idx EQUAL -1)
+        message(FATAL_ERROR "Unsupported feature ${feature}.")
+      endif()
+    endforeach()
+
     set(pp_if "if")
     foreach(compiler ${_WCD_COMPILERS})
       _load_compiler_variables(${compiler} ${_lang} ${_WCD_FEATURES})
       file(APPEND "${file_arg}" "\n#  ${pp_if} ${prefix_arg}_COMPILER_IS_${compiler}\n")
       set(pp_if "elif")
       foreach(feature ${_WCD_FEATURES})
-        list(FIND known_features ${feature} idx)
-        if (NOT idx EQUAL -1)
-          get_property(feature_PP GLOBAL PROPERTY CMAKE_PP_NAME_${feature})
-          set(_define_item "\n#    define ${prefix_arg}_${feature_PP} 0\n")
-          if (_cmake_feature_test_${compiler}_${feature} STREQUAL "1")
-            set(_define_item "\n#    define ${prefix_arg}_${feature_PP} 1\n")
-          elseif (_cmake_feature_test_${compiler}_${feature})
-            set(_define_item "\n#      define ${prefix_arg}_${feature_PP} 0\n")
-            set(_define_item "\n#    if ${_cmake_feature_test_${compiler}_${feature}}\n#      define ${prefix_arg}_${feature_PP} 1\n#    else${_define_item}#    endif\n")
-          endif()
-          file(APPEND "${file_arg}" "${_define_item}")
+        get_property(feature_PP GLOBAL PROPERTY CMAKE_PP_NAME_${feature})
+        set(_define_item "\n#    define ${prefix_arg}_${feature_PP} 0\n")
+        if (_cmake_feature_test_${compiler}_${feature} STREQUAL "1")
+          set(_define_item "\n#    define ${prefix_arg}_${feature_PP} 1\n")
+        elseif (_cmake_feature_test_${compiler}_${feature})
+          set(_define_item "\n#      define ${prefix_arg}_${feature_PP} 0\n")
+          set(_define_item "\n#    if ${_cmake_feature_test_${compiler}_${feature}}\n#      define ${prefix_arg}_${feature_PP} 1\n#    else${_define_item}#    endif\n")
         endif()
+        file(APPEND "${file_arg}" "${_define_item}")
       endforeach()
     endforeach()
     if(pp_if STREQUAL "elif")
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature-stderr.txt
new file mode 100644
index 0000000..d21d73f
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:239 \(message\):
+  Unsupported feature cxx_not_a_feature.
+Call Stack \(most recent call first\):
+  InvalidCXXFeature.cmake:4 \(write_compiler_detection_header\)
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature.cmake
new file mode 100644
index 0000000..da870fa
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature.cmake
@@ -0,0 +1,10 @@
+
+include(WriteCompilerDetectionHeader)
+
+write_compiler_detection_header(
+    FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile"
+    PREFIX PREF_
+    COMPILERS GNU
+    FEATURES cxx_not_a_feature
+    VERSION 3.1
+)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler-stderr.txt
new file mode 100644
index 0000000..c757c35
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:198 \(message\):
+  Unsupported compiler NOT_A_COMPILER.
+Call Stack \(most recent call first\):
+  InvalidCompiler.cmake:4 \(write_compiler_detection_header\)
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler.cmake
new file mode 100644
index 0000000..ecd0957
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler.cmake
@@ -0,0 +1,10 @@
+
+include(WriteCompilerDetectionHeader)
+
+write_compiler_detection_header(
+    FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile"
+    PREFIX PREF_
+    COMPILERS NOT_A_COMPILER
+    FEATURES cxx_final
+    VERSION 3.1
+)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-result.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-stderr.txt b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-stderr.txt
new file mode 100644
index 0000000..1f6ca45
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at .*Modules/WriteCompilerDetectionHeader.cmake:217 \(message\):
+  Unsupported feature not_a_feature.
+Call Stack \(most recent call first\):
+  InvalidFeature.cmake:4 \(write_compiler_detection_header\)
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature.cmake
new file mode 100644
index 0000000..cd83968
--- /dev/null
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature.cmake
@@ -0,0 +1,10 @@
+
+include(WriteCompilerDetectionHeader)
+
+write_compiler_detection_header(
+    FILE "${CMAKE_CURRENT_BINARY_DIR}/somefile"
+    PREFIX PREF_
+    COMPILERS GNU
+    FEATURES not_a_feature
+    VERSION 3.1
+)
diff --git a/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake
index ea1f658..be79d41 100644
--- a/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake
+++ b/Tests/RunCMake/WriteCompilerDetectionHeader/RunCMakeTest.cmake
@@ -7,3 +7,6 @@ run_cmake(FileTypo)
 run_cmake(PrefixTypo)
 run_cmake(ExtraArgs)
 run_cmake(OldVersion)
+run_cmake(InvalidCompiler)
+run_cmake(InvalidFeature)
+run_cmake(InvalidCXXFeature)

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

Summary of changes:
 Modules/WriteCompilerDetectionHeader.cmake         |   31 +++++++++++---------
 .../InvalidCXXFeature-result.txt}                  |    0
 .../InvalidCXXFeature-stderr.txt                   |    5 ++++
 .../{NoFeature.cmake => InvalidCXXFeature.cmake}   |    2 +-
 .../InvalidCompiler-result.txt}                    |    0
 .../InvalidCompiler-stderr.txt                     |    5 ++++
 .../{NoCompiler.cmake => InvalidCompiler.cmake}    |    2 +-
 .../InvalidFeature-result.txt}                     |    0
 .../InvalidFeature-stderr.txt                      |    5 ++++
 .../{NoFeature.cmake => InvalidFeature.cmake}      |    2 +-
 .../RunCMakeTest.cmake                             |    3 ++
 11 files changed, 38 insertions(+), 17 deletions(-)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => WriteCompilerDetectionHeader/InvalidCXXFeature-result.txt} (100%)
 create mode 100644 Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCXXFeature-stderr.txt
 copy Tests/RunCMake/WriteCompilerDetectionHeader/{NoFeature.cmake => InvalidCXXFeature.cmake} (84%)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => WriteCompilerDetectionHeader/InvalidCompiler-result.txt} (100%)
 create mode 100644 Tests/RunCMake/WriteCompilerDetectionHeader/InvalidCompiler-stderr.txt
 copy Tests/RunCMake/WriteCompilerDetectionHeader/{NoCompiler.cmake => InvalidCompiler.cmake} (86%)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => WriteCompilerDetectionHeader/InvalidFeature-result.txt} (100%)
 create mode 100644 Tests/RunCMake/WriteCompilerDetectionHeader/InvalidFeature-stderr.txt
 copy Tests/RunCMake/WriteCompilerDetectionHeader/{NoFeature.cmake => InvalidFeature.cmake} (86%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list