浏览代码

CMP0063: Split unit test by target type.

Don't rely on the order of warnings for targets being deterministic.
Stephen Kelly 10 年之前
父节点
当前提交
726e461b38

+ 15 - 0
Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe-stderr.txt

@@ -0,0 +1,15 @@
+CMake Warning \(dev\) at CMP0063-WARN-exe.cmake:[0-9]+ \(add_executable\):
+  Policy CMP0063 is not set: Honor visibility properties for all target
+  types.  Run "cmake --help-policy CMP0063" for policy details.  Use the
+  cmake_policy command to set the policy and suppress this warning.
+
+  Target "myexe" of type "EXECUTABLE" has the following visibility properties
+  set for CXX:
+
+    CXX_VISIBILITY_PRESET
+    VISIBILITY_INLINES_HIDDEN
+
+  For compatibility CMake is not honoring them for this target.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers.  Use -Wno-dev to suppress it.

+ 4 - 1
Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes.cmake → Tests/RunCMake/VisibilityPreset/CMP0063-WARN-exe.cmake

@@ -5,4 +5,7 @@ enable_language(CXX)
 set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
 set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
 
-include(CMP0063-Common.cmake)
+set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
+set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+
+add_executable(myexe lib.cpp)

+ 15 - 0
Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj-stderr.txt

@@ -0,0 +1,15 @@
+CMake Warning \(dev\) at CMP0063-WARN-obj.cmake:[0-9]+ \(add_library\):
+  Policy CMP0063 is not set: Honor visibility properties for all target
+  types.  Run "cmake --help-policy CMP0063" for policy details.  Use the
+  cmake_policy command to set the policy and suppress this warning.
+
+  Target "myobject" of type "OBJECT_LIBRARY" has the following visibility
+  properties set for CXX:
+
+    CXX_VISIBILITY_PRESET
+    VISIBILITY_INLINES_HIDDEN
+
+  For compatibility CMake is not honoring them for this target.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers.  Use -Wno-dev to suppress it.

+ 11 - 0
Tests/RunCMake/VisibilityPreset/CMP0063-WARN-obj.cmake

@@ -0,0 +1,11 @@
+
+enable_language(CXX)
+
+# Ensure CMake warns even if toolchain does not really have these flags.
+set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
+set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+
+set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
+set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+
+add_library(myobject OBJECT lib.cpp)

+ 15 - 0
Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta-stderr.txt

@@ -0,0 +1,15 @@
+CMake Warning \(dev\) at CMP0063-WARN-sta.cmake:[0-9]+ \(add_library\):
+  Policy CMP0063 is not set: Honor visibility properties for all target
+  types.  Run "cmake --help-policy CMP0063" for policy details.  Use the
+  cmake_policy command to set the policy and suppress this warning.
+
+  Target "mystatic" of type "STATIC_LIBRARY" has the following visibility
+  properties set for CXX:
+
+    CXX_VISIBILITY_PRESET
+    VISIBILITY_INLINES_HIDDEN
+
+  For compatibility CMake is not honoring them for this target.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers.  Use -Wno-dev to suppress it.

+ 11 - 0
Tests/RunCMake/VisibilityPreset/CMP0063-WARN-sta.cmake

@@ -0,0 +1,11 @@
+
+enable_language(CXX)
+
+# Ensure CMake warns even if toolchain does not really have these flags.
+set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
+set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
+
+set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
+set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+
+add_library(mystatic STATIC lib.cpp)

+ 0 - 50
Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes-stderr.txt

@@ -1,50 +0,0 @@
-^CMake Warning \(dev\) at CMP0063-Common.cmake:[0-9]+ \(add_executable\):
-  Policy CMP0063 is not set: Honor visibility properties for all target
-  types.  Run "cmake --help-policy CMP0063" for policy details.  Use the
-  cmake_policy command to set the policy and suppress this warning.
-
-  Target "myexe" of type "EXECUTABLE" has the following visibility properties
-  set for CXX:
-
-    CXX_VISIBILITY_PRESET
-    VISIBILITY_INLINES_HIDDEN
-
-  For compatibility CMake is not honoring them for this target.
-Call Stack \(most recent call first\):
-  CMP0063-WARN-yes.cmake:[0-9]+ \(include\)
-  CMakeLists.txt:[0-9]+ \(include\)
-This warning is for project developers.  Use -Wno-dev to suppress it.
-+
-CMake Warning \(dev\) at CMP0063-Common.cmake:[0-9]+ \(add_library\):
-  Policy CMP0063 is not set: Honor visibility properties for all target
-  types.  Run "cmake --help-policy CMP0063" for policy details.  Use the
-  cmake_policy command to set the policy and suppress this warning.
-
-  Target "myobject" of type "OBJECT_LIBRARY" has the following visibility
-  properties set for CXX:
-
-    CXX_VISIBILITY_PRESET
-    VISIBILITY_INLINES_HIDDEN
-
-  For compatibility CMake is not honoring them for this target.
-Call Stack \(most recent call first\):
-  CMP0063-WARN-yes.cmake:[0-9]+ \(include\)
-  CMakeLists.txt:[0-9]+ \(include\)
-This warning is for project developers.  Use -Wno-dev to suppress it.
-+
-CMake Warning \(dev\) at CMP0063-Common.cmake:[0-9]+ \(add_library\):
-  Policy CMP0063 is not set: Honor visibility properties for all target
-  types.  Run "cmake --help-policy CMP0063" for policy details.  Use the
-  cmake_policy command to set the policy and suppress this warning.
-
-  Target "mystatic" of type "STATIC_LIBRARY" has the following visibility
-  properties set for CXX:
-
-    CXX_VISIBILITY_PRESET
-    VISIBILITY_INLINES_HIDDEN
-
-  For compatibility CMake is not honoring them for this target.
-Call Stack \(most recent call first\):
-  CMP0063-WARN-yes.cmake:[0-9]+ \(include\)
-  CMakeLists.txt:[0-9]+ \(include\)
-This warning is for project developers.  Use -Wno-dev to suppress it.$

+ 3 - 1
Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake

@@ -2,6 +2,8 @@ include(RunCMake)
 
 run_cmake(PropertyTypo)
 run_cmake(CMP0063-OLD)
-run_cmake(CMP0063-WARN-yes)
+run_cmake(CMP0063-WARN-exe)
+run_cmake(CMP0063-WARN-obj)
+run_cmake(CMP0063-WARN-sta)
 run_cmake(CMP0063-WARN-no)
 run_cmake(CMP0063-NEW)