-
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 'duplicate-source-behavior' into release-3.31
3e15419 target_sources: Restore toleration of duplicate CXX_MODULES sources 5cfb8ae Tests/CXXModules: add a test with duplicate sources Acked-by: Kitware Robot <[email protected]> Tested-by: buildbot <[email protected]> Merge-request: !10155
- Loading branch information
Showing
6 changed files
with
55 additions
and
0 deletions.
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
8 changes: 8 additions & 0 deletions
8
Tests/RunCMake/CXXModules/examples/duplicate-sources-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,8 @@ | ||
CMake Warning \(dev\) in CMakeLists.txt: | ||
Target "duplicate_sources" has source file | ||
|
||
[^ | ||
]*/Tests/RunCMake/CXXModules/examples/duplicate-sources/duplicate.cxx | ||
|
||
in a "FILE_SET TYPE CXX_MODULES" multiple times. | ||
This warning is for project developers. Use -Wno-dev to suppress it. |
19 changes: 19 additions & 0 deletions
19
Tests/RunCMake/CXXModules/examples/duplicate-sources/CMakeLists.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,19 @@ | ||
cmake_minimum_required(VERSION 3.31) | ||
project(cxx_modules_duplicate_sources CXX) | ||
|
||
include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") | ||
|
||
add_executable(duplicate_sources) | ||
target_sources(duplicate_sources | ||
PRIVATE | ||
main.cxx | ||
PRIVATE | ||
FILE_SET CXX_MODULES | ||
BASE_DIRS | ||
"${CMAKE_CURRENT_SOURCE_DIR}" | ||
FILES | ||
duplicate.cxx | ||
duplicate.cxx) | ||
target_compile_features(duplicate_sources PRIVATE cxx_std_20) | ||
|
||
add_test(NAME duplicate_sources COMMAND duplicate_sources) |
8 changes: 8 additions & 0 deletions
8
Tests/RunCMake/CXXModules/examples/duplicate-sources/duplicate.cxx
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,8 @@ | ||
module; | ||
|
||
export module duplicate; | ||
|
||
export int from_import() | ||
{ | ||
return 0; | ||
} |
6 changes: 6 additions & 0 deletions
6
Tests/RunCMake/CXXModules/examples/duplicate-sources/main.cxx
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 duplicate; | ||
|
||
int main() | ||
{ | ||
return from_import(); | ||
} |