summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-05-26 13:24:00 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-05-26 13:24:00 (GMT)
commit12b9005d7c015b1f8cece5a9d8cf5f1a9f4a18fa (patch)
treee51e518ba0502ff060785f2276fd5d2347437cda /Tests/RunCMake
parent129bf45dee4d6fc4cca8103235013b60464660f2 (diff)
parent700f1c3b2b379f2af63ba97b93348ff66069a388 (diff)
downloadCMake-12b9005d7c015b1f8cece5a9d8cf5f1a9f4a18fa.zip
CMake-12b9005d7c015b1f8cece5a9d8cf5f1a9f4a18fa.tar.gz
CMake-12b9005d7c015b1f8cece5a9d8cf5f1a9f4a18fa.tar.bz2
Merge topic 'extend-visibility-properties'
700f1c3b Honor visibility properties for all target types (#15556) 50de5dbb Help: Format visibility property and variable documentation 771f1b00 Tests: Rename Visibility{InlinesHidden =>} ab55b3b5 Tests: Refactor RunCMake.VisibilityPreset test setup
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakeLists.txt19
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt1
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-Common.cmake7
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-NEW.cmake8
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-OLD.cmake8
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no.cmake8
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes-stderr.txt50
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes.cmake8
-rw-r--r--Tests/RunCMake/VisibilityPreset/CMakeLists.txt9
-rw-r--r--Tests/RunCMake/VisibilityPreset/PropertyTypo.cmake5
-rw-r--r--Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake4
11 files changed, 104 insertions, 23 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 2100b55..592b5e4 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -105,22 +105,9 @@ add_RunCMake_test(CompileFeatures)
add_RunCMake_test(WriteCompilerDetectionHeader)
if(NOT WIN32)
add_RunCMake_test(PositionIndependentCode)
- set(SKIP_VISIBILITY 0)
- if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 4.2)
- set(SKIP_VISIBILITY 1)
- endif()
-
- if (CMAKE_CXX_COMPILER_ID MATCHES Watcom
- OR CMAKE_SYSTEM_NAME MATCHES IRIX64
- OR CMAKE_CXX_COMPILER_ID MATCHES HP
- OR CMAKE_CXX_COMPILER_ID MATCHES XL
- OR CMAKE_CXX_COMPILER_ID MATCHES SunPro)
- set(SKIP_VISIBILITY 1)
- endif()
-
- if (NOT SKIP_VISIBILITY)
- add_RunCMake_test(VisibilityPreset)
- endif()
+endif()
+if(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
+ add_RunCMake_test(VisibilityPreset)
endif()
if (QT4_FOUND)
set(CompatibleInterface_ARGS -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE})
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
index 1da1623..d0aa995 100644
--- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -18,6 +18,7 @@
\* CMP0046
\* CMP0052
\* CMP0060
+ \* CMP0063
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-Common.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-Common.cmake
new file mode 100644
index 0000000..afea20b
--- /dev/null
+++ b/Tests/RunCMake/VisibilityPreset/CMP0063-Common.cmake
@@ -0,0 +1,7 @@
+set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
+set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+add_executable(myexe lib.cpp)
+add_library(mystatic STATIC lib.cpp)
+add_library(myshared SHARED lib.cpp)
+add_library(mymodule MODULE lib.cpp)
+add_library(myobject OBJECT lib.cpp)
diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-NEW.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-NEW.cmake
new file mode 100644
index 0000000..9d1ee40
--- /dev/null
+++ b/Tests/RunCMake/VisibilityPreset/CMP0063-NEW.cmake
@@ -0,0 +1,8 @@
+cmake_policy(SET CMP0063 NEW)
+enable_language(CXX)
+
+# Ensure CMake would warn 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=")
+
+include(CMP0063-Common.cmake)
diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-OLD.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-OLD.cmake
new file mode 100644
index 0000000..8378209
--- /dev/null
+++ b/Tests/RunCMake/VisibilityPreset/CMP0063-OLD.cmake
@@ -0,0 +1,8 @@
+cmake_policy(SET CMP0063 OLD)
+enable_language(CXX)
+
+# Ensure CMake would warn 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=")
+
+include(CMP0063-Common.cmake)
diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no.cmake
new file mode 100644
index 0000000..2a9c9e5
--- /dev/null
+++ b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-no.cmake
@@ -0,0 +1,8 @@
+
+enable_language(CXX)
+
+# Ensure CMake does not warn even if toolchain really does have these flags.
+unset(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN)
+unset(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY)
+
+include(CMP0063-Common.cmake)
diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes-stderr.txt b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes-stderr.txt
new file mode 100644
index 0000000..59a4b8f
--- /dev/null
+++ b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes-stderr.txt
@@ -0,0 +1,50 @@
+^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.$
diff --git a/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes.cmake b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes.cmake
new file mode 100644
index 0000000..3388e4d
--- /dev/null
+++ b/Tests/RunCMake/VisibilityPreset/CMP0063-WARN-yes.cmake
@@ -0,0 +1,8 @@
+
+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=")
+
+include(CMP0063-Common.cmake)
diff --git a/Tests/RunCMake/VisibilityPreset/CMakeLists.txt b/Tests/RunCMake/VisibilityPreset/CMakeLists.txt
index 90afc12..18dfd26 100644
--- a/Tests/RunCMake/VisibilityPreset/CMakeLists.txt
+++ b/Tests/RunCMake/VisibilityPreset/CMakeLists.txt
@@ -1,8 +1,3 @@
-
-cmake_minimum_required(VERSION 2.8.4)
-project(${RunCMake_TEST} CXX)
-
-# MSVC creates extra targets which pollute the stderr unless we set this.
-set(CMAKE_SUPPRESS_REGENERATION TRUE)
-
+cmake_minimum_required(VERSION 3.2)
+project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/VisibilityPreset/PropertyTypo.cmake b/Tests/RunCMake/VisibilityPreset/PropertyTypo.cmake
index 03c0ed9..c6e9dd9 100644
--- a/Tests/RunCMake/VisibilityPreset/PropertyTypo.cmake
+++ b/Tests/RunCMake/VisibilityPreset/PropertyTypo.cmake
@@ -1,3 +1,8 @@
+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=")
add_library(visibility_preset SHARED lib.cpp)
set_property(TARGET visibility_preset PROPERTY CXX_VISIBILITY_PRESET hiden)
diff --git a/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake b/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake
index 2d78832..c7eb808 100644
--- a/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VisibilityPreset/RunCMakeTest.cmake
@@ -1,3 +1,7 @@
include(RunCMake)
run_cmake(PropertyTypo)
+run_cmake(CMP0063-OLD)
+run_cmake(CMP0063-WARN-yes)
+run_cmake(CMP0063-WARN-no)
+run_cmake(CMP0063-NEW)