[Cmake-commits] CMake branch, next, updated. v3.2.1-1624-gea7fc01

Brad King brad.king at kitware.com
Wed Apr 8 10:17:21 EDT 2015


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

The branch, next has been updated
       via  ea7fc015a281f813c99ae3ce849afecebd502552 (commit)
       via  834885fc9de95c6f8d4c59c2976b7a446f0f2ae5 (commit)
      from  010f9fa5324367cbb52d78340fc7f1ea3815c7ca (commit)

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

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ea7fc015a281f813c99ae3ce849afecebd502552
commit ea7fc015a281f813c99ae3ce849afecebd502552
Merge: 010f9fa 834885f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Apr 8 10:17:20 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Apr 8 10:17:20 2015 -0400

    Merge topic 'link-implicit-libs-full-path' into next
    
    834885fc fixup! Link libraries by full path even in implicit directories


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=834885fc9de95c6f8d4c59c2976b7a446f0f2ae5
commit 834885fc9de95c6f8d4c59c2976b7a446f0f2ae5
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Apr 8 09:30:27 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Apr 8 10:16:02 2015 -0400

    fixup! Link libraries by full path even in implicit directories
    
    Do not depend on behavior of native tools to produce an error on
    an empty ".a" file.  Instead arrange for a successful build when
    the policy is NEW and a full path is used.

diff --git a/Tests/RunCMake/CMP0060/CMP0060-Common.cmake b/Tests/RunCMake/CMP0060/CMP0060-Common.cmake
index 46cfbbf..e0a56e6 100644
--- a/Tests/RunCMake/CMP0060/CMP0060-Common.cmake
+++ b/Tests/RunCMake/CMP0060/CMP0060-Common.cmake
@@ -1,23 +1,35 @@
-# Use a predictable library file name on all platforms.
-set(CMAKE_STATIC_LIBRARY_PREFIX lib)
-set(CMAKE_STATIC_LIBRARY_SUFFIX .a)
+# Always build in a predictable configuration.  For multi-config
+# generators we depend on RunCMakeTest.cmake to do this for us.
+if(NOT CMAKE_CONFIGURATION_TYPES)
+  set(CMAKE_BUILD_TYPE Debug)
+endif()
 
 # Convince CMake that it can instruct the linker to search for the
 # library of the proper linkage type, but do not really pass flags.
 set(CMAKE_EXE_LINK_STATIC_C_FLAGS " ")
 set(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS " ")
 
-# Convince CMake that our library is in an implicit linker search directory.
-set(dir ${CMAKE_CURRENT_SOURCE_DIR}/lib)
-list(APPEND CMAKE_C_IMPLICIT_LINK_DIRECTORIES ${dir})
-
 # Make a link line asking for the linker to search for the library
 # look like a missing object file so we will get predictable content
-# in the error message.
+# in the error message.  This also ensures that cases expected to use
+# the full path can be verified by confirming that they link.
 set(CMAKE_LINK_LIBRARY_FLAG LINKFLAG_)
 set(CMAKE_LINK_LIBRARY_SUFFIX _LINKSUFFIX${CMAKE_C_OUTPUT_EXTENSION})
 
+# Convince CMake that our library is in an implicit linker search directory.
+list(APPEND CMAKE_C_IMPLICIT_LINK_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/lib)
+
+# Create a simple library file.  Place it in our library directory.
+add_library(CMP0060 STATIC cmp0060.c)
+set_property(TARGET CMP0060 PROPERTY
+  ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}/lib)
+
+# Add a target to link the library file by full path.
 add_executable(main1 main.c)
-target_link_libraries(main1 ${dir}/libCMP0060.a)
+target_link_libraries(main1 $<TARGET_FILE:CMP0060>)
+add_dependencies(main1 CMP0060)
+
+# Add a second target to verify the warning only appears once.
 add_executable(main2 main.c)
-target_link_libraries(main2 ${dir}/libCMP0060.a)
+target_link_libraries(main2 $<TARGET_FILE:CMP0060>)
+add_dependencies(main2 CMP0060)
diff --git a/Tests/RunCMake/CMP0060/CMP0060-NEW-Build-result.txt b/Tests/RunCMake/CMP0060/CMP0060-NEW-Build-result.txt
deleted file mode 100644
index d197c91..0000000
--- a/Tests/RunCMake/CMP0060/CMP0060-NEW-Build-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-[^0]
diff --git a/Tests/RunCMake/CMP0060/CMP0060-NEW-Build-stdout.txt b/Tests/RunCMake/CMP0060/CMP0060-NEW-Build-stdout.txt
deleted file mode 100644
index 258d73f..0000000
--- a/Tests/RunCMake/CMP0060/CMP0060-NEW-Build-stdout.txt
+++ /dev/null
@@ -1 +0,0 @@
-Tests[\/]RunCMake[\/]CMP0060[\/]lib[\/]libCMP0060.a
diff --git a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt
index c8d9d9a..f6cc978 100644
--- a/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt
+++ b/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt
@@ -6,7 +6,7 @@
   Some library files are in directories implicitly searched by the linker
   when invoked for C:
 
-   .*/Tests/RunCMake/CMP0060/lib/libCMP0060.a
+   .*/Tests/RunCMake/CMP0060/CMP0060-WARN-ON-build/lib/(lib)?CMP0060.(a|lib)
 
   For compatibility with older versions of CMake, the generated link line
   will ask the linker to search for these by library name.
diff --git a/Tests/RunCMake/CMP0060/RunCMakeTest.cmake b/Tests/RunCMake/CMP0060/RunCMakeTest.cmake
index afb78fc..445156f 100644
--- a/Tests/RunCMake/CMP0060/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0060/RunCMakeTest.cmake
@@ -14,6 +14,6 @@ function(run_cmake_CMP0060 CASE)
 endfunction()
 
 run_cmake_CMP0060(OLD)
-run_cmake_CMP0060(NEW)
 run_cmake_CMP0060(WARN-OFF)
 run_cmake_CMP0060(WARN-ON)
+run_cmake_CMP0060(NEW)
diff --git a/Tests/RunCMake/CMP0060/cmp0060.c b/Tests/RunCMake/CMP0060/cmp0060.c
new file mode 100644
index 0000000..a2da227
--- /dev/null
+++ b/Tests/RunCMake/CMP0060/cmp0060.c
@@ -0,0 +1,4 @@
+int libCMP0060(void)
+{
+  return 0;
+}
diff --git a/Tests/RunCMake/CMP0060/lib/libCMP0060.a b/Tests/RunCMake/CMP0060/lib/libCMP0060.a
deleted file mode 100644
index e69de29..0000000
diff --git a/Tests/RunCMake/CMP0060/main.c b/Tests/RunCMake/CMP0060/main.c
index e69de29..91848c2 100644
--- a/Tests/RunCMake/CMP0060/main.c
+++ b/Tests/RunCMake/CMP0060/main.c
@@ -0,0 +1,5 @@
+extern int libCMP0060(void);
+int main(void)
+{
+  return libCMP0060();
+}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index de8db56..e53612f 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -65,9 +65,7 @@ add_RunCMake_test(CMP0054)
 add_RunCMake_test(CMP0055)
 add_RunCMake_test(CMP0057)
 add_RunCMake_test(CMP0059)
-if (NOT CMAKE_GENERATOR STREQUAL "Watcom WMake")
-  add_RunCMake_test(CMP0060)
-endif()
+add_RunCMake_test(CMP0060)
 if(CMAKE_GENERATOR STREQUAL "Ninja")
   add_RunCMake_test(Ninja)
 endif()

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

Summary of changes:
 Tests/RunCMake/CMP0060/CMP0060-Common.cmake        |   32 ++++++++++++++------
 .../RunCMake/CMP0060/CMP0060-NEW-Build-result.txt  |    1 -
 .../RunCMake/CMP0060/CMP0060-NEW-Build-stdout.txt  |    1 -
 Tests/RunCMake/CMP0060/CMP0060-WARN-ON-stderr.txt  |    2 +-
 Tests/RunCMake/CMP0060/RunCMakeTest.cmake          |    2 +-
 Tests/RunCMake/CMP0060/cmp0060.c                   |    4 +++
 Tests/RunCMake/CMP0060/main.c                      |    5 +++
 Tests/RunCMake/CMakeLists.txt                      |    4 +--
 8 files changed, 34 insertions(+), 17 deletions(-)
 delete mode 100644 Tests/RunCMake/CMP0060/CMP0060-NEW-Build-result.txt
 delete mode 100644 Tests/RunCMake/CMP0060/CMP0060-NEW-Build-stdout.txt
 create mode 100644 Tests/RunCMake/CMP0060/cmp0060.c
 delete mode 100644 Tests/RunCMake/CMP0060/lib/libCMP0060.a


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list