-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge topic 'cxxmodules-vs-no-synthetic-targets' into release-3.28
17fd7fe Tests/CXXModules: test Visual Studio synthetic target error badb6ab VS: Explicitly disallow C++ modules provided by imported targets Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8895
- Loading branch information
Showing
8 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Tests/RunCMake/CXXModules/VisualStudioNoSyntheticTargets-result.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 |
6 changes: 6 additions & 0 deletions
6
Tests/RunCMake/CXXModules/VisualStudioNoSyntheticTargets-stderr.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
^(CMake Error in CMakeLists.txt: | ||
Target "imported-cxx-modules@synth_[0-9a-f]+" contains C\+\+ modules | ||
intended for BMI-only compilation. This is not yet supported by the Visual | ||
Studio generator. | ||
* | ||
)+CMake Generate step failed. Build files cannot be regenerated correctly. |
27 changes: 27 additions & 0 deletions
27
Tests/RunCMake/CXXModules/VisualStudioNoSyntheticTargets.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
enable_language(CXX) | ||
|
||
if (NOT CMAKE_GENERATOR MATCHES "Visual Studio") | ||
message(FATAL_ERROR | ||
"This test requires a 'Visual Studio' generator to be used.") | ||
endif () | ||
|
||
add_library(imported-cxx-modules IMPORTED INTERFACE) | ||
target_sources(imported-cxx-modules | ||
INTERFACE | ||
FILE_SET modules TYPE CXX_MODULES | ||
BASE_DIRS | ||
"${CMAKE_CURRENT_SOURCE_DIR}/sources" | ||
FILES | ||
sources/module-simple.cxx) | ||
set_target_properties(imported-cxx-modules PROPERTIES | ||
IMPORTED_CONFIGURATIONS DEBUG | ||
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" | ||
IMPORTED_CXX_MODULES_COMPILE_FEATURES "cxx_std_20" | ||
INTERFACE_COMPILE_FEATURES "cxx_std_20" | ||
IMPORTED_CXX_MODULES_DEBUG "simple=${CMAKE_CURRENT_SOURCE_DIR}/sources/module-simple.cxx") | ||
|
||
add_executable(vs-use-imported-cxx-modules | ||
sources/module-simple-use.cxx) | ||
target_link_libraries(vs-use-imported-cxx-modules | ||
PRIVATE | ||
imported-cxx-modules) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import simple; | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
return g(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export module simple; | ||
|
||
int g() | ||
{ | ||
return 0; | ||
} |