[Cmake-commits] CMake branch, master, updated. v3.10.0-423-g65f21a7

Kitware Robot kwrobot at kitware.com
Mon Nov 27 09:05:06 EST 2017


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, master has been updated
       via  65f21a7eadc2144f0c85cd883cf63a6eb7681528 (commit)
       via  1882ba2e0506deeb06f334b7459921286238d719 (commit)
       via  c2019d7c0c9156ee78323ef0fc6bbeabe1c22192 (commit)
       via  2ae880fa8f04a2026939b1df9613b64a301aa522 (commit)
       via  2b7d59f3109483bfa45dc41e2a2f6a2f82addfec (commit)
       via  0f6f7c8ab1979b89c4400ebab39532be4bc269fb (commit)
       via  c5a82d0f883b4e8f34c380117316d3fa1a97c3d2 (commit)
       via  25773650400a6c584da45a92f9b51905101d9420 (commit)
      from  b67762ff3c4e24be75090cb2dca6c2b0e7f08dcb (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=65f21a7eadc2144f0c85cd883cf63a6eb7681528
commit 65f21a7eadc2144f0c85cd883cf63a6eb7681528
Merge: 1882ba2 c2019d7
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Nov 27 09:03:44 2017 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Nov 27 09:03:44 2017 -0500

    Merge branch 'release-3.10'


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1882ba2e0506deeb06f334b7459921286238d719
commit 1882ba2e0506deeb06f334b7459921286238d719
Merge: b67762f 2ae880f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Nov 27 14:00:11 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Nov 27 09:00:44 2017 -0500

    Merge topic 'extend-compile-language-genex'
    
    2ae880fa Genex: Enable COMPILE_LANGUAGE for COMPILE_OPTIONS with Visual Studio
    2b7d59f3 Genex: Enable COMPILE_LANGUAGE for file(GENERATE) with Visual Studio
    0f6f7c8a Genex: Fix COMPILE_LANGUAGE messages to allow file(GENERATE) with Xcode
    c5a82d0f Tests: Decouple COMPILE_LANGUAGE in file(GENERATE) from COMPILE_OPTIONS
    25773650 Tests: Remove unnecessary result files from RunCMake.File_Generate
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Acked-by: Jason Juang <jasjuang at gmail.com>
    Merge-request: !1511


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2ae880fa8f04a2026939b1df9613b64a301aa522
commit 2ae880fa8f04a2026939b1df9613b64a301aa522
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Nov 17 14:46:53 2017 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Nov 20 13:51:25 2017 -0500

    Genex: Enable COMPILE_LANGUAGE for COMPILE_OPTIONS with Visual Studio
    
    Since commit v3.9.0-rc4~3^2~1 (VS: Fix target_compile_options for CUDA,
    2017-06-21), the evaluation of `COMPILE_LANGUAGE` receives the proper
    language.  The set of compile flags used for a target's C and C++
    sources is based on the linker language.  By default this is always the
    C++ flags if any C++ sources appear in the target, and otherwise the C
    flags.  Therefore we can define the `COMPILE_LANGUAGE` generator
    expression in `COMPILE_OPTIONS` to match the selected language.
    
    This is not exactly the same as for other generators, but is the best VS
    can do.  It is also sufficient for many use cases since the set of
    allowed flags for C and C++ is almost the same in Visual Studio.
    Furthermore, since the VS generator moves many of the flags to
    declarative `.vcxproj` elements, it will automatically avoid passing
    C++ flags for C sources.
    
    Issue: #17435

diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index bddb174..dc5621a 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -97,7 +97,7 @@ Available logical expressions are:
   compile features and a list of supported compilers.
 ``$<COMPILE_LANGUAGE:lang>``
   ``1`` when the language used for compilation unit matches ``lang``,
-  otherwise ``0``.  This expression used to specify compile options for
+  otherwise ``0``.  This expression may be used to specify compile options for
   source files of a particular language in a target. For example, to specify
   the use of the ``-fno-exceptions`` compile option (compiler id checks
   elided):
@@ -109,10 +109,12 @@ Available logical expressions are:
       PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
     )
 
-  This generator expression has limited use because it is not possible to
-  use it with the Visual Studio generators.  Portable buildsystems would
-  not use this expression, and would create separate libraries for each
-  source file language instead:
+  Note that with :ref:`Visual Studio Generators` there is no way to represent
+  target-wide flags separately for ``C`` and ``CXX`` languages.  Under these
+  generators, target-wide flags for both C and C++ sources will be evaluated
+  using ``CXX`` if there are any C++ sources and otherwise using ``C``.
+  A workaround is to create separate libraries for each source file language
+  instead:
 
   .. code-block:: cmake
 
diff --git a/Help/release/dev/extend-compile-language-genex.rst b/Help/release/dev/extend-compile-language-genex.rst
new file mode 100644
index 0000000..0a0a669
--- /dev/null
+++ b/Help/release/dev/extend-compile-language-genex.rst
@@ -0,0 +1,7 @@
+extend-compile-language-genex
+-----------------------------
+
+* The ``COMPILE_LANGUAGE`` :manual:`generator expression
+  <cmake-generator-expressions(7)>` may now be used with
+  :ref:`Visual Studio Generators` in :prop_tgt:`COMPILE_OPTIONS`
+  and :command:`file(GENERATE)`.
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 5068560..3d311d6 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -829,12 +829,11 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode
     std::string genName = gg->GetName();
     if (genName.find("Visual Studio") != std::string::npos) {
       if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() ||
-                         dagChecker->EvaluatingCompileOptions() ||
                          dagChecker->EvaluatingIncludeDirectories())) {
         reportError(
           context, content->GetOriginalExpression(),
-          "$<COMPILE_LANGUAGE:...> may only be used for file(GENERATE) "
-          "with the Visual Studio generator.");
+          "$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS "
+          "and file(GENERATE) with the Visual Studio generator.");
         return std::string();
       }
     } else if (genName.find("Xcode") != std::string::npos) {
diff --git a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt
index 35dd276..1dedbae 100644
--- a/Tests/CMakeCommands/target_compile_options/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_compile_options/CMakeLists.txt
@@ -23,18 +23,19 @@ add_executable(consumer
   "${CMAKE_CURRENT_SOURCE_DIR}/consumer.cpp"
 )
 
-if (NOT CMAKE_GENERATOR MATCHES "Visual Studio")
-  target_sources(consumer PRIVATE
-    "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c"
-  )
-  target_compile_options(consumer
-    PRIVATE
-      -DCONSUMER_LANG_$<COMPILE_LANGUAGE>
-      -DLANG_IS_CXX=$<COMPILE_LANGUAGE:CXX>
-      -DLANG_IS_C=$<COMPILE_LANGUAGE:C>
-  )
+target_sources(consumer PRIVATE
+  "${CMAKE_CURRENT_SOURCE_DIR}/consumer.c"
+)
+target_compile_options(consumer
+  PRIVATE
+    -DCONSUMER_LANG_$<COMPILE_LANGUAGE>
+    -DLANG_IS_CXX=$<COMPILE_LANGUAGE:CXX>
+    -DLANG_IS_C=$<COMPILE_LANGUAGE:C>
+)
+
+if(CMAKE_GENERATOR MATCHES "Visual Studio")
   target_compile_definitions(consumer
-    PRIVATE -DTEST_LANG_DEFINES
+    PRIVATE TEST_LANG_DEFINES_FOR_VISUAL_STUDIO
   )
 endif()
 
diff --git a/Tests/CMakeCommands/target_compile_options/consumer.c b/Tests/CMakeCommands/target_compile_options/consumer.c
index 7931a6f..420b4cc 100644
--- a/Tests/CMakeCommands/target_compile_options/consumer.c
+++ b/Tests/CMakeCommands/target_compile_options/consumer.c
@@ -1,5 +1,23 @@
 
-#ifdef TEST_LANG_DEFINES
+// Visual Studio allows only one set of flags for C and C++.
+// In a target using C++ we pick the C++ flags even for C sources.
+#ifdef TEST_LANG_DEFINES_FOR_VISUAL_STUDIO
+#ifndef CONSUMER_LANG_CXX
+#error Expected CONSUMER_LANG_CXX
+#endif
+
+#ifdef CONSUMER_LANG_C
+#error Unexpected CONSUMER_LANG_C
+#endif
+
+#if !LANG_IS_CXX
+#error Expected LANG_IS_CXX
+#endif
+
+#if LANG_IS_C
+#error Unexpected LANG_IS_C
+#endif
+#else
 #ifdef CONSUMER_LANG_CXX
 #error Unexpected CONSUMER_LANG_CXX
 #endif
diff --git a/Tests/CMakeCommands/target_compile_options/consumer.cpp b/Tests/CMakeCommands/target_compile_options/consumer.cpp
index 71a6098..7750950 100644
--- a/Tests/CMakeCommands/target_compile_options/consumer.cpp
+++ b/Tests/CMakeCommands/target_compile_options/consumer.cpp
@@ -15,7 +15,6 @@
 
 #endif
 
-#ifdef TEST_LANG_DEFINES
 #ifndef CONSUMER_LANG_CXX
 #error Expected CONSUMER_LANG_CXX
 #endif
@@ -31,7 +30,6 @@
 #if LANG_IS_C
 #error Unexpected LANG_IS_C
 #endif
-#endif
 
 int main()
 {
diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt
index 9b82366..5bd93a4 100644
--- a/Tests/CudaOnly/WithDefs/CMakeLists.txt
+++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt
@@ -32,6 +32,8 @@ add_executable(CudaOnlyWithDefs ${main})
 
 target_compile_options(CudaOnlyWithDefs
   PRIVATE
+    -DCOMPILE_LANG_$<COMPILE_LANGUAGE>
+    -DLANG_IS_CUDA=$<COMPILE_LANGUAGE:CUDA>
     -Xcompiler=-DHOST_DEFINE
     $<$<CONFIG:DEBUG>:$<BUILD_INTERFACE:${debug_compile_flags}>>
   )
diff --git a/Tests/CudaOnly/WithDefs/main.notcu b/Tests/CudaOnly/WithDefs/main.notcu
index d2eff3f..bfb3577 100644
--- a/Tests/CudaOnly/WithDefs/main.notcu
+++ b/Tests/CudaOnly/WithDefs/main.notcu
@@ -10,6 +10,18 @@
 #error "PACKED_DEFINE not defined!"
 #endif
 
+#ifndef COMPILE_LANG_CUDA
+#error "COMPILE_LANG_CUDA not defined!"
+#endif
+
+#ifndef LANG_IS_CUDA
+#error "LANG_IS_CUDA not defined!"
+#endif
+
+#if !LANG_IS_CUDA
+#error "Expected LANG_IS_CUDA"
+#endif
+
 static __global__ void DetermineIfValidCudaDevice()
 {
 }
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt
index 830d5f3..42c1485 100644
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt
+++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt
@@ -3,7 +3,7 @@ CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\):
 
     \$<COMPILE_LANGUAGE:CXX>
 
-  \$<COMPILE_LANGUAGE:...> may only be used for file\(GENERATE\) with the Visual
-  Studio generator.
+  \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and
+  file\(GENERATE\) with the Visual Studio generator.
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt
deleted file mode 100644
index 66b45c0..0000000
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-CMake Error at CompileOptions.cmake:5 \(target_compile_options\):
-  Error evaluating generator expression:
-
-    \$<COMPILE_LANGUAGE:CXX>
-
-  \$<COMPILE_LANGUAGE:...> may only be used for file\(GENERATE\) with the Visual
-  Studio generator.
-Call Stack \(most recent call first\):
-  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake
deleted file mode 100644
index 6c92abc..0000000
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-
-enable_language(CXX)
-
-add_executable(main main.cpp)
-target_compile_options(main PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-DANYTHING>)
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt
index 06900bc..3806ed1 100644
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt
+++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt
@@ -3,7 +3,7 @@ CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\):
 
     \$<COMPILE_LANGUAGE:CXX>
 
-  \$<COMPILE_LANGUAGE:...> may only be used for file\(GENERATE\) with the Visual
-  Studio generator.
+  \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and
+  file\(GENERATE\) with the Visual Studio generator.
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake
index 5e0a5f5..421fa73 100644
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake
+++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/RunCMakeTest.cmake
@@ -1,9 +1,5 @@
 include(RunCMake)
 
-if (RunCMake_GENERATOR MATCHES "Visual Studio")
-    set(RunCMake-stderr-file CompileOptions-stderr-VS.txt)
-    run_cmake(CompileOptions)
-endif()
 if (RunCMake_GENERATOR STREQUAL "Xcode")
     set(RunCMake-stderr-file CompileDefinitions-stderr-Xcode.txt)
     run_cmake(CompileDefinitions)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2b7d59f3109483bfa45dc41e2a2f6a2f82addfec
commit 2b7d59f3109483bfa45dc41e2a2f6a2f82addfec
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Nov 17 14:31:07 2017 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Nov 17 14:31:07 2017 -0500

    Genex: Enable COMPILE_LANGUAGE for file(GENERATE) with Visual Studio
    
    Issue: #17435

diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 488bbfd..5068560 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -828,12 +828,16 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode
     }
     std::string genName = gg->GetName();
     if (genName.find("Visual Studio") != std::string::npos) {
-      reportError(context, content->GetOriginalExpression(),
-                  "$<COMPILE_LANGUAGE:...> may not be used with Visual Studio "
-                  "generators.");
-      return std::string();
-    }
-    if (genName.find("Xcode") != std::string::npos) {
+      if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() ||
+                         dagChecker->EvaluatingCompileOptions() ||
+                         dagChecker->EvaluatingIncludeDirectories())) {
+        reportError(
+          context, content->GetOriginalExpression(),
+          "$<COMPILE_LANGUAGE:...> may only be used for file(GENERATE) "
+          "with the Visual Studio generator.");
+        return std::string();
+      }
+    } else if (genName.find("Xcode") != std::string::npos) {
       if (dagChecker && (dagChecker->EvaluatingCompileDefinitions() ||
                          dagChecker->EvaluatingIncludeDirectories())) {
         reportError(
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt
index 73b66ac..830d5f3 100644
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt
+++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-VS.txt
@@ -3,6 +3,7 @@ CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\):
 
     \$<COMPILE_LANGUAGE:CXX>
 
-  \$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators.
+  \$<COMPILE_LANGUAGE:...> may only be used for file\(GENERATE\) with the Visual
+  Studio generator.
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt
index e9e8e9f..66b45c0 100644
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt
+++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt
@@ -3,6 +3,7 @@ CMake Error at CompileOptions.cmake:5 \(target_compile_options\):
 
     \$<COMPILE_LANGUAGE:CXX>
 
-  \$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators.
+  \$<COMPILE_LANGUAGE:...> may only be used for file\(GENERATE\) with the Visual
+  Studio generator.
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt
index ec15068..06900bc 100644
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt
+++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-VS.txt
@@ -3,6 +3,7 @@ CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\):
 
     \$<COMPILE_LANGUAGE:CXX>
 
-  \$<COMPILE_LANGUAGE:...> may not be used with Visual Studio generators.
+  \$<COMPILE_LANGUAGE:...> may only be used for file\(GENERATE\) with the Visual
+  Studio generator.
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake
index b660463..616e210 100644
--- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake
+++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake
@@ -21,15 +21,13 @@ if (NOT file_contents MATCHES "generated.cpp.rule")
   message(SEND_ERROR "Rule file not in target sources! ${file_contents}")
 endif()
 
-if (NOT RunCMake_GENERATOR MATCHES "Visual Studio")
-  run_cmake(COMPILE_LANGUAGE-genex)
-  foreach(l CXX C)
-    file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs)
-    if (NOT l_defs STREQUAL "LANG_IS_${l}\n")
-      message(FATAL_ERROR "File content does not match: ${l_defs}")
-    endif()
-  endforeach()
-endif()
+run_cmake(COMPILE_LANGUAGE-genex)
+foreach(l CXX C)
+  file(READ "${RunCMake_BINARY_DIR}/COMPILE_LANGUAGE-genex-build/opts-${l}.txt" l_defs)
+  if (NOT l_defs STREQUAL "LANG_IS_${l}\n")
+    message(FATAL_ERROR "File content does not match: ${l_defs}")
+  endif()
+endforeach()
 
 set(timeformat "%Y%j%H%M%S")
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0f6f7c8ab1979b89c4400ebab39532be4bc269fb
commit 0f6f7c8ab1979b89c4400ebab39532be4bc269fb
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Nov 17 11:43:19 2017 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Nov 17 11:56:00 2017 -0500

    Genex: Fix COMPILE_LANGUAGE messages to allow file(GENERATE) with Xcode
    
    When rejecting the `COMPILE_LANGUAGE` generator expression on include
    directories and compile definitions with Xcode, add `file(GENERATE)` to
    the allowed set in the message.  It is allowed and already covered
    by the `RunCMake.File_Generate` test `COMPILE_LANGUAGE-genex` case.

diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 7fe0cbe..488bbfd 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -838,8 +838,8 @@ static const struct CompileLanguageNode : public cmGeneratorExpressionNode
                          dagChecker->EvaluatingIncludeDirectories())) {
         reportError(
           context, content->GetOriginalExpression(),
-          "$<COMPILE_LANGUAGE:...> may only be used with COMPILE_OPTIONS "
-          "with the Xcode generator.");
+          "$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS "
+          "and file(GENERATE) with the Xcode generator.");
         return std::string();
       }
     } else {
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt
index a1ed633..7879a79 100644
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt
+++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileDefinitions-stderr-Xcode.txt
@@ -3,7 +3,7 @@ CMake Error at CompileDefinitions.cmake:5 \(target_compile_definitions\):
 
     \$<COMPILE_LANGUAGE:CXX>
 
-  \$<COMPILE_LANGUAGE:...> may only be used with COMPILE_OPTIONS with the
-  Xcode generator.
+  \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and
+  file\(GENERATE\) with the Xcode generator.
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt
index fdf92b2..a3fb9c5 100644
--- a/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt
+++ b/Tests/RunCMake/COMPILE_LANGUAGE-genex/IncludeDirectories-stderr-Xcode.txt
@@ -3,7 +3,7 @@ CMake Error at IncludeDirectories.cmake:5 \(target_include_directories\):
 
     \$<COMPILE_LANGUAGE:CXX>
 
-  \$<COMPILE_LANGUAGE:...> may only be used with COMPILE_OPTIONS with the
-  Xcode generator.
+  \$<COMPILE_LANGUAGE:...> may only be used for COMPILE_OPTIONS and
+  file\(GENERATE\) with the Xcode generator.
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c5a82d0f883b4e8f34c380117316d3fa1a97c3d2
commit c5a82d0f883b4e8f34c380117316d3fa1a97c3d2
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Nov 17 11:54:13 2017 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Nov 17 11:55:58 2017 -0500

    Tests: Decouple COMPILE_LANGUAGE in file(GENERATE) from COMPILE_OPTIONS
    
    Simplify the `RunCMake.File_Generate` test `COMPILE_LANGUAGE-genex`
    case to avoid requiring support for the genex in `COMPILE_OPTIONS`.

diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake
index 59ccf19..bead2af 100644
--- a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake
+++ b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex.cmake
@@ -1,12 +1,6 @@
-
 enable_language(CXX C)
 
-add_library(empty empty.cpp empty.c)
-target_compile_options(empty
-  PRIVATE LANG_IS_$<COMPILE_LANGUAGE>
-)
-
 file(GENERATE
   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opts-$<COMPILE_LANGUAGE>.txt
-  CONTENT "$<TARGET_PROPERTY:empty,COMPILE_OPTIONS>\n"
+  CONTENT "LANG_IS_$<COMPILE_LANGUAGE>\n"
 )

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=25773650400a6c584da45a92f9b51905101d9420
commit 25773650400a6c584da45a92f9b51905101d9420
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Nov 17 11:37:29 2017 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Nov 17 11:40:14 2017 -0500

    Tests: Remove unnecessary result files from RunCMake.File_Generate
    
    The default result is "0" anyway.

diff --git a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt b/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/File_Generate/CarryPermissions-result.txt b/Tests/RunCMake/File_Generate/CarryPermissions-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/File_Generate/CarryPermissions-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/File_Generate/GenerateSource-result.txt b/Tests/RunCMake/File_Generate/GenerateSource-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/File_Generate/GenerateSource-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt b/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt b/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt
deleted file mode 100644
index 573541a..0000000
--- a/Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-0

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

Summary of changes:
 Help/manual/cmake-generator-expressions.7.rst      |   12 +++++-----
 Help/release/dev/extend-compile-language-genex.rst |    7 ++++++
 Source/cmGeneratorExpressionNode.cxx               |   19 +++++++++-------
 .../target_compile_options/CMakeLists.txt          |   23 ++++++++++----------
 .../target_compile_options/consumer.c              |   20 ++++++++++++++++-
 .../target_compile_options/consumer.cpp            |    2 --
 Tests/CudaOnly/WithDefs/CMakeLists.txt             |    2 ++
 Tests/CudaOnly/WithDefs/main.notcu                 |   12 ++++++++++
 .../CompileDefinitions-stderr-VS.txt               |    3 ++-
 .../CompileDefinitions-stderr-Xcode.txt            |    4 ++--
 .../CompileOptions-result.txt                      |    1 -
 .../CompileOptions-stderr-VS.txt                   |    8 -------
 .../COMPILE_LANGUAGE-genex/CompileOptions.cmake    |    5 -----
 .../IncludeDirectories-stderr-VS.txt               |    3 ++-
 .../IncludeDirectories-stderr-Xcode.txt            |    4 ++--
 .../COMPILE_LANGUAGE-genex/RunCMakeTest.cmake      |    4 ----
 .../COMPILE_LANGUAGE-genex-result.txt              |    1 -
 .../File_Generate/COMPILE_LANGUAGE-genex.cmake     |    8 +------
 .../File_Generate/CarryPermissions-result.txt      |    1 -
 .../File_Generate/GenerateSource-result.txt        |    1 -
 .../OutputNameMatchesOtherSources-result.txt       |    1 -
 Tests/RunCMake/File_Generate/ReRunCMake-result.txt |    1 -
 Tests/RunCMake/File_Generate/RunCMakeTest.cmake    |   16 ++++++--------
 .../File_Generate/WriteIfDifferent-result.txt      |    1 -
 24 files changed, 86 insertions(+), 73 deletions(-)
 create mode 100644 Help/release/dev/extend-compile-language-genex.rst
 delete mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-result.txt
 delete mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions-stderr-VS.txt
 delete mode 100644 Tests/RunCMake/COMPILE_LANGUAGE-genex/CompileOptions.cmake
 delete mode 100644 Tests/RunCMake/File_Generate/COMPILE_LANGUAGE-genex-result.txt
 delete mode 100644 Tests/RunCMake/File_Generate/CarryPermissions-result.txt
 delete mode 100644 Tests/RunCMake/File_Generate/GenerateSource-result.txt
 delete mode 100644 Tests/RunCMake/File_Generate/OutputNameMatchesOtherSources-result.txt
 delete mode 100644 Tests/RunCMake/File_Generate/ReRunCMake-result.txt
 delete mode 100644 Tests/RunCMake/File_Generate/WriteIfDifferent-result.txt


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list