summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-03-10 16:08:02 +0000
committerKitware Robot <kwrobot@kitware.com>2023-03-10 11:08:11 -0500
commitd95ac61225bc216ba81342f82ec5d2903cdc0294 (patch)
tree5e071befc4549477dceee3cd0475d37adf2cf584
parent9cf38e7b14daf96d6f2bda4b6a910b4de17d5f3d (diff)
parent45d1925efc5ed19066d179ed15bfbcb6ae31ae9a (diff)
downloadcmake-d95ac61225bc216ba81342f82ec5d2903cdc0294.tar.gz
Merge topic 'cxx-module-extensions'
45d1925efc Treat '.ccm', '.cxxm', and '.c++m' files as C++ sources 8c96d145c1 Tests/RunCMake: Match 'Tried extensions' output more robustly Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Acked-by: Ben Boeckel <ben.boeckel@kitware.com> Merge-request: !8308
-rw-r--r--Help/release/dev/cxx-module-extensions.rst5
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in2
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmSourceFile.h4
-rw-r--r--Source/cmake.cxx2
-rw-r--r--Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0115/CMP0115-WARN-stderr.txt8
-rw-r--r--Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-stderr.txt8
-rw-r--r--Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW.cmake2
-rw-r--r--Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-stderr.txt11
-rw-r--r--Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD.cmake2
-rw-r--r--Tests/RunCMake/InterfaceLibrary/global-interface-stderr.txt6
-rw-r--r--Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt6
-rw-r--r--Tests/RunCMake/target_sources/FileSetDirect-stderr.txt6
-rw-r--r--Tests/RunCMake/target_sources/FileSetWrongSyntax-stderr.txt6
15 files changed, 39 insertions, 39 deletions
diff --git a/Help/release/dev/cxx-module-extensions.rst b/Help/release/dev/cxx-module-extensions.rst
new file mode 100644
index 0000000000..92df86a51e
--- /dev/null
+++ b/Help/release/dev/cxx-module-extensions.rst
@@ -0,0 +1,5 @@
+cxx-module-extensions
+---------------------
+
+* Source file extensions ``.ccm``, ``.cxxm``, or ``.c++m`` are now
+ treated as C++.
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index dcfff6fb8f..834c2e6b17 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -37,7 +37,7 @@ set(CMAKE_CXX_ABI_COMPILED @CMAKE_CXX_ABI_COMPILED@)
set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
set(CMAKE_CXX_COMPILER_ID_RUN 1)
-set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm)
+set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm;ccm;cxxm;c++m)
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
foreach (lang C OBJC OBJCXX)
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 33843e2916..3fcc7f7c7e 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1229,7 +1229,7 @@ void cmMakefile::AddCustomCommandOldStyle(
// Each output must get its own copy of this rule.
cmsys::RegularExpression sourceFiles(
- "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|mpp|ixx|cppm|cu|m|mm|"
+ "\\.(C|M|c|c\\+\\+|cc|cpp|cxx|mpp|ixx|cppm|ccm|cxxm|c\\+\\+m|cu|m|mm|"
"rc|def|r|odl|idl|hpj|bat|h|h\\+\\+|"
"hm|hpp|hxx|in|txx|inl)$");
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index c1c52010c8..9308af4430 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -183,8 +183,8 @@ private:
#define CM_HEADER_REGEX "\\.(h|hh|h\\+\\+|hm|hpp|hxx|in|txx|inl)$"
#define CM_SOURCE_REGEX \
- "\\.(C|F|M|c|c\\+\\+|cc|cpp|mpp|cxx|ixx|cppm|cu|f|f90|for|fpp|ftn|m|mm|" \
- "rc|def|r|odl|idl|hpj|bat)$"
+ "\\.(C|F|M|c|c\\+\\+|cc|cpp|mpp|cxx|ixx|cppm|ccm|cxxm|c\\+\\+m|cu" \
+ "|f|f90|for|fpp|ftn|m|mm|rc|def|r|odl|idl|hpj|bat)$"
#define CM_PCH_REGEX "cmake_pch(_[^.]+)?\\.(h|hxx)$"
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index dbf961de7d..d4bbc148d6 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -335,7 +335,7 @@ cmake::cmake(Role role, cmState::Mode mode, cmState::ProjectKind projectKind)
// The "c" extension MUST precede the "C" extension.
setupExts(this->CLikeSourceFileExtensions,
{ "c", "C", "c++", "cc", "cpp", "cxx", "cu", "mpp", "m", "M",
- "mm", "ixx", "cppm" });
+ "mm", "ixx", "cppm", "ccm", "cxxm", "c++m" });
setupExts(this->HeaderFileExtensions,
{ "h", "hh", "h++", "hm", "hpp", "hxx", "in", "txx" });
setupExts(this->CudaFileExtensions, { "cu" });
diff --git a/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt b/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt
index 8b9031111d..67d00f75dd 100644
--- a/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt
+++ b/Tests/RunCMake/CMP0115/CMP0115-OLD-stderr.txt
@@ -3,11 +3,9 @@
noexist
- Tried extensions [^
-]*
- [^
-]*
-Call Stack \(most recent call first\):
+ Tried extensions ([^
+]+
+)+Call Stack \(most recent call first\):
CMP0115-OLD\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0115/CMP0115-WARN-stderr.txt b/Tests/RunCMake/CMP0115/CMP0115-WARN-stderr.txt
index 7b100b6e4c..e79ca97be2 100644
--- a/Tests/RunCMake/CMP0115/CMP0115-WARN-stderr.txt
+++ b/Tests/RunCMake/CMP0115/CMP0115-WARN-stderr.txt
@@ -17,11 +17,9 @@ CMake Error at CMP0115\.cmake:[0-9]+ \(add_executable\):
noexist
- Tried extensions [^
-]*
- [^
-]*
-Call Stack \(most recent call first\):
+ Tried extensions ([^
+]+
+)+Call Stack \(most recent call first\):
CMP0115-WARN\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-stderr.txt b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-stderr.txt
index f51d05a355..b47a137c2f 100644
--- a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-stderr.txt
+++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW-stderr.txt
@@ -3,9 +3,9 @@
.*\/relative-output-NEW\.c
- Tried extensions \.c \.C.*
-Call Stack \(most recent call first\):
+ Tried extensions ([^
+]+
+)+Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
-
-
++
CMake Generate step failed. Build files cannot be regenerated correctly.$
diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW.cmake b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW.cmake
index d2b3e0c0a9..16d5563b97 100644
--- a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW.cmake
+++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-NEW.cmake
@@ -1,5 +1,5 @@
enable_language(C)
-add_library(foo)
+add_library(foo empty.c)
cmake_policy(SET CMP0070 NEW)
file(GENERATE OUTPUT relative-output-NEW.c CONTENT "")
diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-stderr.txt b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-stderr.txt
index 07b0026757..39735d717d 100644
--- a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-stderr.txt
+++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD-stderr.txt
@@ -8,16 +8,15 @@
behavior and not rely on setting a policy to OLD.
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
-
-
++
CMake Error at SourceProperty-CMP0070-OLD.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
.*\/relative-output-OLD\.c
- Tried extensions \.c \.C.*
-Call Stack \(most recent call first\):
+ Tried extensions ([^
+]+
+)+Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
-
-
++
CMake Generate step failed. Build files cannot be regenerated correctly.$
diff --git a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD.cmake b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD.cmake
index 48eae1e450..4f566b095e 100644
--- a/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD.cmake
+++ b/Tests/RunCMake/File_Generate/SourceProperty-CMP0070-OLD.cmake
@@ -1,5 +1,5 @@
enable_language(C)
-add_library(foo)
+add_library(foo empty.c)
cmake_policy(SET CMP0070 OLD)
file(GENERATE OUTPUT relative-output-OLD.c CONTENT "")
diff --git a/Tests/RunCMake/InterfaceLibrary/global-interface-stderr.txt b/Tests/RunCMake/InterfaceLibrary/global-interface-stderr.txt
index 38585ebdd1..352bb68a09 100644
--- a/Tests/RunCMake/InterfaceLibrary/global-interface-stderr.txt
+++ b/Tests/RunCMake/InterfaceLibrary/global-interface-stderr.txt
@@ -3,7 +3,7 @@ CMake Error at global-interface.cmake:2 \(add_library\):
GLOBAL
- Tried extensions \.c \.C .*
-.*
-Call Stack \(most recent call first\):
+ Tried extensions ([^
+]+
+)+Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt b/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt
index 5c7882d688..05eb42d5ea 100644
--- a/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt
+++ b/Tests/RunCMake/ObjectLibrary/MissingSource-stderr.txt
@@ -3,7 +3,7 @@ CMake Error at MissingSource.cmake:1 \(add_library\):
missing.c
- Tried extensions \.c \.C .*
-.*
-Call Stack \(most recent call first\):
+ Tried extensions ([^
+]+
+)+Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/target_sources/FileSetDirect-stderr.txt b/Tests/RunCMake/target_sources/FileSetDirect-stderr.txt
index c1f76353e1..06458b9800 100644
--- a/Tests/RunCMake/target_sources/FileSetDirect-stderr.txt
+++ b/Tests/RunCMake/target_sources/FileSetDirect-stderr.txt
@@ -3,9 +3,9 @@ CMake Error at FileSetDirect.cmake:3 \(add_library\):
FILE_SET
- Tried extensions .c .C .c\+\+ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
- .hh .h\+\+ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc
-
+ Tried extensions ([^
+]+
+)+
Hint: the FILE_SET keyword may only appear after a visibility specifier or
another FILE_SET within the target_sources\(\) command.
Call Stack \(most recent call first\):
diff --git a/Tests/RunCMake/target_sources/FileSetWrongSyntax-stderr.txt b/Tests/RunCMake/target_sources/FileSetWrongSyntax-stderr.txt
index abfbe29fb7..01db0022bf 100644
--- a/Tests/RunCMake/target_sources/FileSetWrongSyntax-stderr.txt
+++ b/Tests/RunCMake/target_sources/FileSetWrongSyntax-stderr.txt
@@ -3,9 +3,9 @@ CMake Error at FileSetWrongSyntax.cmake:4 \(target_sources\):
FILE_SET
- Tried extensions .c .C .c\+\+ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
- .hh .h\+\+ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc
-
+ Tried extensions ([^
+]+
+)+
Hint: the FILE_SET keyword may only appear after a visibility specifier or
another FILE_SET within the target_sources\(\) command.
Call Stack \(most recent call first\):