[Cmake-commits] CMake branch, master, updated. v3.14.0-385-g0bd2e3a

Kitware Robot kwrobot at kitware.com
Sat Mar 16 06:23:04 EDT 2019


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  0bd2e3aa5747f455971e1bf5960a2a623327e5cd (commit)
       via  b759fa9b8e2fa8ac93e4b57a0e09fcdc5e0e50af (commit)
      from  49f606f3bbce969a4fc79e0be5bdcb690c78c959 (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=0bd2e3aa5747f455971e1bf5960a2a623327e5cd
commit 0bd2e3aa5747f455971e1bf5960a2a623327e5cd
Merge: 49f606f b759fa9
Author:     Marc Chevrier <marc.chevrier at gmail.com>
AuthorDate: Sat Mar 16 10:13:46 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Sat Mar 16 06:14:00 2019 -0400

    Merge topic 'pkg-config-linker-flags'
    
    b759fa9b8e FindPkgConfig: Set linker flags on imported targets
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3082


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b759fa9b8e2fa8ac93e4b57a0e09fcdc5e0e50af
commit b759fa9b8e2fa8ac93e4b57a0e09fcdc5e0e50af
Author:     Radek Nadstawny <radoslaw.nadstawny at gmail.com>
AuthorDate: Sun Mar 10 19:40:55 2019 +0100
Commit:     Radek Nadstawny <radoslaw.nadstawny at gmail.com>
CommitDate: Wed Mar 13 23:42:44 2019 +0100

    FindPkgConfig: Set linker flags on imported targets

diff --git a/Help/release/dev/pkg-config-linker-flags.rst b/Help/release/dev/pkg-config-linker-flags.rst
new file mode 100644
index 0000000..85c13be
--- /dev/null
+++ b/Help/release/dev/pkg-config-linker-flags.rst
@@ -0,0 +1,5 @@
+pkg-config-linker-flags
+-----------------------
+
+* The :module:`FindPkgConfig` now populates :prop_tgt:`INTERFACE_LINK_OPTIONS`
+  property of imported targets with other (non-library) linker flags.
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index e192426..cf0ae09 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -242,7 +242,7 @@ endfunction()
 function(_pkg_create_imp_target _prefix _imp_target_global)
   # only create the target if it is linkable, i.e. no executables
   if (NOT TARGET PkgConfig::${_prefix}
-      AND ( ${_prefix}_INCLUDE_DIRS OR ${_prefix}_LINK_LIBRARIES OR ${_prefix}_CFLAGS_OTHER ))
+      AND ( ${_prefix}_INCLUDE_DIRS OR ${_prefix}_LINK_LIBRARIES OR ${_prefix}_LDFLAGS_OTHER OR ${_prefix}_CFLAGS_OTHER ))
     if(${_imp_target_global})
       set(_global_opt "GLOBAL")
     else()
@@ -258,6 +258,10 @@ function(_pkg_create_imp_target _prefix _imp_target_global)
       set_property(TARGET PkgConfig::${_prefix} PROPERTY
                    INTERFACE_LINK_LIBRARIES "${${_prefix}_LINK_LIBRARIES}")
     endif()
+    if(${_prefix}_LDFLAGS_OTHER)
+      set_property(TARGET PkgConfig::${_prefix} PROPERTY
+                   INTERFACE_LINK_OPTIONS "${${_prefix}_LDFLAGS_OTHER}")
+    endif()
     if(${_prefix}_CFLAGS_OTHER)
       set_property(TARGET PkgConfig::${_prefix} PROPERTY
                    INTERFACE_COMPILE_OPTIONS "${${_prefix}_CFLAGS_OTHER}")
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
index 24e7202..e82b05f 100644
--- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake
@@ -109,3 +109,24 @@ pkg_check_modules(FakePackage2 REQUIRED QUIET IMPORTED_TARGET cmakeinternalfakep
 if (NOT FakePackage2_LINK_LIBRARIES STREQUAL "${fakePkgDir}/lib/libcmakeinternalfakepackage2.a")
   message(FATAL_ERROR "FakePackage2_LINK_LIBRARIES has bad content on second run: ${FakePackage2_LINK_LIBRARIES}")
 endif()
+
+set(pname fakelinkoptionspackage)
+file(WRITE ${fakePkgDir}/lib/pkgconfig/${pname}.pc
+"Name: FakeLinkOptionsPackage
+Description: Dummy package for FindPkgConfig IMPORTED_TARGET INTERFACE_LINK_OPTIONS test
+Version: 1.2.3
+Libs: -e dummy_main
+")
+
+set(expected_link_options -e dummy_main)
+pkg_check_modules(FakeLinkOptionsPackage REQUIRED QUIET IMPORTED_TARGET fakelinkoptionspackage)
+if (NOT TARGET PkgConfig::FakeLinkOptionsPackage)
+  message(FATAL_ERROR "No import target for fake link options package")
+endif()
+get_target_property(link_options PkgConfig::FakeLinkOptionsPackage INTERFACE_LINK_OPTIONS)
+if (NOT link_options STREQUAL expected_link_options)
+  message(FATAL_ERROR
+    "Additional link options not present in INTERFACE_LINK_OPTIONS property"
+    "expected: \"${expected_link_options}\", but got \"${link_options}\""
+  )
+endif()

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

Summary of changes:
 Help/release/dev/pkg-config-linker-flags.rst        |  5 +++++
 Modules/FindPkgConfig.cmake                         |  6 +++++-
 .../FindPkgConfig_IMPORTED_TARGET.cmake             | 21 +++++++++++++++++++++
 3 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 Help/release/dev/pkg-config-linker-flags.rst


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list