mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-24 07:08:38 -05:00
cxxmodules: detect and message about non-compiled sources
Previously an internal error was raised which ended up causing an internal exception to be thrown. This is a typo situation that should fall into an explicit error. Fixes: #25207
This commit is contained in:
@@ -15,6 +15,11 @@ CMake Error in CMakeLists.txt:
|
||||
been enabled
|
||||
| The "nocxx" target contains C\+\+ module sources which are not supported by
|
||||
the generator
|
||||
| Target "nocxx" has source file
|
||||
|
||||
.*/Tests/RunCMake/CXXModules/sources/module.cxx
|
||||
|
||||
in a "FILE_SET TYPE CXX_MODULES" but it is not scheduled for compilation.
|
||||
)
|
||||
)*
|
||||
CMake Generate step failed. Build files cannot be regenerated correctly.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,16 @@
|
||||
CMake Warning \(dev\) at NotCompiledSourceModules.cmake:5 \(target_sources\):
|
||||
CMake's C\+\+ module support is experimental. It is meant only for
|
||||
experimentation and feedback to CMake developers.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:6 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||
|
||||
(CMake Error in CMakeLists.txt:
|
||||
Target "not-cxx-source" has source file
|
||||
|
||||
.*/Tests/RunCMake/CXXModules/sources/not-compiled.txt
|
||||
|
||||
in a "FILE_SET TYPE CXX_MODULES" but it is not scheduled for compilation.
|
||||
|
||||
)+
|
||||
CMake Generate step failed. Build files cannot be regenerated correctly.
|
||||
@@ -0,0 +1,13 @@
|
||||
enable_language(CXX)
|
||||
set(CMAKE_EXPERIMENTAL_CXX_SCANDEP_SOURCE "")
|
||||
|
||||
add_library(not-cxx-source)
|
||||
target_sources(not-cxx-source
|
||||
PRIVATE
|
||||
sources/cxx-anchor.cxx
|
||||
PUBLIC
|
||||
FILE_SET fs TYPE CXX_MODULES FILES
|
||||
sources/not-compiled.txt)
|
||||
target_compile_features(not-cxx-source
|
||||
PRIVATE
|
||||
cxx_std_20)
|
||||
@@ -71,8 +71,9 @@ foreach (fileset_type IN LISTS fileset_types)
|
||||
endforeach ()
|
||||
run_cmake("FileSet${fileset_type}InterfaceImported")
|
||||
|
||||
# Test the error message when a non-C++ source file is found in the source
|
||||
# Test the error messages when a non-C++ source file is found in the source
|
||||
# list.
|
||||
run_cmake("NotCompiledSource${fileset_type}")
|
||||
run_cmake("NotCXXSource${fileset_type}")
|
||||
endforeach ()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user