summaryrefslogtreecommitdiffstats
path: root/Tests/ObjCXX
diff options
context:
space:
mode:
authorCristian Adam <cristian.adam@gmail.com>2020-09-29 15:24:27 (GMT)
committerBrad King <brad.king@kitware.com>2020-09-29 16:35:49 (GMT)
commit8a2977ba55367c91f2f66055ea2cc1304e1a42b1 (patch)
treecdae0c1c41a4d58f14ff0949c5fe9ee708c7d123 /Tests/ObjCXX
parent7d4e9a3a3a579db66b2850beee9b70cd8e5fa6fa (diff)
downloadCMake-8a2977ba55367c91f2f66055ea2cc1304e1a42b1.zip
CMake-8a2977ba55367c91f2f66055ea2cc1304e1a42b1.tar.gz
CMake-8a2977ba55367c91f2f66055ea2cc1304e1a42b1.tar.bz2
OBJCXX: Fix regression for compiling cpp files as objcxx
In commit 8d61294c3e (PCH: Mark CMake PCH source files as -x <lang>-header, 2020-09-04, v3.18.3~14^2) we removed the explicit `-x objective-c++` flag. This broke cases with custom source extensions. Restore the explicit `-x objective-c[++]` flag and put it before the `<FLAGS>` placeholder. The latter will contain the proper `-x objective-c[++]-header` value and will override the `-x objective-c[++]` value set before. Fixes: #21234
Diffstat (limited to 'Tests/ObjCXX')
-rw-r--r--Tests/ObjCXX/CMakeLists.txt1
-rw-r--r--Tests/ObjCXX/cxx-as-objcxx/CMakeLists.txt5
-rw-r--r--Tests/ObjCXX/cxx-as-objcxx/main.cpp6
3 files changed, 12 insertions, 0 deletions
diff --git a/Tests/ObjCXX/CMakeLists.txt b/Tests/ObjCXX/CMakeLists.txt
index a2a907a..cf03771 100644
--- a/Tests/ObjCXX/CMakeLists.txt
+++ b/Tests/ObjCXX/CMakeLists.txt
@@ -2,3 +2,4 @@ ADD_TEST_MACRO(ObjCXX.ObjC++ ObjC++)
ADD_TEST_MACRO(ObjCXX.simple-build-test simple-build-test)
ADD_TEST_MACRO(ObjCXX.cxx-file-extension-test cxx-file-extension-test)
ADD_TEST_MACRO(ObjCXX.objcxx-file-extension-test objcxx-file-extension-test)
+ADD_TEST_MACRO(ObjCXX.cxx-as-objcxx cxx-as-objcxx)
diff --git a/Tests/ObjCXX/cxx-as-objcxx/CMakeLists.txt b/Tests/ObjCXX/cxx-as-objcxx/CMakeLists.txt
new file mode 100644
index 0000000..23f6891
--- /dev/null
+++ b/Tests/ObjCXX/cxx-as-objcxx/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 3.18)
+project(cxx-as-objcxx LANGUAGES OBJCXX)
+
+add_executable(cxx-as-objcxx main.cpp)
+set_source_files_properties(main.cpp PROPERTIES LANGUAGE OBJCXX)
diff --git a/Tests/ObjCXX/cxx-as-objcxx/main.cpp b/Tests/ObjCXX/cxx-as-objcxx/main.cpp
new file mode 100644
index 0000000..701c567
--- /dev/null
+++ b/Tests/ObjCXX/cxx-as-objcxx/main.cpp
@@ -0,0 +1,6 @@
+#import <Foundation/Foundation.h>
+
+int main(int argc, char* argv[])
+{
+ return 0;
+}