[Cmake-commits] CMake branch, next, updated. v3.0.0-4127-g8c3d453

Brad King brad.king at kitware.com
Mon Jul 7 08:58:54 EDT 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  8c3d453b704708014ddf6b6e9fc4f2edabd64b47 (commit)
       via  ce04e9ba60cc923006e2e00afa3e9e7bda01dbf9 (commit)
       via  de4f3e2c82a92a7dfc6305a09cc32d9d5c6e8c34 (commit)
       via  54bf5858cd4153f41a2414dbe8d1278268eccb58 (commit)
      from  df9e4875a66e7351d194a9cfe2423e25f61d5e3f (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=8c3d453b704708014ddf6b6e9fc4f2edabd64b47
commit 8c3d453b704708014ddf6b6e9fc4f2edabd64b47
Merge: df9e487 ce04e9b
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Jul 7 08:58:52 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Jul 7 08:58:52 2014 -0400

    Merge topic 'allow-OBJECT-library-extra-sources' into next
    
    ce04e9ba add_library: Allow arbitrary non-linked sources in OBJECT libraries
    de4f3e2c Tests: Fix broken dependency in ObjectLibrary test
    54bf5858 Tests: Resolve TODO comment left in ObjectLibrary test


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ce04e9ba60cc923006e2e00afa3e9e7bda01dbf9
commit ce04e9ba60cc923006e2e00afa3e9e7bda01dbf9
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jul 2 15:38:10 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Jul 7 08:58:08 2014 -0400

    add_library: Allow arbitrary non-linked sources in OBJECT libraries
    
    Loosen this restriction on OBJECT libraries to allow source files of any
    name to be generated by custom commands or listed for reference in IDE
    projects so long as they would not affect linking of a normal library.
    Update the rejection message to be more specific about the looser
    restriction.
    
    Extend the ObjectLibrary test to cover a ".cmake" file generated by a
    custom command in an OBJECT library.

diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst
index f19b5c0..f86f3c5 100644
--- a/Help/command/add_library.rst
+++ b/Help/command/add_library.rst
@@ -94,7 +94,8 @@ object library name.  For example:
 
 will include objlib's object files in a library and an executable
 along with those compiled from their own sources.  Object libraries
-may contain only sources (and headers) that compile to object files.
+may contain only sources that compile, header files, and other files
+that would not affect linking of a normal library (e.g. ``.txt``).
 They may contain custom commands generating such sources, but not
 ``PRE_BUILD``, ``PRE_LINK``, or ``POST_BUILD`` commands.  Object libraries
 cannot be imported, exported, installed, or linked.  Some native build
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index eccb06a..64c5822 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -38,7 +38,8 @@ void reportBadObjLib(std::vector<cmSourceFile*> const& badObjLib,
       {
       e << "  " << (*i)->GetLocation().GetName() << "\n";
       }
-    e << "but may contain only headers and sources that compile.";
+    e << "but may contain only sources that compile, header files, and "
+         "other files that would not affect linking of a normal library.";
     cm->IssueMessage(cmake::FATAL_ERROR, e.str(),
                      target->GetBacktrace());
     }
@@ -205,10 +206,6 @@ struct TagVisitor
     else
       {
       DoAccept<IsSameTag<Tag, ExtraSourcesTag>::Result>::Do(this->Data, sf);
-      if(this->IsObjLib && ext != "txt")
-        {
-        this->BadObjLibFiles.push_back(sf);
-        }
       }
   }
 };
diff --git a/Tests/ObjectLibrary/A/CMakeLists.txt b/Tests/ObjectLibrary/A/CMakeLists.txt
index 3fba9f8..696752f 100644
--- a/Tests/ObjectLibrary/A/CMakeLists.txt
+++ b/Tests/ObjectLibrary/A/CMakeLists.txt
@@ -11,5 +11,11 @@ add_custom_command(
                                    ${CMAKE_CURRENT_BINARY_DIR}/a1.c
   )
 
-add_library(A OBJECT a1.c a2.c)
+file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/a.cmake)
+add_custom_command(
+  OUTPUT a.cmake
+  COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/a.cmake
+  )
+
+add_library(A OBJECT a1.c a2.c a.cmake)
 target_include_directories(A PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/Tests/ObjectLibrary/CMakeLists.txt b/Tests/ObjectLibrary/CMakeLists.txt
index 75c34d8..e9f553e 100644
--- a/Tests/ObjectLibrary/CMakeLists.txt
+++ b/Tests/ObjectLibrary/CMakeLists.txt
@@ -12,6 +12,7 @@ add_library(Cshared SHARED c.c $<TARGET_OBJECTS:A> $<TARGET_OBJECTS:Bexport>)
 add_executable(UseCshared main.c)
 set_property(TARGET UseCshared PROPERTY COMPILE_DEFINITIONS SHARED_C)
 target_link_libraries(UseCshared Cshared)
+add_custom_command(TARGET UseCshared POST_BUILD COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/A/a.cmake)
 
 add_executable(UseCinternal main.c c.c $<TARGET_OBJECTS:A> $<TARGET_OBJECTS:B>)
 
diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt
index b31225b..a09552b 100644
--- a/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt
+++ b/Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt
@@ -3,6 +3,7 @@ CMake Error at BadObjSource1.cmake:1 \(add_library\):
 
     bad.def
 
-  but may contain only headers and sources that compile.
+  but may contain only sources that compile, header files, and other files
+  that would not affect linking of a normal library.
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt
index 906cf0b..b91ffd0 100644
--- a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt
+++ b/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt
@@ -3,6 +3,7 @@ CMake Error at BadObjSource2.cmake:1 \(add_library\):
 
     bad.obj
 
-  but may contain only headers and sources that compile.
+  but may contain only sources that compile, header files, and other files
+  that would not affect linking of a normal library.
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=de4f3e2c82a92a7dfc6305a09cc32d9d5c6e8c34
commit de4f3e2c82a92a7dfc6305a09cc32d9d5c6e8c34
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jul 2 15:07:04 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Jul 7 08:58:08 2014 -0400

    Tests: Fix broken dependency in ObjectLibrary test
    
    The add_custom_command DEPENDS option needs a full path.

diff --git a/Tests/ObjectLibrary/A/CMakeLists.txt b/Tests/ObjectLibrary/A/CMakeLists.txt
index 1b40e8a..3fba9f8 100644
--- a/Tests/ObjectLibrary/A/CMakeLists.txt
+++ b/Tests/ObjectLibrary/A/CMakeLists.txt
@@ -6,7 +6,7 @@ add_definitions(-DA_DEF)
 
 add_custom_command(
   OUTPUT a1.c
-  DEPENDS a1.c.in
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/a1.c.in
   COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/a1.c.in
                                    ${CMAKE_CURRENT_BINARY_DIR}/a1.c
   )

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=54bf5858cd4153f41a2414dbe8d1278268eccb58
commit 54bf5858cd4153f41a2414dbe8d1278268eccb58
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jul 2 14:40:59 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Jul 7 08:58:08 2014 -0400

    Tests: Resolve TODO comment left in ObjectLibrary test
    
    We now have a generic way to add -fPIC without explicitly modifying
    CMAKE_C_FLAGS, so use it.

diff --git a/Tests/ObjectLibrary/A/CMakeLists.txt b/Tests/ObjectLibrary/A/CMakeLists.txt
index 55778ea..1b40e8a 100644
--- a/Tests/ObjectLibrary/A/CMakeLists.txt
+++ b/Tests/ObjectLibrary/A/CMakeLists.txt
@@ -1,9 +1,6 @@
 project(ObjectLibraryA C)
 # Add -fPIC so objects can be used in shared libraries.
-# TODO: Need property for this.
-if(CMAKE_SHARED_LIBRARY_C_FLAGS AND NOT WATCOM)
-  set(CMAKE_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} ${CMAKE_C_FLAGS}")
-endif()
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 
 add_definitions(-DA_DEF)
 
diff --git a/Tests/ObjectLibrary/B/CMakeLists.txt b/Tests/ObjectLibrary/B/CMakeLists.txt
index a567f96..2158084 100644
--- a/Tests/ObjectLibrary/B/CMakeLists.txt
+++ b/Tests/ObjectLibrary/B/CMakeLists.txt
@@ -5,10 +5,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6")
 endif()
 
 # Add -fPIC so objects can be used in shared libraries.
-# TODO: Need property for this.
-if(CMAKE_SHARED_LIBRARY_C_FLAGS AND NOT WATCOM)
-  set(CMAKE_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} ${CMAKE_C_FLAGS}")
-endif()
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 
 add_library(B OBJECT b1.c b2.c)
 target_include_directories(B PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

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

Summary of changes:
 Help/command/add_library.rst                          |    3 ++-
 Source/cmGeneratorTarget.cxx                          |    7 ++-----
 Tests/ObjectLibrary/A/CMakeLists.txt                  |   15 +++++++++------
 Tests/ObjectLibrary/B/CMakeLists.txt                  |    5 +----
 Tests/ObjectLibrary/CMakeLists.txt                    |    1 +
 Tests/RunCMake/ObjectLibrary/BadObjSource1-stderr.txt |    3 ++-
 Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt |    3 ++-
 7 files changed, 19 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list