[Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-136-g49e777a

Kitware Robot kwrobot at kitware.com
Mon Mar 5 09:05:13 EST 2018


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, master has been updated
       via  49e777aeb1dbb141383faf1e5cb20c7443952302 (commit)
       via  dc38970f8388e21227c8cdc50df93431c3719030 (commit)
       via  b39a9dd897f3062273acb4d2ea3dbf4d9c7343c3 (commit)
       via  7776ce98c3fc1fc656c646ea783c23aee27261a2 (commit)
       via  bafe655b11c876b45a5ce1fbaf4643593bdd22a3 (commit)
       via  57538224d06225ce039f9c883465c6743186c2f4 (commit)
       via  9a7f039ee7d3f40d6d041fd0d1ef43f92faf8996 (commit)
       via  dfb6e84082884f908ffad4594d2712d9edfd2cc0 (commit)
       via  51249e69eaab33fe43805b9fe2262b4ddab01b56 (commit)
       via  e22c45d4c97c713734b8349132fa881f602f7ae3 (commit)
       via  0a21d820d3533309daff2f7fbf3389cd900cf9b8 (commit)
       via  f93cc4158e0df5f7cc39c97e275bdc58c54698bd (commit)
       via  915b71010c1c48ccd8e84df825579dd5595afc9a (commit)
       via  fcaa134c6c36e2de8d454a3d5132dee19f9f7b95 (commit)
       via  cf5d0b49e8505ca9e17c5c5a44bbdce933f3cb63 (commit)
       via  1ac042aa67c0e0ab531cd38977cb2f65fd96ed4b (commit)
      from  2fbd77124e4990a381143f0351b1caed12db5107 (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49e777aeb1dbb141383faf1e5cb20c7443952302
commit 49e777aeb1dbb141383faf1e5cb20c7443952302
Merge: dc38970 0a21d82
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Mar 5 14:02:07 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Mar 5 09:02:14 2018 -0500

    Merge topic 'general_cleanup_enhance'
    
    0a21d820d3 Remove c_str() from calls to converttorelativeformake in XCode Generator
    f93cc4158e Refactor cmCacheManager::LoadCache to use ostringstream
    915b71010c Enhance RunCMake test coverage for file(GLOB)
    fcaa134c6c Refactor HandleGlobCommand
    cf5d0b49e8 Adjust class description in cmFileTimeComparison.h
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1810


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc38970f8388e21227c8cdc50df93431c3719030
commit dc38970f8388e21227c8cdc50df93431c3719030
Merge: b39a9dd 7776ce9
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Mar 5 14:01:24 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Mar 5 09:01:42 2018 -0500

    Merge topic 'object-library-linking'
    
    7776ce98c3 Tests: Add cases for usage requirements of linked object libs
    bafe655b11 Help: Document linking behavior of OBJECT libraries
    57538224d0 objlib: Link object-files from `OBJECT` libraries.
    9a7f039ee7 objlib: Allow `OBJECT` libraries to link to `OBJECT` libraries.
    dfb6e84082 objlib: Allow other libraries to link to `OBJECT` libraries.
    51249e69ea objlib: Allow `OBJECT` libraries to link to other libraries.
    e22c45d4c9 Tests: Teach RunCMake to ignore AIX ld warnings about GNU atexit
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Acked-by: Pavel Solodovnikov <hellyeahdominate at gmail.com>
    Acked-by: John Drouhard <john at jmdtech.org>
    Merge-request: !1524


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b39a9dd897f3062273acb4d2ea3dbf4d9c7343c3
commit b39a9dd897f3062273acb4d2ea3dbf4d9c7343c3
Merge: 2fbd771 1ac042a
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Mar 5 14:00:18 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Mar 5 09:00:30 2018 -0500

    Merge topic 'def-generate-windows-only'
    
    1ac042aa67 Do not generate rules for .def generation where not supported
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1809


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7776ce98c3fc1fc656c646ea783c23aee27261a2
commit 7776ce98c3fc1fc656c646ea783c23aee27261a2
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Mar 1 09:25:50 2018 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Mar 1 09:28:00 2018 -0500

    Tests: Add cases for usage requirements of linked object libs
    
    Add tests to cover transitive usage requirements on installation and
    export of targets that link to object libraries.
    
    Issue: #14778

diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 4f663f6..cbc8c6b 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -88,7 +88,17 @@ else()
   set(maybe_OBJECTS_DESTINATION "")
 endif()
 
-add_library(testLib9Obj OBJECT testLib9Obj.c)
+cmake_policy(PUSH)
+cmake_policy(SET CMP0022 NEW)
+add_library(testLib9ObjPub OBJECT testLib9ObjPub.c)
+target_compile_definitions(testLib9ObjPub INTERFACE testLib9ObjPub_USED)
+add_library(testLib9ObjPriv OBJECT testLib9ObjPriv.c)
+target_compile_definitions(testLib9ObjPriv INTERFACE testLib9ObjPriv_USED)
+add_library(testLib9ObjIface OBJECT testLib9ObjIface.c)
+target_compile_definitions(testLib9ObjIface INTERFACE testLib9ObjIface_USED)
+add_library(testLib9 STATIC testLib9.c)
+target_link_libraries(testLib9 INTERFACE testLib9ObjIface PUBLIC testLib9ObjPub PRIVATE testLib9ObjPriv)
+cmake_policy(POP)
 
 # Test using the target_link_libraries command to set the
 # LINK_INTERFACE_LIBRARIES* properties.  We construct two libraries
@@ -486,6 +496,7 @@ install(
   testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3 testExe4
   testExe2lib testLib4lib testLib4libdbg testLib4libopt
   testLib6 testLib7 testLib8
+  testLib9
   testLibCycleA testLibCycleB
   testLibNoSONAME
   cmp0022NEW cmp0022OLD
@@ -500,7 +511,7 @@ install(
   )
 install(
   TARGETS
-  testLib9Obj
+  testLib9ObjPub testLib9ObjPriv testLib9ObjIface
   EXPORT exp
   )
 if (APPLE)
@@ -553,7 +564,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
   )
 export(TARGETS testExe2 testLib4 testLib5 testLib6 testLib7 testExe3 testExe4 testExe2lib
   testLib8
-  testLib9Obj
+  testLib9 testLib9ObjPub testLib9ObjPriv testLib9ObjIface
   testLib4lib testLib4libdbg testLib4libopt
   testLibCycleA testLibCycleB
   testLibNoSONAME
diff --git a/Tests/ExportImport/Export/testLib9.c b/Tests/ExportImport/Export/testLib9.c
new file mode 100644
index 0000000..fe8610b
--- /dev/null
+++ b/Tests/ExportImport/Export/testLib9.c
@@ -0,0 +1,15 @@
+#ifndef testLib9ObjPub_USED
+#error "testLib9ObjPub_USED not defined!"
+#endif
+#ifndef testLib9ObjPriv_USED
+#error "testLib9ObjPriv_USED not defined!"
+#endif
+#ifdef testLib9ObjIface_USED
+#error "testLib9ObjIface_USED defined but should not be!"
+#endif
+int testLib9ObjPub(void);
+int testLib9ObjPriv(void);
+int testLib9(void)
+{
+  return (testLib9ObjPub() + testLib9ObjPriv());
+}
diff --git a/Tests/ExportImport/Export/testLib9Obj.c b/Tests/ExportImport/Export/testLib9Obj.c
deleted file mode 100644
index 6a13e48..0000000
--- a/Tests/ExportImport/Export/testLib9Obj.c
+++ /dev/null
@@ -1,4 +0,0 @@
-int testLib9Obj(void)
-{
-  return 0;
-}
diff --git a/Tests/ExportImport/Export/testLib9ObjIface.c b/Tests/ExportImport/Export/testLib9ObjIface.c
new file mode 100644
index 0000000..e75440a
--- /dev/null
+++ b/Tests/ExportImport/Export/testLib9ObjIface.c
@@ -0,0 +1,11 @@
+/* Duplicate symbols from other sources to verify that this source
+   is not included when the object library is used.  */
+int testLib9ObjMissing(void);
+int testLib9ObjPub(void)
+{
+  return testLib9ObjMissing();
+}
+int testLib9ObjPriv(void)
+{
+  return testLib9ObjMissing();
+}
diff --git a/Tests/ExportImport/Export/testLib9ObjPriv.c b/Tests/ExportImport/Export/testLib9ObjPriv.c
new file mode 100644
index 0000000..6fa63cc
--- /dev/null
+++ b/Tests/ExportImport/Export/testLib9ObjPriv.c
@@ -0,0 +1,4 @@
+int testLib9ObjPriv(void)
+{
+  return 0;
+}
diff --git a/Tests/ExportImport/Export/testLib9ObjPub.c b/Tests/ExportImport/Export/testLib9ObjPub.c
new file mode 100644
index 0000000..66e2624
--- /dev/null
+++ b/Tests/ExportImport/Export/testLib9ObjPub.c
@@ -0,0 +1,4 @@
+int testLib9ObjPub(void)
+{
+  return 0;
+}
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 6d16cb7..4e8eac2 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -231,26 +231,41 @@ target_link_libraries(imp_lib1b bld_testLib2)
 if(NOT CMAKE_GENERATOR STREQUAL "Xcode" OR NOT CMAKE_OSX_ARCHITECTURES MATCHES "[;$]")
   set(bld_objlib_type OBJECT_LIBRARY)
 
-  # Create a executable that is using objects imported from the install tree
-  add_executable(imp_testLib8 imp_testLib8.c $<TARGET_OBJECTS:exp_testLib8>)
+  # Create executables using objects imported from the install tree
+  add_executable(imp_testLib8_src imp_testLib8.c $<TARGET_OBJECTS:exp_testLib8>)
+  add_executable(imp_testLib8_link imp_testLib8.c)
+  target_link_libraries(imp_testLib8_link exp_testLib8)
 
   if(NOT CMAKE_GENERATOR STREQUAL "Xcode" OR NOT XCODE_VERSION VERSION_LESS 5)
-    # Create a executable that is using objects imported from the build tree
-    add_executable(imp_testLib8b imp_testLib8.c $<TARGET_OBJECTS:bld_testLib8>)
+    # Create executables using objects imported from the build tree
+    add_executable(imp_testLib8b_src imp_testLib8.c $<TARGET_OBJECTS:bld_testLib8>)
+    add_executable(imp_testLib8b_link imp_testLib8.c)
+    target_link_libraries(imp_testLib8b_link bld_testLib8)
   endif()
 else()
   set(bld_objlib_type INTERFACE_LIBRARY)
 endif()
 
+# Create an executable that uses a library imported from the install tree
+# that itself was built using an object library.  Verify we get the usage
+# requirements.
+add_executable(imp_testLib9 imp_testLib9.c)
+target_link_libraries(imp_testLib9 exp_testLib9)
+# Similarly for importing from the build tree.
+add_executable(imp_testLib9b imp_testLib9.c)
+target_link_libraries(imp_testLib9b bld_testLib9)
+
 # Check that object libraries were transformed on export as expected.
-get_property(type TARGET exp_testLib9Obj PROPERTY TYPE)
-if(NOT type STREQUAL INTERFACE_LIBRARY)
-  message(FATAL_ERROR "exp_testLib9Obj type is '${type}', not 'INTERFACE_LIBRARY'")
-endif()
-get_property(type TARGET bld_testLib9Obj PROPERTY TYPE)
-if(NOT type STREQUAL "${bld_objlib_type}")
-  message(FATAL_ERROR "bld_testLib9Obj type is '${type}', not '${bld_objlib_type}'")
-endif()
+foreach(vis Pub Priv Iface)
+  get_property(type TARGET exp_testLib9Obj${vis} PROPERTY TYPE)
+  if(NOT type STREQUAL INTERFACE_LIBRARY)
+    message(FATAL_ERROR "exp_testLib9Obj${vis} type is '${type}', not 'INTERFACE_LIBRARY'")
+  endif()
+  get_property(type TARGET bld_testLib9Obj${vis} PROPERTY TYPE)
+  if(NOT type STREQUAL "${bld_objlib_type}")
+    message(FATAL_ERROR "bld_testLib9Obj${vis} type is '${type}', not '${bld_objlib_type}'")
+  endif()
+endforeach()
 
 #-----------------------------------------------------------------------------
 # Test that handling imported targets, including transitive dependencies,
diff --git a/Tests/ExportImport/Import/A/imp_testLib9.c b/Tests/ExportImport/Import/A/imp_testLib9.c
new file mode 100644
index 0000000..f9c05fd
--- /dev/null
+++ b/Tests/ExportImport/Import/A/imp_testLib9.c
@@ -0,0 +1,16 @@
+#ifndef testLib9ObjPub_USED
+#error "testLib9ObjPub_USED not defined!"
+#endif
+#ifdef testLib9ObjPriv_USED
+#error "testLib9ObjPriv_USED defined but should not be!"
+#endif
+#ifndef testLib9ObjIface_USED
+#error "testLib9ObjIface_USED not defined!"
+#endif
+
+int testLib9(void);
+
+int main()
+{
+  return testLib9();
+}
diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-result.txt b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt
new file mode 100644
index 0000000..f2f0f94
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt
@@ -0,0 +1 @@
+CMake Error: install\(EXPORT "exp" ...\) includes target "UseA" which requires target "A" that is not in the export set.
diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1.cmake b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1.cmake
new file mode 100644
index 0000000..9e24609
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1.cmake
@@ -0,0 +1,6 @@
+add_library(A OBJECT a.c)
+add_library(UseA STATIC)
+target_link_libraries(UseA PUBLIC A)
+
+install(TARGETS UseA EXPORT exp ARCHIVE DESTINATION lib)
+install(EXPORT exp DESTINATION lib/cmake/exp)
diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj2.cmake b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj2.cmake
new file mode 100644
index 0000000..cdda962
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj2.cmake
@@ -0,0 +1,6 @@
+add_library(A OBJECT a.c)
+add_library(UseA STATIC)
+target_link_libraries(UseA PUBLIC A)
+
+install(TARGETS UseA A EXPORT exp ARCHIVE DESTINATION lib)
+install(EXPORT exp DESTINATION lib/cmake/exp)
diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
index 61be23d..c73732f 100644
--- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
@@ -11,6 +11,8 @@ if(RunCMake_GENERATOR STREQUAL "Xcode" AND "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCH
 else()
   run_cmake(Import)
   run_cmake(Install)
+  run_cmake(InstallLinkedObj1)
+  run_cmake(InstallLinkedObj2)
 endif()
 run_cmake(Export)
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bafe655b11c876b45a5ce1fbaf4643593bdd22a3
commit bafe655b11c876b45a5ce1fbaf4643593bdd22a3
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Mar 1 09:25:45 2018 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Mar 1 09:27:50 2018 -0500

    Help: Document linking behavior of OBJECT libraries
    
    Inspired-by: Deniz Bahadir <dbahadir at benocs.com>
    Issue: #14778

diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst
index 3706153..8fa0df7 100644
--- a/Help/command/add_library.rst
+++ b/Help/command/add_library.rst
@@ -110,10 +110,10 @@ along with those compiled from their own sources.  Object libraries
 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 linked.  Some native build systems (such as Xcode) may not like
-targets that have only object files, so consider adding at least one real
-source file to any target that references ``$<TARGET_OBJECTS:objlib>``.
+``PRE_BUILD``, ``PRE_LINK``, or ``POST_BUILD`` commands.  Some native build
+systems (such as Xcode) may not like targets that have only object files, so
+consider adding at least one real source file to any target that references
+``$<TARGET_OBJECTS:objlib>``.
 
 Alias Libraries
 ^^^^^^^^^^^^^^^
diff --git a/Help/command/export.rst b/Help/command/export.rst
index 17fcecb..0c676c6 100644
--- a/Help/command/export.rst
+++ b/Help/command/export.rst
@@ -45,7 +45,9 @@ unspecified.
   :ref:`Object Libraries` under :generator:`Xcode` have special handling if
   multiple architectures are listed in :variable:`CMAKE_OSX_ARCHITECTURES`.
   In this case they will be exported as :ref:`Interface Libraries` with
-  no object files available to clients.
+  no object files available to clients.  This is sufficient to satisfy
+  transitive usage requirements of other targets that link to the
+  object libraries in their implementation.
 
 ::
 
diff --git a/Help/command/install.rst b/Help/command/install.rst
index 1cedc35..eb7b07c 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -187,6 +187,8 @@ export file itself, call ``install(EXPORT)``, documented below.
 They install no artifacts but will be included in an associated ``EXPORT``.
 If :ref:`Object Libraries` are listed but given no destination for their
 object files, they will be exported as :ref:`Interface Libraries`.
+This is sufficient to satisfy transitive usage requirements of other
+targets that link to the object libraries in their implementation.
 
 Installing a target with the :prop_tgt:`EXCLUDE_FROM_ALL` target property
 set to ``TRUE`` has undefined behavior.
diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst
index 2ec8744..fcc2c07 100644
--- a/Help/command/target_link_libraries.rst
+++ b/Help/command/target_link_libraries.rst
@@ -183,6 +183,70 @@ is not ``NEW``, they are also appended to the
 ``general`` (or without any keyword) are treated as if specified for both
 ``debug`` and ``optimized``.
 
+Linking Object Libraries
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+:ref:`Object Libraries` may be used as the ``<target>`` (first) argument
+of ``target_link_libraries`` to specify dependencies of their sources
+on other libraries.  For example, the code
+
+.. code-block:: cmake
+
+  add_library(A SHARED a.c)
+  target_compile_definitions(A PUBLIC A)
+
+  add_library(obj OBJECT obj.c)
+  target_compile_definitions(obj PUBLIC OBJ)
+  target_link_libraries(obj PUBLIC A)
+
+compiles ``obj.c`` with ``-DA -DOBJ`` and establishes usage requirements
+for ``obj`` that propagate to its dependents.
+
+Normal libraries and executables may link to :ref:`Object Libraries`
+to get their objects and usage requirements.  Continuing the above
+example, the code
+
+.. code-block:: cmake
+
+  add_library(B SHARED b.c)
+  target_link_libraries(B PUBLIC obj)
+
+compiles ``b.c`` with ``-DA -DOBJ``, creates shared library ``B``
+with object files from ``b.c`` and ``obj.c``, and links ``B`` to ``A``.
+Furthermore, the code
+
+.. code-block:: cmake
+
+  add_executable(main main.c)
+  target_link_libraries(main B)
+
+compiles ``main.c`` with ``-DA -DOBJ`` and links executable ``main``
+to ``B`` and ``A``.  The object library's usage requirements are
+propagated transitively through ``B``, but its object files are not.
+
+:ref:`Object Libraries` may "link" to other object libraries to get
+usage requirements, but since they do not have a link step nothing
+is done with their object files.  Continuing from the above example,
+the code:
+
+.. code-block:: cmake
+
+  add_library(obj2 OBJECT obj2.c)
+  target_link_libraries(obj2 PUBLIC obj)
+
+  add_executable(main2 main2.c)
+  target_link_libraries(main2 obj2)
+
+compiles ``obj2.c`` with ``-DA -DOBJ``, creates executable ``main2``
+with object files from ``main2.c`` and ``obj2.c``, and links ``main2``
+to ``A``.
+
+In other words, when :ref:`Object Libraries` appear in a target's
+:prop_tgt:`INTERFACE_LINK_LIBRARIES` property they will be
+treated as :ref:`Interface Libraries`, but when they appear in
+a target's :prop_tgt:`LINK_LIBRARIES` property their object files
+will be included in the link too.
+
 Cyclic Dependencies of Static Libraries
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst
index ae538ed..3516d48 100644
--- a/Help/manual/cmake-buildsystem.7.rst
+++ b/Help/manual/cmake-buildsystem.7.rst
@@ -113,9 +113,9 @@ and it uniquely identifies the bundle.
 Object Libraries
 ^^^^^^^^^^^^^^^^
 
-The ``OBJECT`` library type is also not linked to. It defines a non-archival
-collection of object files resulting from compiling the given source files.
-The object files collection can be used as source inputs to other targets:
+The ``OBJECT`` library type defines a non-archival collection of object files
+resulting from compiling the given source files.  The object files collection
+may be used as source inputs to other targets:
 
 .. code-block:: cmake
 
@@ -125,22 +125,31 @@ The object files collection can be used as source inputs to other targets:
 
   add_executable(test_exe $<TARGET_OBJECTS:archive> test.cpp)
 
-``OBJECT`` libraries may not be used in the right hand side of
-:command:`target_link_libraries`.  They also may not be used as the ``TARGET``
-in a use of the :command:`add_custom_command(TARGET)` command signature.  They
-may be installed, and will be exported as an INTERFACE library.
+The link (or archiving) step of those other targets will use the object
+files collection in addition to those from their own sources.
 
-Although object libraries may not be named directly in calls to
-the :command:`target_link_libraries` command, they can be "linked"
-indirectly by using an :ref:`Interface Library <Interface Libraries>`
-whose :prop_tgt:`INTERFACE_SOURCES` target property is set to name
-``$<TARGET_OBJECTS:objlib>``.
+Alternatively, object libraries may be linked into other targets:
 
-Although object libraries may not be used as the ``TARGET``
-in a use of the :command:`add_custom_command(TARGET)` command signature,
-the list of objects can be used by :command:`add_custom_command(OUTPUT)` or
-:command:`file(GENERATE)` by using ``$<TARGET_OBJECTS:objlib>``.
+.. code-block:: cmake
+
+  add_library(archive OBJECT archive.cpp zip.cpp lzma.cpp)
+
+  add_library(archiveExtras STATIC extras.cpp)
+  target_link_libraries(archiveExtras PUBLIC archive)
+
+  add_executable(test_exe test.cpp)
+  target_link_libraries(test_exe archive)
+
+The link (or archiving) step of those other targets will use the object
+files from object libraries that are *directly* linked.  Additionally,
+usage requirements of the object libraries will be honored when compiling
+sources in those other targets.  Furthermore, those usage requirements
+will propagate transitively to dependents of those other targets.
 
+Object libraries may not be used as the ``TARGET`` in a use of the
+:command:`add_custom_command(TARGET)` command signature.  However,
+the list of objects can be used by :command:`add_custom_command(OUTPUT)`
+or :command:`file(GENERATE)` by using ``$<TARGET_OBJECTS:objlib>``.
 
 Build Specification and Usage Requirements
 ==========================================
diff --git a/Help/release/dev/object-library-linking.rst b/Help/release/dev/object-library-linking.rst
new file mode 100644
index 0000000..131430f
--- /dev/null
+++ b/Help/release/dev/object-library-linking.rst
@@ -0,0 +1,6 @@
+object-library-linking
+----------------------
+
+* The :command:`target_link_libraries` command now supports
+  :ref:`Object Libraries`.  Linking to an object library uses its object
+  files in direct dependents and also propagates usage requirements.

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=57538224d06225ce039f9c883465c6743186c2f4
commit 57538224d06225ce039f9c883465c6743186c2f4
Author:     Deniz Bahadir <dbahadir at benocs.com>
AuthorDate: Thu Dec 14 16:47:22 2017 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Mar 1 09:24:25 2018 -0500

    objlib: Link object-files from `OBJECT` libraries.
    
    Note: This finally links the object-files of the `OBJECT` library from
    the right-hand side of `target_link_libraries` to the target on the
    left-hand side. However, this will only happen with directly linked
    `OBJECT` libraries, not with `OBJECT` libraries "linked" through
    property `INTERFACE_LINK_LIBRARIES` of a target on the right-hand side!
    
    Fixes: #14778

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 3aa57d2..2f581fc 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -809,6 +809,26 @@ static void AddInterfaceEntries(
   }
 }
 
+static void AddObjectEntries(
+  cmGeneratorTarget const* thisTarget, std::string const& config,
+  std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries)
+{
+  if (cmLinkImplementationLibraries const* impl =
+        thisTarget->GetLinkImplementationLibraries(config)) {
+    for (cmLinkImplItem const& lib : impl->Libraries) {
+      if (lib.Target &&
+          lib.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
+        std::string genex = "$<TARGET_OBJECTS:" + lib + ">";
+        cmGeneratorExpression ge(lib.Backtrace);
+        std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex);
+        cge->SetEvaluateForBuildsystem(true);
+        entries.push_back(
+          new cmGeneratorTarget::TargetPropertyEntry(std::move(cge), lib));
+      }
+    }
+  }
+}
+
 static bool processSources(
   cmGeneratorTarget const* tgt,
   const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
@@ -849,13 +869,10 @@ static bool processSources(
         std::ostringstream err;
         if (!targetName.empty()) {
           err << "Target \"" << targetName
-              << "\" contains relative "
-                 "path in its INTERFACE_SOURCES:\n"
-                 "  \""
+              << "\" contains relative path in its INTERFACE_SOURCES:\n  \""
               << src << "\"";
         } else {
-          err << "Found relative path while evaluating sources of "
-                 "\""
+          err << "Found relative path while evaluating sources of \""
               << tgt->GetName() << "\":\n  \"" << src << "\"\n";
         }
         tgt->GetLocalGenerator()->IssueMessage(cmake::FATAL_ERROR, err.str());
@@ -932,23 +949,32 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<std::string>& files,
     processSources(this, this->SourceEntries, files, uniqueSrcs, &dagChecker,
                    config, debugSources);
 
+  // Collect INTERFACE_SOURCES of all direct link-dependencies.
   std::vector<cmGeneratorTarget::TargetPropertyEntry*>
     linkInterfaceSourcesEntries;
-
   AddInterfaceEntries(this, config, "INTERFACE_SOURCES",
                       linkInterfaceSourcesEntries);
-
   std::vector<std::string>::size_type numFilesBefore = files.size();
   bool contextDependentInterfaceSources =
     processSources(this, linkInterfaceSourcesEntries, files, uniqueSrcs,
                    &dagChecker, config, debugSources);
 
+  // Collect TARGET_OBJECTS of direct object link-dependencies.
+  std::vector<cmGeneratorTarget::TargetPropertyEntry*> linkObjectsEntries;
+  AddObjectEntries(this, config, linkObjectsEntries);
+  std::vector<std::string>::size_type numFilesBefore2 = files.size();
+  bool contextDependentObjects =
+    processSources(this, linkObjectsEntries, files, uniqueSrcs, &dagChecker,
+                   config, debugSources);
+
   if (!contextDependentDirectSources &&
-      !(contextDependentInterfaceSources && numFilesBefore < files.size())) {
+      !(contextDependentInterfaceSources && numFilesBefore < files.size()) &&
+      !(contextDependentObjects && numFilesBefore2 < files.size())) {
     this->LinkImplementationLanguageIsContextDependent = false;
   }
 
   cmDeleteAll(linkInterfaceSourcesEntries);
+  cmDeleteAll(linkObjectsEntries);
 }
 
 void cmGeneratorTarget::GetSourceFiles(std::vector<cmSourceFile*>& files,
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake
new file mode 100644
index 0000000..e2e5fa2
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake
@@ -0,0 +1,14 @@
+enable_language(C)
+
+add_definitions(-DCOMPILE_FOR_SHARED_LIB)
+
+add_library(AnObjLib OBJECT a.c)
+target_compile_definitions(AnObjLib INTERFACE REQUIRED)
+set_target_properties(AnObjLib PROPERTIES POSITION_INDEPENDENT_CODE ON)
+
+add_library(A SHARED b.c)
+target_link_libraries(A PRIVATE AnObjLib)
+target_compile_definitions(A INTERFACE $<TARGET_PROPERTY:AnObjLib,INTERFACE_COMPILE_DEFINITIONS>)
+
+add_executable(exe exe.c)
+target_link_libraries(exe A)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake
new file mode 100644
index 0000000..9e1ab6d
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake
@@ -0,0 +1,11 @@
+enable_language(C)
+
+add_library(AnObjLib OBJECT a.c)
+target_compile_definitions(AnObjLib INTERFACE REQUIRED)
+
+add_library(A STATIC b.c)
+target_link_libraries(A PRIVATE AnObjLib)
+target_compile_definitions(A INTERFACE $<TARGET_PROPERTY:AnObjLib,INTERFACE_COMPILE_DEFINITIONS>)
+
+add_executable(exe exe.c)
+target_link_libraries(exe A)
diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
index 287331b..61be23d 100644
--- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
@@ -40,6 +40,8 @@ run_object_lib_build(LinkObjLHSStatic)
 run_object_lib_build(LinkObjRHSShared)
 run_object_lib_build(LinkObjRHSStatic)
 run_object_lib_build2(LinkObjRHSObject)
+run_object_lib_build(LinkObjRHSShared2)
+run_object_lib_build(LinkObjRHSStatic2)
 run_object_lib_build2(LinkObjRHSObject2)
 
 run_cmake(MissingSource)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9a7f039ee7d3f40d6d041fd0d1ef43f92faf8996
commit 9a7f039ee7d3f40d6d041fd0d1ef43f92faf8996
Author:     Deniz Bahadir <dbahadir at benocs.com>
AuthorDate: Thu Dec 14 20:26:51 2017 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Mar 1 09:24:25 2018 -0500

    objlib: Allow `OBJECT` libraries to link to `OBJECT` libraries.
    
    Note: This still does not link the object-files of the `OBJECT` library
    from the right-hand side of `target_link_libraries` to the target on the
    left-hand side. (In this particular case of another `OBJECT` library on
    the left-hand side this would not make any sense anyway. The target on
    the left-hand side has no link-step.)
    
    Issue: #14778

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index f6fd6d1..3aa57d2 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1054,9 +1054,6 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files,
       kind = SourceKindHeader;
     } else if (sf->GetPropertyAsBool("EXTERNAL_OBJECT")) {
       kind = SourceKindExternalObject;
-      if (this->GetType() == cmStateEnums::OBJECT_LIBRARY) {
-        badObjLib.push_back(sf);
-      }
     } else if (!sf->GetLanguage().empty()) {
       kind = SourceKindObjectSource;
     } else if (ext == "def") {
diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt
deleted file mode 100644
index b91ffd0..0000000
--- a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-CMake Error at BadObjSource2.cmake:1 \(add_library\):
-  OBJECT library "A" contains:
-
-    bad.obj
-
-  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/LinkObjRHSObject-build-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-result.txt
new file mode 100644
index 0000000..e27f06b
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-result.txt
@@ -0,0 +1 @@
+[1-9][0-9]*
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-stdout.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-stdout.txt
new file mode 100644
index 0000000..4eeb096
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-stdout.txt
@@ -0,0 +1 @@
+REQUIRED needs to be defined
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake
new file mode 100644
index 0000000..db571a3
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake
@@ -0,0 +1,12 @@
+cmake_policy(SET CMP0022 NEW)
+
+enable_language(C)
+
+add_library(AnObjLib OBJECT a.c)
+target_compile_definitions(AnObjLib INTERFACE REQUIRED)
+
+add_library(AnotherObjLib OBJECT b.c)
+target_link_libraries(AnotherObjLib PRIVATE AnObjLib)
+
+add_executable(exe exe.c)
+target_link_libraries(exe AnotherObjLib)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2-build-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2-build-result.txt
new file mode 100644
index 0000000..e27f06b
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2-build-result.txt
@@ -0,0 +1 @@
+[1-9][0-9]*
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake
new file mode 100644
index 0000000..6bb8d5e
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake
@@ -0,0 +1,12 @@
+cmake_policy(SET CMP0022 NEW)
+
+enable_language(C)
+
+add_library(AnObjLib OBJECT a.c)
+target_compile_definitions(AnObjLib INTERFACE REQUIRED)
+
+add_library(AnotherObjLib OBJECT b.c)
+target_link_libraries(AnotherObjLib PUBLIC AnObjLib)
+
+add_executable(exe exe.c)
+target_link_libraries(exe AnotherObjLib)
diff --git a/Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt b/Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt b/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt
deleted file mode 100644
index aadc5e0..0000000
--- a/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Error at ObjWithObj.cmake:[0-9]+ \(add_library\):
-  OBJECT library \"B\" contains:
-
-    [^
-]*a(\.c)?\.o(bj)?
-
-  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:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
index 6724da1..287331b 100644
--- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
@@ -24,10 +24,23 @@ function (run_object_lib_build name)
   run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .)
 endfunction ()
 
+function (run_object_lib_build2 name)
+  # Use a single build tree for a few tests without cleaning.
+  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build)
+  set(RunCMake_TEST_NO_CLEAN 1)
+  file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+  file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+  run_cmake(${name})
+  set(RunCMake_TEST_OUTPUT_MERGE 1)
+  run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .)
+endfunction ()
+
 run_object_lib_build(LinkObjLHSShared)
 run_object_lib_build(LinkObjLHSStatic)
 run_object_lib_build(LinkObjRHSShared)
 run_object_lib_build(LinkObjRHSStatic)
+run_object_lib_build2(LinkObjRHSObject)
+run_object_lib_build2(LinkObjRHSObject2)
 
 run_cmake(MissingSource)
 run_cmake(ObjWithObj)
diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt
deleted file mode 100644
index 6183f80..0000000
--- a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-^CMake Error at OBJECTwithOnlyObjectSources.cmake:[0-9]+ \(add_library\):
-  OBJECT library \"TestObjectLibWithoutSources\" contains:
-
-    [^
-]*test(\.cpp)?\.o(bj)?
-
-  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:[0-9]+ \(include\)$

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dfb6e84082884f908ffad4594d2712d9edfd2cc0
commit dfb6e84082884f908ffad4594d2712d9edfd2cc0
Author:     Deniz Bahadir <dbahadir at benocs.com>
AuthorDate: Fri Nov 24 17:20:18 2017 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Mar 1 09:24:24 2018 -0500

    objlib: Allow other libraries to link to `OBJECT` libraries.
    
    Note: This only allows `OBJECT` libraries to be on the right-hand side
    of `target_link_libraries` but still does not link its object-files to
    the target on the left-hand side.
    
    Issue: #14778

diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 8a5a6de..e00450f 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -611,6 +611,9 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
       if (!libName.empty()) {
         this->AddItem(libName, nullptr);
       }
+    } else if (tgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
+      // Ignore object library!
+      // Its object-files should already have been extracted for linking.
     } else {
       // Decide whether to use an import library.
       bool implib =
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 18767a3..efdd3a5 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -211,11 +211,11 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
           if (depender->GetType() != cmStateEnums::EXECUTABLE &&
               depender->GetType() != cmStateEnums::STATIC_LIBRARY &&
               depender->GetType() != cmStateEnums::SHARED_LIBRARY &&
-              depender->GetType() != cmStateEnums::MODULE_LIBRARY) {
+              depender->GetType() != cmStateEnums::MODULE_LIBRARY &&
+              depender->GetType() != cmStateEnums::OBJECT_LIBRARY) {
             this->GlobalGenerator->GetCMakeInstance()->IssueMessage(
               cmake::FATAL_ERROR,
-              "Only executables and non-OBJECT libraries may "
-              "reference target objects.",
+              "Only executables and libraries may reference target objects.",
               depender->GetBacktrace());
             return;
           }
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index a276d01..f0ae47b 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -159,7 +159,9 @@ cmStateEnums::TargetType cmExportBuildFileGenerator::GetExportTargetType(
 {
   cmStateEnums::TargetType targetType = target->GetType();
   // An object library exports as an interface library if we cannot
-  // tell clients where to find the objects.
+  // tell clients where to find the objects.  This is sufficient
+  // to support transitive usage requirements on other targets that
+  // use the object library.
   if (targetType == cmStateEnums::OBJECT_LIBRARY &&
       !this->LG->GetGlobalGenerator()->HasKnownObjectFileLocation(nullptr)) {
     targetType = cmStateEnums::INTERFACE_LIBRARY;
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index e9b6daf..f6fd6d1 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -240,13 +240,16 @@ const char* cmGeneratorTarget::GetOutputTargetType(
     case cmStateEnums::MODULE_LIBRARY:
       switch (artifact) {
         case cmStateEnums::RuntimeBinaryArtifact:
-          // Module import libraries are treated as archive targets.
+          // Module libraries are always treated as library targets.
           return "LIBRARY";
         case cmStateEnums::ImportLibraryArtifact:
-          // Module libraries are always treated as library targets.
+          // Module import libraries are treated as archive targets.
           return "ARCHIVE";
       }
       break;
+    case cmStateEnums::OBJECT_LIBRARY:
+      // Object libraries are always treated as object targets.
+      return "OBJECT";
     case cmStateEnums::EXECUTABLE:
       switch (artifact) {
         case cmStateEnums::RuntimeBinaryArtifact:
@@ -1671,6 +1674,7 @@ bool cmGeneratorTarget::HaveWellDefinedOutputFiles() const
   return this->GetType() == cmStateEnums::STATIC_LIBRARY ||
     this->GetType() == cmStateEnums::SHARED_LIBRARY ||
     this->GetType() == cmStateEnums::MODULE_LIBRARY ||
+    this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
     this->GetType() == cmStateEnums::EXECUTABLE;
 }
 
@@ -5323,20 +5327,6 @@ cmGeneratorTarget* cmGeneratorTarget::FindTargetToLink(
     tgt = nullptr;
   }
 
-  if (tgt && tgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
-    std::ostringstream e;
-    e << "Target \"" << this->GetName() << "\" links to "
-                                           "OBJECT library \""
-      << tgt->GetName()
-      << "\" but this is not "
-         "allowed.  "
-         "One may link only to STATIC or SHARED libraries, or to executables "
-         "with the ENABLE_EXPORTS property set.";
-    cmake* cm = this->LocalGenerator->GetCMakeInstance();
-    cm->IssueMessage(cmake::FATAL_ERROR, e.str(), this->GetBacktrace());
-    tgt = nullptr;
-  }
-
   return tgt;
 }
 
@@ -5400,6 +5390,7 @@ bool cmGeneratorTarget::IsLinkable() const
           this->GetType() == cmStateEnums::SHARED_LIBRARY ||
           this->GetType() == cmStateEnums::MODULE_LIBRARY ||
           this->GetType() == cmStateEnums::UNKNOWN_LIBRARY ||
+          this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
           this->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
           this->IsExecutableWithExports());
 }
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 734ac93..bb21022 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -114,15 +114,12 @@ const char* cmTargetPropertyComputer::GetSources<cmTarget>(
         }
         if (!noMessage) {
           e << "Target \"" << tgt->GetName()
-            << "\" contains "
-               "$<TARGET_OBJECTS> generator expression in its sources "
-               "list.  "
-               "This content was not previously part of the SOURCES "
-               "property "
-               "when that property was read at configure time.  Code "
-               "reading "
-               "that property needs to be adapted to ignore the generator "
-               "expression using the string(GENEX_STRIP) command.";
+            << "\" contains $<TARGET_OBJECTS> generator expression in its "
+               "sources list.  This content was not previously part of the "
+               "SOURCES property when that property was read at configure "
+               "time.  Code reading that property needs to be adapted to "
+               "ignore the generator expression using the string(GENEX_STRIP) "
+               "command.";
           messenger->IssueMessage(messageType, e.str(), context);
         }
         if (addContent) {
@@ -742,7 +739,8 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib,
   }
 
   if (cmGeneratorExpression::Find(lib) != std::string::npos ||
-      (tgt && tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) ||
+      (tgt && (tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
+               tgt->GetType() == cmStateEnums::OBJECT_LIBRARY)) ||
       (this->Name == lib)) {
     return;
   }
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 47c29db..699fff8 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -391,14 +391,15 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
     if (tgt && (tgt->GetType() != cmStateEnums::STATIC_LIBRARY) &&
         (tgt->GetType() != cmStateEnums::SHARED_LIBRARY) &&
         (tgt->GetType() != cmStateEnums::UNKNOWN_LIBRARY) &&
+        (tgt->GetType() != cmStateEnums::OBJECT_LIBRARY) &&
         (tgt->GetType() != cmStateEnums::INTERFACE_LIBRARY) &&
         !tgt->IsExecutableWithExports()) {
       std::ostringstream e;
       e << "Target \"" << lib << "\" of type "
         << cmState::GetTargetTypeName(tgt->GetType())
         << " may not be linked into another target.  One may link only to "
-           "INTERFACE, STATIC or SHARED libraries, or to executables with the "
-           "ENABLE_EXPORTS property set.";
+           "INTERFACE, OBJECT, STATIC or SHARED libraries, or to executables "
+           "with the ENABLE_EXPORTS property set.";
       this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
     }
 
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt
deleted file mode 100644
index d5ee4f9..0000000
--- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-CMake Error at LinkObjRHS1.cmake:3 \(target_link_libraries\):
-  Target "AnObjLib" of type OBJECT_LIBRARY may not be linked into another
-  target.  One may link only to INTERFACE, STATIC or SHARED libraries, or to
-  executables with the ENABLE_EXPORTS property set.
-Call Stack \(most recent call first\):
-  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake
deleted file mode 100644
index 113d6a8..0000000
--- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-add_library(A STATIC a.c)
-add_library(AnObjLib OBJECT a.c)
-target_link_libraries(A AnObjLib)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt
deleted file mode 100644
index 3295fca..0000000
--- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-CMake Error at LinkObjRHS2.cmake:1 \(add_library\):
-  Target "A" links to OBJECT library "AnObjLib" but this is not allowed.  One
-  may link only to STATIC or SHARED libraries, or to executables with the
-  ENABLE_EXPORTS property set.
-Call Stack \(most recent call first\):
-  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake
deleted file mode 100644
index 6163729..0000000
--- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-add_library(A SHARED a.c)
-target_link_libraries(A AnObjLib)
-add_library(AnObjLib OBJECT a.c)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake
new file mode 100644
index 0000000..b9030b3
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake
@@ -0,0 +1,13 @@
+enable_language(C)
+
+add_definitions(-DCOMPILE_FOR_SHARED_LIB)
+
+add_library(AnObjLib OBJECT a.c)
+target_compile_definitions(AnObjLib INTERFACE REQUIRED)
+set_target_properties(AnObjLib PROPERTIES POSITION_INDEPENDENT_CODE ON)
+
+add_library(A SHARED b.c $<TARGET_OBJECTS:AnObjLib>)
+target_link_libraries(A PUBLIC AnObjLib)
+
+add_executable(exe exe.c)
+target_link_libraries(exe A)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake
new file mode 100644
index 0000000..73fad06
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake
@@ -0,0 +1,10 @@
+enable_language(C)
+
+add_library(AnObjLib OBJECT a.c)
+target_compile_definitions(AnObjLib INTERFACE REQUIRED)
+
+add_library(A STATIC b.c $<TARGET_OBJECTS:AnObjLib>)
+target_link_libraries(A PUBLIC AnObjLib)
+
+add_executable(exe exe.c)
+target_link_libraries(exe A)
diff --git a/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt b/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt
index d67b4ae..aadc5e0 100644
--- a/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt
+++ b/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt
@@ -1,4 +1,10 @@
-CMake Error at ObjWithObj.cmake:2 \(add_library\):
-  Only executables and non-OBJECT libraries may reference target objects.
+^CMake Error at ObjWithObj.cmake:[0-9]+ \(add_library\):
+  OBJECT library \"B\" contains:
+
+    [^
+]*a(\.c)?\.o(bj)?
+
+  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\)
+  CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
index 1660779..6724da1 100644
--- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
@@ -26,9 +26,9 @@ endfunction ()
 
 run_object_lib_build(LinkObjLHSShared)
 run_object_lib_build(LinkObjLHSStatic)
+run_object_lib_build(LinkObjRHSShared)
+run_object_lib_build(LinkObjRHSStatic)
 
-run_cmake(LinkObjRHS1)
-run_cmake(LinkObjRHS2)
 run_cmake(MissingSource)
 run_cmake(ObjWithObj)
 run_cmake(OwnSources)
diff --git a/Tests/RunCMake/ObjectLibrary/a.c b/Tests/RunCMake/ObjectLibrary/a.c
index 1636303..5beb3f1 100644
--- a/Tests/RunCMake/ObjectLibrary/a.c
+++ b/Tests/RunCMake/ObjectLibrary/a.c
@@ -1,4 +1,10 @@
-int a(void)
+#if defined(_WIN32) && defined(COMPILE_FOR_SHARED_LIB)
+#define EXPORT __declspec(dllexport)
+#else
+#define EXPORT
+#endif
+
+EXPORT int a(void)
 {
   return 0;
 }
diff --git a/Tests/RunCMake/ObjectLibrary/b.c b/Tests/RunCMake/ObjectLibrary/b.c
index 6751907..7549abf 100644
--- a/Tests/RunCMake/ObjectLibrary/b.c
+++ b/Tests/RunCMake/ObjectLibrary/b.c
@@ -1,4 +1,14 @@
-int b(void)
+#if defined(_WIN32) && defined(COMPILE_FOR_SHARED_LIB)
+#define EXPORT __declspec(dllexport)
+#else
+#define EXPORT
+#endif
+
+extern int a(void);
+EXPORT int b()
 {
-  return 0;
+  return a();
 }
+#ifndef REQUIRED
+#error "REQUIRED needs to be defined"
+#endif
diff --git a/Tests/RunCMake/ObjectLibrary/exe.c b/Tests/RunCMake/ObjectLibrary/exe.c
new file mode 100644
index 0000000..6efdae7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/exe.c
@@ -0,0 +1,14 @@
+#if defined(_WIN32) && defined(COMPILE_FOR_SHARED_LIB)
+#define IMPORT __declspec(dllimport)
+#else
+#define IMPORT
+#endif
+
+extern IMPORT int b(void);
+int main()
+{
+  return b();
+}
+#ifndef REQUIRED
+#error "REQUIRED needs to be defined"
+#endif
diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt
index 77a72f1..6183f80 100644
--- a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt
+++ b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt
@@ -7,10 +7,4 @@
   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:[0-9]+ \(include\)
-
-
-CMake Error at OBJECTwithOnlyObjectSources.cmake:[0-9]+ \(add_library\):
-  Only executables and non-OBJECT libraries may reference target objects.
-Call Stack \(most recent call first\):
   CMakeLists.txt:[0-9]+ \(include\)$

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51249e69eaab33fe43805b9fe2262b4ddab01b56
commit 51249e69eaab33fe43805b9fe2262b4ddab01b56
Author:     Deniz Bahadir <dbahadir at benocs.com>
AuthorDate: Thu Nov 23 12:59:20 2017 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Mar 1 09:24:24 2018 -0500

    objlib: Allow `OBJECT` libraries to link to other libraries.
    
    The proper way to use libraries is now through `target_link_libraries`
    for things such as usage requirements, compile definitions, include
    directories, etc. To facilitate this, allow `OBJECT` libraries to "link"
    to other libraries.
    
    Co-Author: Ben Boeckel <ben.boeckel at kitware.com>
    Issue: #14778

diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index 9e4575a..47c29db 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -94,16 +94,6 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
     return true;
   }
 
-  // OBJECT libraries are not allowed on the LHS of the command.
-  if (this->Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
-    std::ostringstream e;
-    e << "Object library target \"" << args[0] << "\" "
-      << "may not link to anything.";
-    this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
-    cmSystemTools::SetFatalErrorOccured();
-    return true;
-  }
-
   // Having a UTILITY library on the LHS is a bug.
   if (this->Target->GetType() == cmStateEnums::UTILITY) {
     std::ostringstream e;
diff --git a/Tests/RunCMake/ObjectLibrary/CMakeLists.txt b/Tests/RunCMake/ObjectLibrary/CMakeLists.txt
index a17c8cd..d1b0d2c 100644
--- a/Tests/RunCMake/ObjectLibrary/CMakeLists.txt
+++ b/Tests/RunCMake/ObjectLibrary/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 2.8.4)
+cmake_minimum_required(VERSION 3.10)
 project(${RunCMake_TEST} C)
 include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt
deleted file mode 100644
index 90e828b..0000000
--- a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMake Error at LinkObjLHS.cmake:2 \(target_link_libraries\):
-  Object library target "AnObjLib" may not link to anything.
-Call Stack \(most recent call first\):
-  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake
deleted file mode 100644
index 5d7831a..0000000
--- a/Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-add_library(AnObjLib OBJECT a.c)
-target_link_libraries(AnObjLib OtherLib)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake
new file mode 100644
index 0000000..4aa7bba
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake
@@ -0,0 +1,7 @@
+project(LinkObjLHSShared C)
+
+add_library(OtherLib SHARED a.c)
+target_compile_definitions(OtherLib INTERFACE REQUIRED)
+
+add_library(AnObjLib OBJECT requires.c)
+target_link_libraries(AnObjLib OtherLib)
diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake
new file mode 100644
index 0000000..261bee7
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake
@@ -0,0 +1,7 @@
+project(LinkObjLHSStatic C)
+
+add_library(OtherLib STATIC a.c)
+target_compile_definitions(OtherLib INTERFACE REQUIRED)
+
+add_library(AnObjLib OBJECT requires.c)
+target_link_libraries(AnObjLib OtherLib)
diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
index 5c9dd65..1660779 100644
--- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake
@@ -13,7 +13,20 @@ else()
   run_cmake(Install)
 endif()
 run_cmake(Export)
-run_cmake(LinkObjLHS)
+
+function (run_object_lib_build name)
+  # Use a single build tree for a few tests without cleaning.
+  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build)
+  set(RunCMake_TEST_NO_CLEAN 1)
+  file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+  file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+  run_cmake(${name})
+  run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .)
+endfunction ()
+
+run_object_lib_build(LinkObjLHSShared)
+run_object_lib_build(LinkObjLHSStatic)
+
 run_cmake(LinkObjRHS1)
 run_cmake(LinkObjRHS2)
 run_cmake(MissingSource)
diff --git a/Tests/RunCMake/ObjectLibrary/requires.c b/Tests/RunCMake/ObjectLibrary/requires.c
new file mode 100644
index 0000000..d524952
--- /dev/null
+++ b/Tests/RunCMake/ObjectLibrary/requires.c
@@ -0,0 +1,8 @@
+#ifdef REQUIRED
+int required()
+{
+  return 0;
+}
+#else
+#error "REQUIRED not defined"
+#endif
diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt
index cd6f1e0..1bcc114 100644
--- a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt
+++ b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt
@@ -1,5 +1,4 @@
-^CMake Error at OBJECTwithNoSourcesButLinkObjects.cmake:[0-9]+ \(target_link_libraries\):
-  Object library target \"TestObjectLibWithoutSources\" may not link to
-  anything.
+^CMake Error at OBJECTwithNoSourcesButLinkObjects.cmake:[0-9]+ \(add_library\):
+  No SOURCES given to target: TestObjectLibWithoutSources
 Call Stack \(most recent call first\):
   CMakeLists.txt:[0-9]+ \(include\)$

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e22c45d4c97c713734b8349132fa881f602f7ae3
commit e22c45d4c97c713734b8349132fa881f602f7ae3
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Feb 28 13:42:09 2018 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Mar 1 07:56:38 2018 -0500

    Tests: Teach RunCMake to ignore AIX ld warnings about GNU atexit

diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index e688830..36a122f 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -112,6 +112,8 @@ function(run_cmake test)
     "|clang[^:]*: warning: the object size sanitizer has no effect at -O0, but is explicitly enabled:"
     "|Error kstat returned"
     "|Hit xcodebuild bug"
+    "|ld: 0711-224 WARNING: Duplicate symbol: .__init_aix_libgcc_cxa_atexit"
+    "|ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information"
     "|[^\n]*is a member of multiple groups"
     "|[^\n]*from Time Machine by path"
     "|[^\n]*Bullseye Testing Technology"

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0a21d820d3533309daff2f7fbf3389cd900cf9b8
commit 0a21d820d3533309daff2f7fbf3389cd900cf9b8
Author:     Shane Parris <shane.lee.parris at gmail.com>
AuthorDate: Wed Feb 14 10:50:14 2018 -0500
Commit:     Shane Parris <shane.lee.parris at gmail.com>
CommitDate: Wed Feb 28 09:51:42 2018 -0500

    Remove c_str() from calls to converttorelativeformake in XCode Generator

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 0d5dad2..7fdf896 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -466,7 +466,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
   if (regenerate && (isTopLevel || !generateTopLevelProjectOnly)) {
     this->CreateReRunCMakeFile(root, gens);
     std::string file =
-      this->ConvertToRelativeForMake(this->CurrentReRunCMakeMakefile.c_str());
+      this->ConvertToRelativeForMake(this->CurrentReRunCMakeMakefile);
     cmSystemTools::ReplaceString(file, "\\ ", " ");
     cmTarget* check = mf->AddUtilityCommand(
       CMAKE_CHECK_BUILD_SYSTEM_TARGET, cmMakefile::TargetOrigin::Generator,
@@ -553,7 +553,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
 
   for (const auto& lfile : lfiles) {
     makefileStream << "TARGETS += $(subst $(space),$(spaceplus),$(wildcard "
-                   << this->ConvertToRelativeForMake(lfile.c_str()) << "))\n";
+                   << this->ConvertToRelativeForMake(lfile) << "))\n";
   }
 
   std::string checkCache = root->GetBinaryDirectory();
@@ -562,11 +562,11 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
   checkCache += "cmake.check_cache";
 
   makefileStream << "\n"
-                 << this->ConvertToRelativeForMake(checkCache.c_str())
+                 << this->ConvertToRelativeForMake(checkCache)
                  << ": $(TARGETS)\n";
   makefileStream << "\t"
                  << this->ConvertToRelativeForMake(
-                      cmSystemTools::GetCMakeCommand().c_str())
+                      cmSystemTools::GetCMakeCommand())
                  << " -H"
                  << this->ConvertToRelativeForMake(root->GetSourceDirectory())
                  << " -B"
@@ -1571,12 +1571,11 @@ void cmGlobalXCodeGenerator::AddCommandsToBuildPhase(
   }
 
   std::string cdir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory();
-  cdir = this->ConvertToRelativeForMake(cdir.c_str());
+  cdir = this->ConvertToRelativeForMake(cdir);
   std::string makecmd = "make -C ";
   makecmd += cdir;
   makecmd += " -f ";
-  makecmd +=
-    this->ConvertToRelativeForMake((makefile + "$CONFIGURATION").c_str());
+  makecmd += this->ConvertToRelativeForMake((makefile + "$CONFIGURATION"));
   makecmd += " all";
   buildphase->AddAttribute("shellScript", this->CreateString(makecmd));
   buildphase->AddAttribute("showEnvVarsInLog", this->CreateString("0"));
@@ -1611,8 +1610,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
       const std::vector<std::string>& outputs = ccg.GetOutputs();
       if (!outputs.empty()) {
         for (auto const& output : outputs) {
-          makefileStream << "\\\n\t"
-                         << this->ConvertToRelativeForMake(output.c_str());
+          makefileStream << "\\\n\t" << this->ConvertToRelativeForMake(output);
         }
       } else {
         std::ostringstream str;
@@ -1633,8 +1631,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
         // There is at least one output, start the rule for it
         const char* sep = "";
         for (auto const& output : outputs) {
-          makefileStream << sep
-                         << this->ConvertToRelativeForMake(output.c_str());
+          makefileStream << sep << this->ConvertToRelativeForMake(output);
           sep = " ";
         }
         makefileStream << ": ";
@@ -1646,8 +1643,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
         std::string dep;
         if (this->CurrentLocalGenerator->GetRealDependency(d, configName,
                                                            dep)) {
-          makefileStream << "\\\n"
-                         << this->ConvertToRelativeForMake(dep.c_str());
+          makefileStream << "\\\n" << this->ConvertToRelativeForMake(dep);
         }
       }
       makefileStream << "\n";
@@ -1664,12 +1660,12 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
         // Build the command line in a single string.
         std::string cmd2 = ccg.GetCommand(c);
         cmSystemTools::ReplaceString(cmd2, "/./", "/");
-        cmd2 = this->ConvertToRelativeForMake(cmd2.c_str());
+        cmd2 = this->ConvertToRelativeForMake(cmd2);
         std::string cmd;
         std::string wd = ccg.GetWorkingDirectory();
         if (!wd.empty()) {
           cmd += "cd ";
-          cmd += this->ConvertToRelativeForMake(wd.c_str());
+          cmd += this->ConvertToRelativeForMake(wd);
           cmd += " && ";
         }
         cmd += cmd2;
@@ -3190,7 +3186,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
           gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
           gt->GetType() == cmStateEnums::MODULE_LIBRARY) {
         std::string tfull = gt->GetFullPath(configName);
-        std::string trel = this->ConvertToRelativeForMake(tfull.c_str());
+        std::string trel = this->ConvertToRelativeForMake(tfull);
 
         // Add this target to the post-build phases of its dependencies.
         std::map<std::string, cmXCodeObject::StringVec>::const_iterator y =
@@ -3218,7 +3214,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
           target->GetDependLibraries().find(configName);
         if (x != target->GetDependLibraries().end()) {
           for (auto const& deplib : x->second) {
-            std::string file = this->ConvertToRelativeForMake(deplib.c_str());
+            std::string file = this->ConvertToRelativeForMake(deplib);
             makefileStream << "\\\n\t" << file;
             dummyRules.insert(file);
           }
@@ -3233,7 +3229,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
           d += objLibName;
           d += ".a";
 
-          std::string dependency = this->ConvertToRelativeForMake(d.c_str());
+          std::string dependency = this->ConvertToRelativeForMake(d);
           makefileStream << "\\\n\t" << dependency;
           dummyRules.insert(dependency);
         }
@@ -3241,8 +3237,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
         // Write the action to remove the target if it is out of date.
         makefileStream << "\n";
         makefileStream << "\t/bin/rm -f "
-                       << this->ConvertToRelativeForMake(tfull.c_str())
-                       << "\n";
+                       << this->ConvertToRelativeForMake(tfull) << "\n";
         // if building for more than one architecture
         // then remove those executables as well
         if (this->Architectures.size() > 1) {
@@ -3254,8 +3249,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
             universalFile += "/";
             universalFile += gt->GetFullName(configName);
             makefileStream << "\t/bin/rm -f "
-                           << this->ConvertToRelativeForMake(
-                                universalFile.c_str())
+                           << this->ConvertToRelativeForMake(universalFile)
                            << "\n";
           }
         }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f93cc4158e0df5f7cc39c97e275bdc58c54698bd
commit f93cc4158e0df5f7cc39c97e275bdc58c54698bd
Author:     Shane Parris <shane.lee.parris at gmail.com>
AuthorDate: Tue Feb 13 12:33:49 2018 -0500
Commit:     Shane Parris <shane.lee.parris at gmail.com>
CommitDate: Wed Feb 28 09:34:47 2018 -0500

    Refactor cmCacheManager::LoadCache to use ostringstream

diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index fab2445..85ac985 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -160,14 +160,14 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal,
     currentcwd += "/CMakeCache.txt";
     oldcwd += "/CMakeCache.txt";
     if (!cmSystemTools::SameFile(oldcwd, currentcwd)) {
-      std::string message =
-        std::string("The current CMakeCache.txt directory ") + currentcwd +
-        std::string(" is different than the directory ") +
-        std::string(this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR")) +
-        std::string(" where CMakeCache.txt was created. This may result "
-                    "in binaries being created in the wrong place. If you "
-                    "are not sure, reedit the CMakeCache.txt");
-      cmSystemTools::Error(message.c_str());
+      std::ostringstream message;
+      message << "The current CMakeCache.txt directory " << currentcwd
+              << " is different than the directory "
+              << this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR")
+              << " where CMakeCache.txt was created. This may result "
+                 "in binaries being created in the wrong place. If you "
+                 "are not sure, reedit the CMakeCache.txt";
+      cmSystemTools::Error(message.str().c_str());
     }
   }
   return true;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=915b71010c1c48ccd8e84df825579dd5595afc9a
commit 915b71010c1c48ccd8e84df825579dd5595afc9a
Author:     Shane Parris <shane.lee.parris at gmail.com>
AuthorDate: Tue Feb 13 12:40:55 2018 -0500
Commit:     Shane Parris <shane.lee.parris at gmail.com>
CommitDate: Wed Feb 28 09:34:47 2018 -0500

    Enhance RunCMake test coverage for file(GLOB)

diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt
new file mode 100644
index 0000000..af3cb2e
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at GLOB-error-FOLLOW_SYMLINKS\.cmake:[0-9]+ \(file\):
+  file FOLLOW_SYMLINKS is not a valid parameter for GLOB\.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake
new file mode 100644
index 0000000..6d467a0
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake
@@ -0,0 +1 @@
+file(GLOB CONTENT_LIST FOLLOW_SYMLINKS)
diff --git a/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-result.txt b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-stderr.txt b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-stderr.txt
new file mode 100644
index 0000000..30cec89
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at GLOB-error-RELATIVE-no-arg\.cmake:[0-9]+ \(file\):
+  file GLOB requires a directory after the RELATIVE tag\.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake
new file mode 100644
index 0000000..a555881
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake
@@ -0,0 +1 @@
+file(GLOB CONTENT_LIST RELATIVE)
diff --git a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt
new file mode 100644
index 0000000..ee6cb0b
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at GLOB-noexp-LIST_DIRECTORIES\.cmake:[0-9]+ \(file\):
+  file GLOB requires a glob expression after the bool\.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file/GLOB-noexp-RELATIVE-result.txt b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt
new file mode 100644
index 0000000..9c66631
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at GLOB-noexp-RELATIVE\.cmake:[0-9]+ \(file\):
+  file GLOB requires a glob expression after the directory\.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake b/Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake
new file mode 100644
index 0000000..7b2d404
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake
@@ -0,0 +1 @@
+file(GLOB CONTENT_LIST RELATIVE "${CMAKE_CURRENT_BINARY_DIR}")
diff --git a/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-result.txt b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt
new file mode 100644
index 0000000..d0b2bff
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at GLOB_RECURSE-noexp-FOLLOW_SYMLINKS\.cmake:[0-9]+ \(file\):
+  file GLOB_RECURSE requires a glob expression after FOLLOW_SYMLINKS\.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake
new file mode 100644
index 0000000..5e5ce92
--- /dev/null
+++ b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake
@@ -0,0 +1 @@
+file(GLOB_RECURSE CONTENT_LIST FOLLOW_SYMLINKS)
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake
index 9a72333..27305d0 100644
--- a/Tests/RunCMake/file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file/RunCMakeTest.cmake
@@ -35,11 +35,15 @@ run_cmake(LOCK-lowercase)
 run_cmake(READ_ELF)
 run_cmake(GLOB)
 run_cmake(GLOB_RECURSE)
-# test is valid both for GLOB and GLOB_RECURSE
+run_cmake(GLOB_RECURSE-noexp-FOLLOW_SYMLINKS)
+
+# tests are valid both for GLOB and GLOB_RECURSE
+run_cmake(GLOB-error-FOLLOW_SYMLINKS)
 run_cmake(GLOB-error-LIST_DIRECTORIES-not-boolean)
-# test is valid both for GLOB and GLOB_RECURSE
 run_cmake(GLOB-error-LIST_DIRECTORIES-no-arg)
+run_cmake(GLOB-error-RELATIVE-no-arg)
 run_cmake(GLOB-noexp-LIST_DIRECTORIES)
+run_cmake(GLOB-noexp-RELATIVE)
 
 if(NOT WIN32 OR CYGWIN)
   run_cmake(GLOB_RECURSE-cyclic-recursion)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fcaa134c6c36e2de8d454a3d5132dee19f9f7b95
commit fcaa134c6c36e2de8d454a3d5132dee19f9f7b95
Author:     Shane Parris <shane.lee.parris at gmail.com>
AuthorDate: Tue Feb 13 12:33:11 2018 -0500
Commit:     Shane Parris <shane.lee.parris at gmail.com>
CommitDate: Wed Feb 28 09:34:47 2018 -0500

    Refactor HandleGlobCommand

diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 8492c17..b5215a5 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -757,9 +757,10 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
     }
   }
 
-  std::string output;
+  std::ostringstream outputStream;
   bool first = true;
-  for (; i != args.end(); ++i) {
+  bool warnFollowedSymlinks = false;
+  while (i != args.end()) {
     if (*i == "LIST_DIRECTORIES") {
       ++i;
       if (i != args.end()) {
@@ -777,103 +778,109 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
         this->SetError("LIST_DIRECTORIES missing bool value.");
         return false;
       }
-      continue;
-    }
-
-    if (recurse && (*i == "FOLLOW_SYMLINKS")) {
+      ++i;
+      if (i == args.end()) {
+        this->SetError("GLOB requires a glob expression after the bool.");
+        return false;
+      }
+    } else if (*i == "FOLLOW_SYMLINKS") {
+      if (!recurse) {
+        this->SetError("FOLLOW_SYMLINKS is not a valid parameter for GLOB.");
+        return false;
+      }
       explicitFollowSymlinks = true;
       g.RecurseThroughSymlinksOn();
       ++i;
       if (i == args.end()) {
         this->SetError(
-          "GLOB_RECURSE requires a glob expression after FOLLOW_SYMLINKS");
+          "GLOB_RECURSE requires a glob expression after FOLLOW_SYMLINKS.");
         return false;
       }
-    }
-
-    if (*i == "RELATIVE") {
+    } else if (*i == "RELATIVE") {
       ++i; // skip RELATIVE
       if (i == args.end()) {
-        this->SetError("GLOB requires a directory after the RELATIVE tag");
+        this->SetError("GLOB requires a directory after the RELATIVE tag.");
         return false;
       }
       g.SetRelative(i->c_str());
       ++i;
       if (i == args.end()) {
-        this->SetError("GLOB requires a glob expression after the directory");
+        this->SetError("GLOB requires a glob expression after the directory.");
         return false;
       }
-    }
-
-    cmsys::Glob::GlobMessages globMessages;
-    if (!cmsys::SystemTools::FileIsFullPath(*i)) {
-      std::string expr = this->Makefile->GetCurrentSourceDirectory();
-      // Handle script mode
-      if (!expr.empty()) {
-        expr += "/" + *i;
-        g.FindFiles(expr, &globMessages);
-      } else {
-        g.FindFiles(*i, &globMessages);
-      }
     } else {
-      g.FindFiles(*i, &globMessages);
-    }
-
-    if (!globMessages.empty()) {
-      bool shouldExit = false;
-      for (cmsys::Glob::Message const& globMessage : globMessages) {
-        if (globMessage.type == cmsys::Glob::cyclicRecursion) {
-          this->Makefile->IssueMessage(
-            cmake::AUTHOR_WARNING,
-            "Cyclic recursion detected while globbing for '" + *i + "':\n" +
-              globMessage.content);
+      std::string expr = *i;
+      if (!cmsys::SystemTools::FileIsFullPath(*i)) {
+        expr = this->Makefile->GetCurrentSourceDirectory();
+        // Handle script mode
+        if (!expr.empty()) {
+          expr += "/" + *i;
         } else {
-          this->Makefile->IssueMessage(
-            cmake::FATAL_ERROR, "Error has occurred while globbing for '" +
-              *i + "' - " + globMessage.content);
-          shouldExit = true;
+          expr = *i;
         }
       }
-      if (shouldExit) {
-        return false;
+
+      cmsys::Glob::GlobMessages globMessages;
+      g.FindFiles(expr, &globMessages);
+
+      if (!globMessages.empty()) {
+        bool shouldExit = false;
+        for (cmsys::Glob::Message const& globMessage : globMessages) {
+          if (globMessage.type == cmsys::Glob::cyclicRecursion) {
+            this->Makefile->IssueMessage(
+              cmake::AUTHOR_WARNING,
+              "Cyclic recursion detected while globbing for '" + *i + "':\n" +
+                globMessage.content);
+          } else {
+            this->Makefile->IssueMessage(
+              cmake::FATAL_ERROR, "Error has occurred while globbing for '" +
+                *i + "' - " + globMessage.content);
+            shouldExit = true;
+          }
+        }
+        if (shouldExit) {
+          return false;
+        }
       }
-    }
 
-    std::vector<std::string>::size_type cc;
-    std::vector<std::string>& files = g.GetFiles();
-    std::sort(files.begin(), files.end());
-    for (cc = 0; cc < files.size(); cc++) {
-      if (!first) {
-        output += ";";
+      if (recurse && !explicitFollowSymlinks &&
+          g.GetFollowedSymlinkCount() != 0) {
+        warnFollowedSymlinks = true;
       }
-      output += files[cc];
-      first = false;
-    }
-  }
 
-  if (recurse && !explicitFollowSymlinks) {
-    switch (status) {
-      case cmPolicies::REQUIRED_IF_USED:
-      case cmPolicies::REQUIRED_ALWAYS:
-      case cmPolicies::NEW:
-        // Correct behavior, yay!
-        break;
-      case cmPolicies::OLD:
-      // Probably not really the expected behavior, but the author explicitly
-      // asked for the old behavior... no warning.
-      case cmPolicies::WARN:
-        // Possibly unexpected old behavior *and* we actually traversed
-        // symlinks without being explicitly asked to: warn the author.
-        if (g.GetFollowedSymlinkCount() != 0) {
-          this->Makefile->IssueMessage(
-            cmake::AUTHOR_WARNING,
-            cmPolicies::GetPolicyWarning(cmPolicies::CMP0009));
+      std::vector<std::string>& files = g.GetFiles();
+      std::sort(files.begin(), files.end());
+      for (std::string const& file : files) {
+        if (!first) {
+          outputStream << ";";
         }
-        break;
+        outputStream << file;
+        first = false;
+      }
+      ++i;
     }
   }
 
-  this->Makefile->AddDefinition(variable, output.c_str());
+  switch (status) {
+    case cmPolicies::REQUIRED_IF_USED:
+    case cmPolicies::REQUIRED_ALWAYS:
+    case cmPolicies::NEW:
+      // Correct behavior, yay!
+      break;
+    case cmPolicies::OLD:
+    // Probably not really the expected behavior, but the author explicitly
+    // asked for the old behavior... no warning.
+    case cmPolicies::WARN:
+      // Possibly unexpected old behavior *and* we actually traversed
+      // symlinks without being explicitly asked to: warn the author.
+      if (warnFollowedSymlinks) {
+        this->Makefile->IssueMessage(
+          cmake::AUTHOR_WARNING,
+          cmPolicies::GetPolicyWarning(cmPolicies::CMP0009));
+      }
+      break;
+  }
+  this->Makefile->AddDefinition(variable, outputStream.str().c_str());
   return true;
 }
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cf5d0b49e8505ca9e17c5c5a44bbdce933f3cb63
commit cf5d0b49e8505ca9e17c5c5a44bbdce933f3cb63
Author:     Shane Parris <shane.lee.parris at gmail.com>
AuthorDate: Wed Jan 31 09:45:55 2018 -0500
Commit:     Shane Parris <shane.lee.parris at gmail.com>
CommitDate: Wed Feb 28 09:34:47 2018 -0500

    Adjust class description in cmFileTimeComparison.h

diff --git a/Source/cmFileTimeComparison.h b/Source/cmFileTimeComparison.h
index b1f8ed6..114989b 100644
--- a/Source/cmFileTimeComparison.h
+++ b/Source/cmFileTimeComparison.h
@@ -8,9 +8,9 @@
 class cmFileTimeComparisonInternal;
 
 /** \class cmFileTimeComparison
- * \brief Helper class for performing globbing searches.
+ * \brief Helper class for comparing file modification times.
  *
- * Finds all files that match a given globbing expression.
+ * Compare file modification times or test if file modification times differ.
  */
 class cmFileTimeComparison
 {

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1ac042aa67c0e0ab531cd38977cb2f65fd96ed4b
commit 1ac042aa67c0e0ab531cd38977cb2f65fd96ed4b
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Feb 28 08:43:28 2018 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Feb 28 08:52:19 2018 -0500

    Do not generate rules for .def generation where not supported
    
    Our `cmake -E __create_def` helper used for `WINDOWS_EXPORT_ALL_SYMBOLS`
    and merging of multiple `.def` files is available only with CMake hosted
    on Windows.  However, we may generate use of it on other platforms since
    commit v3.9.0-rc1~405^2 (Support WINDOWS_EXPORT_ALL_SYMBOLS with `.def`
    files, 2017-03-13) when multiple `.def` files are listed.  This results
    in a build error because the tool doesn't exist.
    
    Fix our logic to avoid using the tool on non-Windows platforms.  Instead
    silently ignore all but the first `.def` source as we did before.
    
    Issue: #17773

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index e9b6daf..abbc3d0 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1999,8 +1999,13 @@ void cmGeneratorTarget::ComputeModuleDefinitionInfo(
   info.WindowsExportAllSymbols =
     this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") &&
     this->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS");
+#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
   info.DefFileGenerated =
     info.WindowsExportAllSymbols || info.Sources.size() > 1;
+#else
+  // Our __create_def helper is only available on Windows.
+  info.DefFileGenerated = false;
+#endif
   if (info.DefFileGenerated) {
     info.DefFile = this->ObjectDirectory /* has slash */ + "exports.def";
   } else if (!info.Sources.empty()) {

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

Summary of changes:
 Help/command/add_library.rst                       |    8 +-
 Help/command/export.rst                            |    4 +-
 Help/command/install.rst                           |    2 +
 Help/command/target_link_libraries.rst             |   64 +++++++++
 Help/manual/cmake-buildsystem.7.rst                |   41 +++---
 Help/release/dev/object-library-linking.rst        |    6 +
 Source/cmCacheManager.cxx                          |   16 +--
 Source/cmComputeLinkInformation.cxx                |    3 +
 Source/cmComputeTargetDepends.cxx                  |    6 +-
 Source/cmExportBuildFileGenerator.cxx              |    4 +-
 Source/cmFileCommand.cxx                           |  149 ++++++++++----------
 Source/cmFileTimeComparison.h                      |    4 +-
 Source/cmGeneratorTarget.cxx                       |   73 ++++++----
 Source/cmGlobalXCodeGenerator.cxx                  |   38 +++--
 Source/cmTarget.cxx                                |   18 ++-
 Source/cmTargetLinkLibrariesCommand.cxx            |   15 +-
 Tests/ExportImport/Export/CMakeLists.txt           |   17 ++-
 Tests/ExportImport/Export/testLib9.c               |   15 ++
 Tests/ExportImport/Export/testLib9Obj.c            |    4 -
 Tests/ExportImport/Export/testLib9ObjIface.c       |   11 ++
 Tests/ExportImport/Export/testLib9ObjPriv.c        |    4 +
 Tests/ExportImport/Export/testLib9ObjPub.c         |    4 +
 Tests/ExportImport/Import/A/CMakeLists.txt         |   39 +++--
 Tests/ExportImport/Import/A/imp_testLib9.c         |   16 +++
 .../ObjectLibrary/BadObjSource2-result.txt         |    1 -
 .../ObjectLibrary/BadObjSource2-stderr.txt         |    9 --
 Tests/RunCMake/ObjectLibrary/CMakeLists.txt        |    2 +-
 .../InstallLinkedObj1-result.txt}                  |    0
 .../ObjectLibrary/InstallLinkedObj1-stderr.txt     |    1 +
 .../RunCMake/ObjectLibrary/InstallLinkedObj1.cmake |    6 +
 .../RunCMake/ObjectLibrary/InstallLinkedObj2.cmake |    6 +
 Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt |    1 -
 Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt |    4 -
 Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake      |    2 -
 .../RunCMake/ObjectLibrary/LinkObjLHSShared.cmake  |    7 +
 .../RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake  |    7 +
 .../RunCMake/ObjectLibrary/LinkObjRHS1-result.txt  |    1 -
 .../RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt  |    6 -
 Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake     |    3 -
 .../RunCMake/ObjectLibrary/LinkObjRHS2-result.txt  |    1 -
 .../RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt  |    6 -
 Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake     |    3 -
 .../LinkObjRHSObject-build-result.txt              |    1 +
 .../LinkObjRHSObject-build-stdout.txt              |    1 +
 .../RunCMake/ObjectLibrary/LinkObjRHSObject.cmake  |   12 ++
 .../LinkObjRHSObject2-build-result.txt             |    1 +
 .../RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake |   12 ++
 .../RunCMake/ObjectLibrary/LinkObjRHSShared.cmake  |   13 ++
 .../RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake |   14 ++
 .../RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake  |   10 ++
 .../RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake |   11 ++
 Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt |    1 -
 Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt |    4 -
 Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake    |   36 ++++-
 Tests/RunCMake/ObjectLibrary/a.c                   |    8 +-
 Tests/RunCMake/ObjectLibrary/b.c                   |   14 +-
 Tests/RunCMake/ObjectLibrary/exe.c                 |   14 ++
 Tests/RunCMake/ObjectLibrary/requires.c            |    8 ++
 Tests/RunCMake/RunCMake.cmake                      |    2 +
 .../OBJECTwithNoSourcesButLinkObjects-stderr.txt   |    5 +-
 .../OBJECTwithOnlyObjectSources-result.txt         |    1 -
 .../OBJECTwithOnlyObjectSources-stderr.txt         |   16 ---
 .../GLOB-error-FOLLOW_SYMLINKS-result.txt}         |    0
 .../file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt     |    4 +
 .../RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake |    1 +
 .../GLOB-error-RELATIVE-no-arg-result.txt}         |    0
 .../file/GLOB-error-RELATIVE-no-arg-stderr.txt     |    4 +
 .../RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake |    1 +
 .../GLOB-noexp-LIST_DIRECTORIES-result.txt}        |    0
 .../file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt    |    4 +
 .../GLOB-noexp-RELATIVE-result.txt}                |    0
 Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt |    4 +
 Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake      |    1 +
 .../GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-result.txt} |    0
 .../GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt  |    4 +
 .../file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake  |    1 +
 Tests/RunCMake/file/RunCMakeTest.cmake             |    8 +-
 77 files changed, 576 insertions(+), 267 deletions(-)
 create mode 100644 Help/release/dev/object-library-linking.rst
 create mode 100644 Tests/ExportImport/Export/testLib9.c
 delete mode 100644 Tests/ExportImport/Export/testLib9Obj.c
 create mode 100644 Tests/ExportImport/Export/testLib9ObjIface.c
 create mode 100644 Tests/ExportImport/Export/testLib9ObjPriv.c
 create mode 100644 Tests/ExportImport/Export/testLib9ObjPub.c
 create mode 100644 Tests/ExportImport/Import/A/imp_testLib9.c
 delete mode 100644 Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt
 delete mode 100644 Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt
 copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => ObjectLibrary/InstallLinkedObj1-result.txt} (100%)
 create mode 100644 Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt
 create mode 100644 Tests/RunCMake/ObjectLibrary/InstallLinkedObj1.cmake
 create mode 100644 Tests/RunCMake/ObjectLibrary/InstallLinkedObj2.cmake
 delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt
 delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt
 delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake
 create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake
 create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake
 delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt
 delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt
 delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake
 delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt
 delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt
 delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake
 create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-result.txt
 create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-stdout.txt
 create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake
 create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2-build-result.txt
 create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake
 create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake
 create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake
 create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake
 create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake
 delete mode 100644 Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt
 delete mode 100644 Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt
 create mode 100644 Tests/RunCMake/ObjectLibrary/exe.c
 create mode 100644 Tests/RunCMake/ObjectLibrary/requires.c
 delete mode 100644 Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt
 delete mode 100644 Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt
 copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => file/GLOB-error-FOLLOW_SYMLINKS-result.txt} (100%)
 create mode 100644 Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt
 create mode 100644 Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake
 copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => file/GLOB-error-RELATIVE-no-arg-result.txt} (100%)
 create mode 100644 Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-stderr.txt
 create mode 100644 Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake
 copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => file/GLOB-noexp-LIST_DIRECTORIES-result.txt} (100%)
 create mode 100644 Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt
 copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => file/GLOB-noexp-RELATIVE-result.txt} (100%)
 create mode 100644 Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt
 create mode 100644 Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake
 copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-result.txt} (100%)
 create mode 100644 Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt
 create mode 100644 Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list