1
0
Эх сурвалжийг харах

Merge topic 'fix-include_regular_expression-subdir'

2d64f9f0 include_regular_expression: Fix propagation to subdirectories

Acked-by: Kitware Robot <[email protected]>
Merge-request: !1690
Brad King 7 жил өмнө
parent
commit
03050c5689

+ 6 - 0
Source/cmStateSnapshot.cxx

@@ -386,6 +386,12 @@ void cmStateSnapshot::InitializeFromParent()
     parent->BuildSystemDirectory->CompileOptionsBacktraces,
     this->Position->BuildSystemDirectory->CompileOptionsBacktraces,
     this->Position->CompileOptionsPosition);
+
+  const char* include_regex =
+    parent->BuildSystemDirectory->Properties.GetPropertyValue(
+      "INCLUDE_REGULAR_EXPRESSION");
+  this->Position->BuildSystemDirectory->Properties.SetProperty(
+    "INCLUDE_REGULAR_EXPRESSION", include_regex);
 }
 
 cmState* cmStateSnapshot::GetState() const

+ 4 - 0
Tests/RunCMake/Make/IncludeRegexSubdir-check.cmake

@@ -0,0 +1,4 @@
+include("${RunCMake_TEST_BINARY_DIR}/IncludeRegexSubdir/CMakeFiles/CMakeDirectoryInformation.cmake" OPTIONAL)
+if(NOT CMAKE_C_INCLUDE_REGEX_SCAN STREQUAL "^custom_include_regex$")
+  set(RunCMake_TEST_FAILED "CMAKE_C_INCLUDE_REGEX_SCAN has unexpected value:\n \"${CMAKE_C_INCLUDE_REGEX_SCAN}\"")
+endif()

+ 3 - 0
Tests/RunCMake/Make/IncludeRegexSubdir.cmake

@@ -0,0 +1,3 @@
+enable_language(C)
+include_regular_expression("^custom_include_regex$")
+add_subdirectory(IncludeRegexSubdir)

+ 1 - 0
Tests/RunCMake/Make/IncludeRegexSubdir/CMakeLists.txt

@@ -0,0 +1 @@
+# We only need this directory to be processed.  No targets needed.

+ 1 - 0
Tests/RunCMake/Make/RunCMakeTest.cmake

@@ -17,3 +17,4 @@ run_TargetMessages(VAR-ON -DCMAKE_TARGET_MESSAGES=ON)
 run_TargetMessages(VAR-OFF -DCMAKE_TARGET_MESSAGES=OFF)
 
 run_cmake(CustomCommandDepfile-ERROR)
+run_cmake(IncludeRegexSubdir)