[Cmake-commits] CMake branch, next, updated. v2.8.12.2-7357-ga5f7a74

Nils Gladitz nilsgladitz at gmail.com
Fri Jan 31 10:15:00 EST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  a5f7a74e3edd1dacddad9525e2de1baaacb0dce7 (commit)
       via  223494653c9cccf58b7bb0275c2636d96ef89a75 (commit)
       via  f35c01e2a5e3834094fbd98eccfc2a686872fceb (commit)
      from  02227888b572de741df035dd58f83deca21c5ff9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a5f7a74e3edd1dacddad9525e2de1baaacb0dce7
commit a5f7a74e3edd1dacddad9525e2de1baaacb0dce7
Merge: 0222788 2234946
Author:     Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Fri Jan 31 10:14:59 2014 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jan 31 10:14:59 2014 -0500

    Merge topic 'fix-visibility-inlines-hidden' into next
    
    22349465 VisibilityInlinesHidden: only apply -fvisibility-inlines-hidden to C++ sources
    f35c01e2 CMake Nightly Date Stamp


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=223494653c9cccf58b7bb0275c2636d96ef89a75
commit 223494653c9cccf58b7bb0275c2636d96ef89a75
Author:     Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Fri Jan 31 16:09:06 2014 +0100
Commit:     Nils Gladitz <nilsgladitz at gmail.com>
CommitDate: Fri Jan 31 16:09:06 2014 +0100

    VisibilityInlinesHidden: only apply -fvisibility-inlines-hidden to C++ sources

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index c13b8ee..a2a66ae 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2187,7 +2187,11 @@ void cmLocalGenerator
     return;
     }
   AddVisibilityCompileOption(flags, target, this, lang);
-  AddInlineVisibilityCompileOption(flags, target, this);
+
+  if(strcmp(lang, "CXX") == 0)
+    {
+    AddInlineVisibilityCompileOption(flags, target, this);
+    }
 }
 
 //----------------------------------------------------------------------------
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index a79111a..17fbc59 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -400,6 +400,28 @@ if(BUILD_TESTING)
     ADD_TEST_MACRO(PositionIndependentTargets PositionIndependentTargets)
   endif()
 
+  if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND
+    CMAKE_SYSTEM_NAME MATCHES "Linux")
+
+    include(CheckCXXCompilerFlag)
+    check_cxx_compiler_flag(
+      -fvisibility-inlines-hidden run_inlines_hidden_test)
+  endif()
+
+  if(run_inlines_hidden_test)
+    add_test(VisibilityInlinesHidden ${CMAKE_CTEST_COMMAND}
+      --build-and-test
+      "${CMake_SOURCE_DIR}/Tests/VisibilityInlinesHidden"
+      "${CMake_BINARY_DIR}/Tests/VisibilityInlinesHidden"
+      ${build_generator_args}
+      --build-project VisibilityInlinesHidden
+      --build-options ${build_options}
+    )
+    list(APPEND TEST_BUILD_DIRS
+      "${CMake_BINARY_DIR}/Tests/VisibilityInlinesHidden"
+    )
+  endif()
+
   add_test(LinkFlags-prepare
     ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE}
     --build-and-test
diff --git a/Tests/VisibilityInlinesHidden/CMakeLists.txt b/Tests/VisibilityInlinesHidden/CMakeLists.txt
new file mode 100644
index 0000000..8ebc39c
--- /dev/null
+++ b/Tests/VisibilityInlinesHidden/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(VisibilityInlinesHidden)
+
+add_library(inlines_hidden SHARED foo.cpp bar.c)
+set_property(TARGET inlines_hidden PROPERTY VISIBILITY_INLINES_HIDDEN ON)
+target_compile_options(inlines_hidden PRIVATE -Werror)
+
+add_custom_command(TARGET inlines_hidden POST_BUILD
+  COMMAND ${CMAKE_COMMAND}
+    -DCMAKE_NM=${CMAKE_NM}
+    -DTEST_LIBRARY_PATH=$<TARGET_FILE:inlines_hidden>
+    -P ${CMAKE_CURRENT_SOURCE_DIR}/verify.cmake
+)
diff --git a/Tests/VisibilityInlinesHidden/bar.c b/Tests/VisibilityInlinesHidden/bar.c
new file mode 100644
index 0000000..e425999
--- /dev/null
+++ b/Tests/VisibilityInlinesHidden/bar.c
@@ -0,0 +1 @@
+void bar() {}
diff --git a/Tests/VisibilityInlinesHidden/foo.cpp b/Tests/VisibilityInlinesHidden/foo.cpp
new file mode 100644
index 0000000..2b66b69
--- /dev/null
+++ b/Tests/VisibilityInlinesHidden/foo.cpp
@@ -0,0 +1,11 @@
+class Foo
+{
+public:
+    void bar() {}
+};
+
+void baz()
+{
+	Foo foo;
+	foo.bar();
+}
diff --git a/Tests/VisibilityInlinesHidden/verify.cmake b/Tests/VisibilityInlinesHidden/verify.cmake
new file mode 100644
index 0000000..80dd13c
--- /dev/null
+++ b/Tests/VisibilityInlinesHidden/verify.cmake
@@ -0,0 +1,14 @@
+execute_process(COMMAND ${CMAKE_NM} -D ${TEST_LIBRARY_PATH}
+  RESULT_VARIABLE RESULT
+  OUTPUT_VARIABLE OUTPUT
+  ERROR_VARIABLE ERROR
+)
+
+if(NOT "${RESULT}" STREQUAL "0")
+  message(FATAL_ERROR "nm failed [${RESULT}] [${OUTPUT}] [${ERROR}]")
+endif()
+
+if(${OUTPUT} MATCHES "Foo[^\\n]*bar")
+  message(FATAL_ERROR
+    "Found Foo::bar() which should have been hidden [${OUTPUT}]")
+endif()

-----------------------------------------------------------------------

Summary of changes:
 Source/CMakeVersion.cmake                    |    2 +-
 Source/cmLocalGenerator.cxx                  |    6 +++++-
 Tests/CMakeLists.txt                         |   22 ++++++++++++++++++++++
 Tests/VisibilityInlinesHidden/CMakeLists.txt |   14 ++++++++++++++
 Tests/VisibilityInlinesHidden/bar.c          |    1 +
 Tests/VisibilityInlinesHidden/foo.cpp        |   11 +++++++++++
 Tests/VisibilityInlinesHidden/verify.cmake   |   14 ++++++++++++++
 7 files changed, 68 insertions(+), 2 deletions(-)
 create mode 100644 Tests/VisibilityInlinesHidden/CMakeLists.txt
 create mode 100644 Tests/VisibilityInlinesHidden/bar.c
 create mode 100644 Tests/VisibilityInlinesHidden/foo.cpp
 create mode 100644 Tests/VisibilityInlinesHidden/verify.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list