[Cmake-commits] CMake branch, next, updated. v2.8.10.2-1596-g49c0ab6

Stephen Kelly steveire at gmail.com
Sun Jan 13 05:50:27 EST 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  49c0ab65f72bd822bc1ee2aa39d3d85690363838 (commit)
       via  d3a49fb01a3db25844a4ce8cba95ce1641778913 (commit)
       via  61725753dddf91b6451d356ec500715a3494d698 (commit)
       via  fe45ab0d19e423b0c60ce6efc8f834233c32d4ea (commit)
       via  3a5fb253a0dc1254ca692d77b52758b308b3ea08 (commit)
      from  34370c2065fb9002cc70c8d676d9f0028c1ca6cb (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=49c0ab65f72bd822bc1ee2aa39d3d85690363838
commit 49c0ab65f72bd822bc1ee2aa39d3d85690363838
Merge: 34370c2 d3a49fb
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jan 13 05:50:25 2013 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Jan 13 05:50:25 2013 -0500

    Merge topic 'test-export-iface-genex' into next
    
    d3a49fb Test evaluation target via export for generator expressions
    6172575 Export the INTERFACE_PIC property.
    fe45ab0 Make the BUILD_INTERFACE of export()ed targets work.
    3a5fb25 Add a test for the interfaces in targets exported from the build tree.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d3a49fb01a3db25844a4ce8cba95ce1641778913
commit d3a49fb01a3db25844a4ce8cba95ce1641778913
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jan 12 12:13:44 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Jan 13 11:49:05 2013 +0100

    Test evaluation target via export for generator expressions

diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index fd7a1a6..dd615d1 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -186,7 +186,7 @@ set_property(TARGET testSharedLibDepends APPEND PROPERTY
 )
 set_property(TARGET testSharedLibDepends APPEND PROPERTY
   LINK_INTERFACE_LIBRARIES
-    $<1:$<TARGET_NAME:testSharedLibRequired>>
+    $<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:$<TARGET_NAME:testSharedLibRequired>>
 )
 
 # LINK_PRIVATE because the LINK_INTERFACE_LIBRARIES is specified above.

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61725753dddf91b6451d356ec500715a3494d698
commit 61725753dddf91b6451d356ec500715a3494d698
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jan 12 12:13:19 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Jan 13 11:49:05 2013 +0100

    Export the INTERFACE_PIC property.

diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 36c53dc..61e130d 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -72,6 +72,8 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
     this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", te,
                                     cmGeneratorExpression::BuildInterface,
                                     properties, missingTargets);
+    this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
+                                  te, properties);
 
     this->GenerateInterfaceProperties(te, os, properties);
     }
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index fc78eeb..4a7c6f9 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -127,6 +127,18 @@ void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
 
 //----------------------------------------------------------------------------
 void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
+                                              cmTarget *target,
+                                              ImportPropertyMap &properties)
+{
+  const char *input = target->GetProperty(propName);
+  if (input)
+    {
+    properties[propName] = input;
+    }
+}
+
+//----------------------------------------------------------------------------
+void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
                       const char *outputName,
                       cmTarget *target,
                       cmGeneratorExpression::PreprocessContext preprocessRule,
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index 8620dd1..eb3f3c3 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -101,6 +101,8 @@ protected:
                                  cmGeneratorExpression::PreprocessContext,
                                  ImportPropertyMap &properties,
                                  std::vector<std::string> &missingTargets);
+  void PopulateInterfaceProperty(const char *propName, cmTarget *target,
+                                 ImportPropertyMap &properties);
   void GenerateInterfaceProperties(cmTarget *target, std::ostream& os,
                                    const ImportPropertyMap &properties);
 
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 7eed5ab..965f63d 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -89,6 +89,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
                                   te,
                                   cmGeneratorExpression::InstallInterface,
                                   properties, missingTargets);
+    this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
+                                  te, properties);
 
     this->GenerateInterfaceProperties(te, os, properties);
     }
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index e92dcd8..fd7a1a6 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -162,6 +162,10 @@ include(GenerateExportHeader)
 
 add_library(testSharedLibRequired SHARED testSharedLibRequired.cpp)
 generate_export_header(testSharedLibRequired)
+set_property(TARGET testSharedLibRequired
+  PROPERTY
+    INTERFACE_POSITION_INDEPENDENT_CODE ON
+)
 set_property(TARGET testSharedLibRequired APPEND PROPERTY
   INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}"
 )
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 72d11b6..4812e7e 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -167,6 +167,24 @@ target_link_libraries(deps_shared_iface testSharedLibDepends)
 target_include_directories(deps_shared_iface PRIVATE testSharedLibDepends)
 target_compile_definitions(deps_shared_iface PRIVATE testSharedLibDepends)
 
+if (APPLE OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+  include(CheckCXXCompilerFlag)
+  check_cxx_compiler_flag(-fPIE run_pic_test)
+else()
+  if (CMAKE_CXX_COMPILER_ID MATCHES "PGI"
+      OR CMAKE_CXX_COMPILER_ID MATCHES "PathScale"
+      OR CMAKE_SYSTEM_NAME MATCHES "IRIX64"
+      OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
+    set(run_pic_test 0)
+  else()
+    set(run_pic_test 1)
+  endif()
+endif()
+
+if (run_pic_test)
+  target_compile_definitions(deps_shared_iface PRIVATE CHECK_PIC_WORKS)
+endif()
+
 #-----------------------------------------------------------------------------
 # Test that targets imported from the build tree have their dependencies
 # evaluated correctly. The above already tests the same for the install tree.
diff --git a/Tests/ExportImport/Import/A/deps_shared_iface.cpp b/Tests/ExportImport/Import/A/deps_shared_iface.cpp
index 14aac0a..43f832a 100644
--- a/Tests/ExportImport/Import/A/deps_shared_iface.cpp
+++ b/Tests/ExportImport/Import/A/deps_shared_iface.cpp
@@ -2,6 +2,12 @@
 
 #include "testSharedLibDepends.h"
 
+#ifdef CHECK_PIC_WORKS
+#if defined(__ELF__) && !defined(__PIC__) && !defined(__PIE__)
+#error Expected by INTERFACE_POSITION_INDEPENDENT_CODE property of dependency
+#endif
+#endif
+
 #ifdef TEST_SUBDIR_LIB
 #include "subdir.h"
 #endif

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fe45ab0d19e423b0c60ce6efc8f834233c32d4ea
commit fe45ab0d19e423b0c60ce6efc8f834233c32d4ea
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jan 12 12:11:29 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Jan 13 11:49:05 2013 +0100

    Make the BUILD_INTERFACE of export()ed targets work.
    
    The existing BUILD_INTERFACE code is executed at generate time, which
    is too late for export().

diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index ad61803..36c53dc 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -62,6 +62,8 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
     cmTarget* te = *tei;
     this->GenerateImportTargetCode(os, te);
 
+    te->AppendBuildInterfaceIncludes();
+
     ImportPropertyMap properties;
 
     this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES", te,
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index d030aa7..d2baf53 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -941,19 +941,7 @@ void cmGlobalGenerator::Generate()
 
     for ( tit = targets->begin(); tit != targets->end(); ++ tit )
       {
-      if (mf->IsOn("CMAKE_BUILD_INTERFACE_INCLUDES"))
-        {
-        const char *binDir = mf->GetStartOutputDirectory();
-        const char *srcDir = mf->GetStartDirectory();
-        const std::string dirs = std::string(binDir ? binDir : "")
-                                + std::string(binDir ? ";" : "")
-                                + std::string(srcDir ? srcDir : "");
-        if (!dirs.empty())
-          {
-          tit->second.AppendProperty("INTERFACE_INCLUDE_DIRECTORIES",
-                                ("$<BUILD_INTERFACE:" + dirs + ">").c_str());
-          }
-        }
+        tit->second.AppendBuildInterfaceIncludes();
       }
     }
 
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 9b50b8e..cf01f9f 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -150,6 +150,7 @@ cmTarget::cmTarget()
   this->DLLPlatform = false;
   this->IsApple = false;
   this->IsImportedTarget = false;
+  this->BuildInterfaceIncludesAppended = false;
 }
 
 //----------------------------------------------------------------------------
@@ -2655,6 +2656,30 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
 }
 
 //----------------------------------------------------------------------------
+void cmTarget::AppendBuildInterfaceIncludes()
+{
+  if (this->BuildInterfaceIncludesAppended)
+    {
+    return;
+    }
+  this->BuildInterfaceIncludesAppended = true;
+
+  if (this->Makefile->IsOn("CMAKE_BUILD_INTERFACE_INCLUDES"))
+    {
+    const char *binDir = this->Makefile->GetStartOutputDirectory();
+    const char *srcDir = this->Makefile->GetStartDirectory();
+    const std::string dirs = std::string(binDir ? binDir : "")
+                            + std::string(binDir ? ";" : "")
+                            + std::string(srcDir ? srcDir : "");
+    if (!dirs.empty())
+      {
+      this->AppendProperty("INTERFACE_INCLUDE_DIRECTORIES",
+                            ("$<BUILD_INTERFACE:" + dirs + ">").c_str());
+      }
+    }
+}
+
+//----------------------------------------------------------------------------
 void cmTarget::InsertInclude(const cmMakefileIncludeDirectoriesEntry &entry,
                      bool before)
 {
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index b4d053d..48dde0a 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -490,6 +490,8 @@ public:
   void InsertInclude(const cmMakefileIncludeDirectoriesEntry &entry,
                      bool before = false);
 
+  void AppendBuildInterfaceIncludes();
+
   void GetLinkDependentTargetsForProperty(const std::string &p,
                                        std::set<std::string> &targets);
   bool IsNullImpliedByLinkLibraries(const std::string &p);
@@ -611,6 +613,7 @@ private:
   mutable std::map<cmStdString, std::set<std::string> >
                                                       LinkDependentProperties;
   mutable std::set<std::string> LinkImplicitNullProperties;
+  bool BuildInterfaceIncludesAppended;
 
   // Cache target output paths for each configuration.
   struct OutputInfo;
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 4f6ccd6..e92dcd8 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -247,9 +247,11 @@ if(WIN32)
   install(TARGETS testLib5 RUNTIME DESTINATION bin)
 endif()
 
+add_subdirectory(sublib) # For CMAKE_BUILD_INTERFACE_INCLUDES test.
+
 # Export from build tree.
 export(TARGETS testExe1 testLib1 testLib2 testLib3
-  testExe2libImp testLib3Imp testLib3ImpDep
+  testExe2libImp testLib3Imp testLib3ImpDep subdirlib
   testSharedLibRequired testSharedLibDepends
   NAMESPACE bld_
   FILE ExportBuildTree.cmake
diff --git a/Tests/ExportImport/Export/sublib/CMakeLists.txt b/Tests/ExportImport/Export/sublib/CMakeLists.txt
new file mode 100644
index 0000000..2d11040
--- /dev/null
+++ b/Tests/ExportImport/Export/sublib/CMakeLists.txt
@@ -0,0 +1,6 @@
+
+set(CMAKE_BUILD_INTERFACE_INCLUDES ON)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+add_library(subdirlib SHARED subdir.cpp)
+generate_export_header(subdirlib)
diff --git a/Tests/ExportImport/Export/sublib/subdir.cpp b/Tests/ExportImport/Export/sublib/subdir.cpp
new file mode 100644
index 0000000..35b0743
--- /dev/null
+++ b/Tests/ExportImport/Export/sublib/subdir.cpp
@@ -0,0 +1,7 @@
+
+#include "subdir.h"
+
+int SubDirObject::foo()
+{
+  return 0;
+}
diff --git a/Tests/ExportImport/Export/sublib/subdir.h b/Tests/ExportImport/Export/sublib/subdir.h
new file mode 100644
index 0000000..3a4b73d
--- /dev/null
+++ b/Tests/ExportImport/Export/sublib/subdir.h
@@ -0,0 +1,12 @@
+
+#ifndef SUBDIR_H
+#define SUBDIR_H
+
+#include "subdirlib_export.h"
+
+struct SUBDIRLIB_EXPORT SubDirObject
+{
+  int foo();
+};
+
+#endif
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 6a2e54c..72d11b6 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -172,6 +172,8 @@ target_compile_definitions(deps_shared_iface PRIVATE testSharedLibDepends)
 # evaluated correctly. The above already tests the same for the install tree.
 
 add_executable(deps_shared_iface2 deps_shared_iface.cpp)
-target_link_libraries(deps_shared_iface2 bld_testSharedLibDepends)
-target_include_directories(deps_shared_iface2 PRIVATE bld_testSharedLibDepends)
-target_compile_definitions(deps_shared_iface2 PRIVATE bld_testSharedLibDepends)
+target_link_libraries(deps_shared_iface2 bld_testSharedLibDepends bld_subdirlib)
+target_include_directories(deps_shared_iface2 PRIVATE bld_testSharedLibDepends bld_subdirlib)
+target_compile_definitions(deps_shared_iface2
+  PRIVATE bld_testSharedLibDepends TEST_SUBDIR_LIB
+)
diff --git a/Tests/ExportImport/Import/A/deps_shared_iface.cpp b/Tests/ExportImport/Import/A/deps_shared_iface.cpp
index 4f7eb23..14aac0a 100644
--- a/Tests/ExportImport/Import/A/deps_shared_iface.cpp
+++ b/Tests/ExportImport/Import/A/deps_shared_iface.cpp
@@ -2,10 +2,22 @@
 
 #include "testSharedLibDepends.h"
 
+#ifdef TEST_SUBDIR_LIB
+#include "subdir.h"
+#endif
+
 int main(int,char **)
 {
   TestSharedLibDepends dep;
   TestSharedLibRequired req;
 
-  return dep.foo() + req.foo();
+#ifdef TEST_SUBDIR_LIB
+  SubDirObject sdo;
+#endif
+
+  return dep.foo() + req.foo()
+#ifdef TEST_SUBDIR_LIB
+                   + sdo.foo()
+#endif
+                              ;
 }

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3a5fb253a0dc1254ca692d77b52758b308b3ea08
commit 3a5fb253a0dc1254ca692d77b52758b308b3ea08
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sat Jan 12 00:00:42 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Jan 13 11:49:05 2013 +0100

    Add a test for the interfaces in targets exported from the build tree.

diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 779d889..4f6ccd6 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -250,6 +250,7 @@ endif()
 # Export from build tree.
 export(TARGETS testExe1 testLib1 testLib2 testLib3
   testExe2libImp testLib3Imp testLib3ImpDep
+  testSharedLibRequired testSharedLibDepends
   NAMESPACE bld_
   FILE ExportBuildTree.cmake
   )
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index abb2ab0..6a2e54c 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -159,22 +159,19 @@ endif()
 
 add_executable(deps_iface deps_iface.c)
 target_link_libraries(deps_iface testLibDepends)
-set_property(TARGET deps_iface APPEND PROPERTY
-  COMPILE_DEFINITIONS
-    $<TARGET_PROPERTY:testLibDepends,INTERFACE_COMPILE_DEFINITIONS>
-)
-set_property(TARGET deps_iface APPEND PROPERTY
-  INCLUDE_DIRECTORIES
-    $<TARGET_PROPERTY:testLibDepends,INTERFACE_INCLUDE_DIRECTORIES>
-)
+target_include_directories(deps_iface PRIVATE testLibDepends)
+target_compile_definitions(deps_iface PRIVATE testLibDepends)
 
 add_executable(deps_shared_iface deps_shared_iface.cpp)
 target_link_libraries(deps_shared_iface testSharedLibDepends)
-set_property(TARGET deps_shared_iface APPEND PROPERTY
-  COMPILE_DEFINITIONS
-    $<TARGET_PROPERTY:testSharedLibDepends,INTERFACE_COMPILE_DEFINITIONS>
-)
-set_property(TARGET deps_shared_iface APPEND PROPERTY
-  INCLUDE_DIRECTORIES
-    $<TARGET_PROPERTY:testSharedLibDepends,INTERFACE_INCLUDE_DIRECTORIES>
-)
+target_include_directories(deps_shared_iface PRIVATE testSharedLibDepends)
+target_compile_definitions(deps_shared_iface PRIVATE testSharedLibDepends)
+
+#-----------------------------------------------------------------------------
+# Test that targets imported from the build tree have their dependencies
+# evaluated correctly. The above already tests the same for the install tree.
+
+add_executable(deps_shared_iface2 deps_shared_iface.cpp)
+target_link_libraries(deps_shared_iface2 bld_testSharedLibDepends)
+target_include_directories(deps_shared_iface2 PRIVATE bld_testSharedLibDepends)
+target_compile_definitions(deps_shared_iface2 PRIVATE bld_testSharedLibDepends)

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list