mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-23 15:11:01 -06:00
Tests/RunCMake/CXXModules: mask scanning checks without control
In Visual Studio, there is no mechanism to tell scanning apart from non-scanning, so skip the sanity checks.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
CMake Warning \(dev\) at CMakeLists.txt:20 \(target_sources\):
|
||||
CMake Warning \(dev\) at CMakeLists.txt:25 \(target_sources\):
|
||||
CMake's C\+\+ module support is experimental. It is meant only for
|
||||
experimentation and feedback to CMake developers.
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||
|
||||
@@ -3,6 +3,11 @@ project(scan_properties CXX)
|
||||
|
||||
include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
|
||||
|
||||
set(scanning_control 1)
|
||||
if (CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
set(scanning_control 0)
|
||||
endif ()
|
||||
|
||||
# To detect that not-to-be scanned sources are not scanned, add a `-D` to the
|
||||
# scan flags so that the files can detect whether scanning happened and error
|
||||
# if not.
|
||||
@@ -31,6 +36,7 @@ target_sources(scans_everything
|
||||
module.cxx)
|
||||
target_compile_features(scans_everything PRIVATE cxx_std_20)
|
||||
target_compile_definitions(scans_everything PRIVATE SCAN_AT_TARGET_LEVEL=1)
|
||||
target_compile_definitions(scans_everything PRIVATE "SCANNING_CONTROL=${scanning_control}")
|
||||
|
||||
set(CMAKE_CXX_SCAN_FOR_MODULES 0)
|
||||
|
||||
@@ -49,6 +55,7 @@ target_sources(no_scan_everything
|
||||
module.cxx)
|
||||
target_compile_features(no_scan_everything PRIVATE cxx_std_20)
|
||||
target_compile_definitions(no_scan_everything PRIVATE SCAN_AT_TARGET_LEVEL=0)
|
||||
target_compile_definitions(no_scan_everything PRIVATE "SCANNING_CONTROL=${scanning_control}")
|
||||
|
||||
add_test(NAME scanned COMMAND scans_everything)
|
||||
add_test(NAME unscanned COMMAND no_scan_everything)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#ifndef CMAKE_SCANNED_THIS_SOURCE
|
||||
# error "This file should have been scanned"
|
||||
#if SCANNING_CONTROL
|
||||
# ifndef CMAKE_SCANNED_THIS_SOURCE
|
||||
# error "This file should have been scanned"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
import M;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#if SCAN_AT_TARGET_LEVEL
|
||||
# ifndef CMAKE_SCANNED_THIS_SOURCE
|
||||
# error "This file should have been scanned"
|
||||
# endif
|
||||
#else
|
||||
# ifdef CMAKE_SCANNED_THIS_SOURCE
|
||||
# error "This file should not have been scanned"
|
||||
#if SCANNING_CONTROL
|
||||
# if SCAN_AT_TARGET_LEVEL
|
||||
# ifndef CMAKE_SCANNED_THIS_SOURCE
|
||||
# error "This file should have been scanned"
|
||||
# endif
|
||||
# else
|
||||
# ifdef CMAKE_SCANNED_THIS_SOURCE
|
||||
# error "This file should not have been scanned"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#if SCAN_AT_TARGET_LEVEL
|
||||
# ifndef CMAKE_SCANNED_THIS_SOURCE
|
||||
# error "This file should have been scanned"
|
||||
# endif
|
||||
#else
|
||||
# ifdef CMAKE_SCANNED_THIS_SOURCE
|
||||
# error "This file should not have been scanned"
|
||||
#if SCANNING_CONTROL
|
||||
# if SCAN_AT_TARGET_LEVEL
|
||||
# ifndef CMAKE_SCANNED_THIS_SOURCE
|
||||
# error "This file should have been scanned"
|
||||
# endif
|
||||
# else
|
||||
# ifdef CMAKE_SCANNED_THIS_SOURCE
|
||||
# error "This file should not have been scanned"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#ifndef CMAKE_SCANNED_THIS_SOURCE
|
||||
# error "This file should have been scanned"
|
||||
#if SCANNING_CONTROL
|
||||
# ifndef CMAKE_SCANNED_THIS_SOURCE
|
||||
# error "This file should have been scanned"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
export module M;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#ifdef CMAKE_SCANNED_THIS_SOURCE
|
||||
# error "This file should not have been scanned"
|
||||
#if SCANNING_CONTROL
|
||||
# ifdef CMAKE_SCANNED_THIS_SOURCE
|
||||
# error "This file should not have been scanned"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int never_scan()
|
||||
|
||||
Reference in New Issue
Block a user