[Cmake-commits] CMake branch, next, updated. v2.8.11.2-4239-g6f94fd4

Stephen Kelly steveire at gmail.com
Thu Sep 19 03:12:50 EDT 2013


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  6f94fd4c86d12a666154f9a4ce546ca258689c1d (commit)
       via  b9b992fd7d9b9aed8032c70825f33dc8f4dda701 (commit)
      from  6a49ff20d75c51cc03cf7ee63481f3103cd9ebfc (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=6f94fd4c86d12a666154f9a4ce546ca258689c1d
commit 6f94fd4c86d12a666154f9a4ce546ca258689c1d
Merge: 6a49ff2 b9b992f
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Sep 19 03:12:47 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Sep 19 03:12:47 2013 -0400

    Merge topic 'IMPORTED-target-SYSTEM-includes' into next
    
    b9b992f Always consider includes from IMPORTED targets to be SYSTEM.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b9b992fd7d9b9aed8032c70825f33dc8f4dda701
commit b9b992fd7d9b9aed8032c70825f33dc8f4dda701
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Aug 29 10:28:09 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Sep 19 09:12:15 2013 +0200

    Always consider includes from IMPORTED targets to be SYSTEM.
    
    Introduce a target property to control this behavior variable
    to set the default value for the target property.
    
    This does not affect try_compile runs.

diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index c4f6216..d3721bb 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -1563,6 +1563,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
      false,
      "Variables that Control the Build");
   cm->DefineProperty
+    ("CMAKE_NO_SYSTEM_FROM_IMPORTED", cmProperty::VARIABLE,
+     "Default value for NO_SYSTEM_FROM_IMPORTED of targets.",
+     "This variable is used to initialize the "
+     "NO_SYSTEM_FROM_IMPORTED property on all the targets.  "
+     "See that target property for additional information.",
+     false,
+     "Variables that Control the Build");
+  cm->DefineProperty
     ("CMAKE_<LANG>_VISIBILITY_PRESET", cmProperty::VARIABLE,
      "Default value for <LANG>_VISIBILITY_PRESET of targets.",
      "This variable is used to initialize the "
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index ac655da..98ad0f5 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -928,6 +928,17 @@ void cmTarget::DefineProperties(cmake *cm)
      false /* TODO: make this chained */ );
 
   cm->DefineProperty
+    ("NO_SYSTEM_FROM_IMPORTED", cmProperty::TARGET,
+     "Do not treat includes from IMPORTED target interfaces as SYSTEM.",
+     "The contents of the INTERFACE_INCLUDE_DIRECTORIES of IMPORTED targets "
+     "are treated as SYSTEM includes by default.  If this property is "
+     "enabled, the contents of the INTERFACE_INCLUDE_DIRECTORIES of IMPORTED "
+     "targets are not treated as system includes.  "
+     "This property is initialized by the value of the variable "
+     "CMAKE_NO_SYSTEM_FROM_IMPORTED if it is set when a target is "
+     "created.");
+
+  cm->DefineProperty
     ("OSX_ARCHITECTURES", cmProperty::TARGET,
      "Target specific architectures for OS X.",
      "The OSX_ARCHITECTURES property sets the target binary architecture "
@@ -1637,6 +1648,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
   this->SetPropertyDefault("WIN32_EXECUTABLE", 0);
   this->SetPropertyDefault("MACOSX_BUNDLE", 0);
   this->SetPropertyDefault("MACOSX_RPATH", 0);
+  this->SetPropertyDefault("NO_SYSTEM_FROM_IMPORTED", 0);
 
 
   // Collect the set of configuration types.
@@ -2664,10 +2676,29 @@ void cmTarget::FinalizeSystemIncludeDirectories()
                                                       ge.Parse(it->Value);
     std::string targetName = cge->Evaluate(this->Makefile, 0,
                                       false, this, 0, 0);
-    if (!this->Makefile->FindTargetToUse(targetName.c_str()))
+    cmTarget *tgt = this->Makefile->FindTargetToUse(targetName.c_str());
+    if (!tgt)
       {
       continue;
       }
+    if (tgt->IsImported()
+        && tgt->GetProperty("INTERFACE_INCLUDE_DIRECTORIES")
+        && !this->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED")
+        && !this->Makefile->GetCMakeInstance()->GetIsInTryCompile())
+      {
+      std::string includeGenex = "$<TARGET_PROPERTY:" +
+                                it->Value + ",INTERFACE_INCLUDE_DIRECTORIES>";
+      if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
+        {
+        // Because it->Value is a generator expression, ensure that it
+        // evaluates to the non-empty string before being used in the
+        // TARGET_PROPERTY expression.
+        includeGenex = "$<$<BOOL:" + it->Value + ">:" + includeGenex + ">";
+        }
+      this->SystemIncludeDirectories.insert(includeGenex);
+      return; // The INTERFACE_SYSTEM_INCLUDE_DIRECTORIES are a subset
+              // of the INTERFACE_INCLUDE_DIRECTORIES
+      }
     }
     std::string includeGenex = "$<TARGET_PROPERTY:" +
                         it->Value + ",INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>";
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 1f23b2a..06238a4 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -298,6 +298,14 @@ set_property(TARGET cmp0022OLD APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLib3
 
 add_library(noIncludesInterface empty.cpp)
 
+add_library(systemlib SHARED systemlib.cpp)
+install(FILES systemlib.h DESTINATION include/systemlib)
+target_include_directories(systemlib
+  INTERFACE
+    $<INSTALL_INTERFACE:include/systemlib>
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+)
+
 install(TARGETS testLibRequired
         EXPORT RequiredExp DESTINATION lib
         INCLUDES DESTINATION
@@ -366,6 +374,7 @@ install(
   testLib6
   testLibCycleA testLibCycleB
   cmp0022NEW cmp0022OLD
+  systemlib
   EXPORT exp
   RUNTIME DESTINATION bin
   LIBRARY DESTINATION lib NAMELINK_SKIP
@@ -417,6 +426,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
   testSharedLibRequired testSharedLibRequiredUser testSharedLibRequiredUser2
   testSharedLibDepends renamed_on_export
   cmp0022NEW cmp0022OLD
+  systemlib
   NAMESPACE bld_
   FILE ExportBuildTree.cmake
   )
diff --git a/Tests/ExportImport/Export/systemlib.cpp b/Tests/ExportImport/Export/systemlib.cpp
new file mode 100644
index 0000000..ec45148
--- /dev/null
+++ b/Tests/ExportImport/Export/systemlib.cpp
@@ -0,0 +1,7 @@
+
+#include "systemlib.h"
+
+SystemStruct::SystemStruct()
+{
+
+}
diff --git a/Tests/ExportImport/Export/systemlib.h b/Tests/ExportImport/Export/systemlib.h
new file mode 100644
index 0000000..f7900c0
--- /dev/null
+++ b/Tests/ExportImport/Export/systemlib.h
@@ -0,0 +1,22 @@
+
+#ifndef SYSTEMLIB_H
+#define SYSTEMLIB_H
+
+#if defined(_WIN32) || defined(__CYGWIN__)
+# define systemlib_EXPORT __declspec(dllexport)
+#else
+# define systemlib_EXPORT
+#endif
+
+struct systemlib_EXPORT SystemStruct
+{
+  SystemStruct();
+
+  void someMethod()
+  {
+    int unused;
+    // unused warning not issued when this header is used as a system header.
+  }
+};
+
+#endif
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 2627354..82b25a8 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -265,3 +265,40 @@ foreach(_config ${_configs})
     )
 endforeach()
 unset(_configs)
+
+if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4)
+    OR CMAKE_C_COMPILER_ID STREQUAL Clang)
+    AND (CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "Ninja"))
+  include(CheckCXXCompilerFlag)
+  check_cxx_compiler_flag(-Wunused-variable run_sys_includes_test)
+  if(run_sys_includes_test)
+    # The Bullseye wrapper appears to break the -isystem effect.
+    execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE out ERROR_VARIABLE out)
+    if("x${out}" MATCHES "Bullseye")
+      set(run_sys_includes_test 0)
+    endif()
+  endif()
+  if (run_sys_includes_test)
+    add_executable(test_system_exp test_system.cpp)
+    target_link_libraries(test_system_exp exp_systemlib)
+    target_compile_options(test_system_exp PRIVATE -Wunused-variable -Werror=unused-variable)
+
+    unset(EXP_ERROR_VARIABLE CACHE)
+    set(CMAKE_REQUIRED_LIBRARIES exp_systemlib)
+    check_cxx_compiler_flag(-Wunused-variable -Werror=unused-variable EXP_ERROR_VARIABLE)
+    if(EXP_ERROR_VARIABLE)
+      message(SEND_ERROR "EXP_ERROR_VARIABLE try_compile succeeded, but it was expected to fail.")
+    endif()
+
+    add_executable(test_system_bld test_system.cpp)
+    target_link_libraries(test_system_bld bld_systemlib)
+    target_compile_options(test_system_bld PRIVATE -Wunused-variable -Werror=unused-variable)
+
+    unset(BLD_ERROR_VARIABLE CACHE)
+    set(CMAKE_REQUIRED_LIBRARIES bld_systemlib)
+    check_cxx_compiler_flag(-Wunused-variable -Werror=unused-variable BLD_ERROR_VARIABLE)
+    if(BLD_ERROR_VARIABLE)
+      message(SEND_ERROR "BLD_ERROR_VARIABLE try_compile succeeded, but it was expected to fail.")
+    endif()
+  endif()
+endif()
diff --git a/Tests/ExportImport/Import/A/test_system.cpp b/Tests/ExportImport/Import/A/test_system.cpp
new file mode 100644
index 0000000..aae3583
--- /dev/null
+++ b/Tests/ExportImport/Import/A/test_system.cpp
@@ -0,0 +1,9 @@
+
+#include "systemlib.h"
+
+int main()
+{
+  SystemStruct s;
+  (void)s;
+  return 0;
+}

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

Summary of changes:
 Source/cmDocumentVariables.cxx              |    8 ++++++
 Source/cmTarget.cxx                         |   33 +++++++++++++++++++++++-
 Tests/ExportImport/Export/CMakeLists.txt    |   10 +++++++
 Tests/ExportImport/Export/systemlib.cpp     |    7 +++++
 Tests/ExportImport/Export/systemlib.h       |   22 ++++++++++++++++
 Tests/ExportImport/Import/A/CMakeLists.txt  |   37 +++++++++++++++++++++++++++
 Tests/ExportImport/Import/A/test_system.cpp |    9 ++++++
 7 files changed, 125 insertions(+), 1 deletions(-)
 create mode 100644 Tests/ExportImport/Export/systemlib.cpp
 create mode 100644 Tests/ExportImport/Export/systemlib.h
 create mode 100644 Tests/ExportImport/Import/A/test_system.cpp


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list