mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-21 21:58:50 -05:00
Tests/CXXModules: add a test case for VS generation without flags
Previously, the `ScanSourceForModuleDependencies` flag was not added to the VS project if "nothing" prompted custom flags. See: #25519
This commit is contained in:
@@ -170,6 +170,7 @@ run_cxx_module_test(scan-with-pch)
|
||||
# Tests which use named modules.
|
||||
if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION)
|
||||
run_cxx_module_test(simple)
|
||||
run_cxx_module_test(vs-without-flags)
|
||||
run_cxx_module_test(library library-static -DBUILD_SHARED_LIBS=OFF)
|
||||
run_cxx_module_test(object-library)
|
||||
run_cxx_module_test(generated)
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
cmake_minimum_required(VERSION 3.28)
|
||||
project(cxx_modules_vs_without_flags CXX)
|
||||
|
||||
include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_SCAN_FOR_MODULES ON)
|
||||
|
||||
add_executable(vs_without_flags)
|
||||
target_sources(vs_without_flags
|
||||
PRIVATE
|
||||
main.cxx
|
||||
PRIVATE
|
||||
FILE_SET CXX_MODULES
|
||||
BASE_DIRS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
FILES
|
||||
module.cxx)
|
||||
|
||||
add_test(NAME vs_without_flags COMMAND vs_without_flags)
|
||||
@@ -0,0 +1,6 @@
|
||||
import mod;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
return f();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export module mod;
|
||||
|
||||
export int f()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user