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 260ea8dd0faa80645eb78a421736e54a9796afdf (commit) via 841b8c6408a1d5bb996ce44f17e7743d8f311934 (commit) from 9f530fcc391a42fb80fa338fc35d82098b79dcb1 (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=260ea8dd0faa80645eb78a421736e54a9796afdf commit 260ea8dd0faa80645eb78a421736e54a9796afdf Merge: 9f530fc 841b8c6 Author: Rolf Eike Beer <e...@sf-mail.de> AuthorDate: Fri May 13 11:00:12 2016 -0400 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Fri May 13 11:00:12 2016 -0400 Merge topic 'findpkgconfig-target' into next 841b8c64 FindPkgConfig-target: add release notes and tests https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=841b8c6408a1d5bb996ce44f17e7743d8f311934 commit 841b8c6408a1d5bb996ce44f17e7743d8f311934 Author: Rolf Eike Beer <e...@sf-mail.de> AuthorDate: Fri May 13 13:27:01 2016 +0200 Commit: Rolf Eike Beer <e...@sf-mail.de> CommitDate: Fri May 13 16:59:50 2016 +0200 FindPkgConfig-target: add release notes and tests diff --git a/Help/release/dev/FindPkgConfig-targets.rst b/Help/release/dev/FindPkgConfig-targets.rst new file mode 100644 index 0000000..b18cb7b --- /dev/null +++ b/Help/release/dev/FindPkgConfig-targets.rst @@ -0,0 +1,5 @@ +FindPkgConfig-targets +--------------------- + +* The :module:`FindPkgConfig` module learned to optionally create imported + targets for the libraries it has found. diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 1c8331a..542d127 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -225,17 +225,18 @@ function(_pkg_create_imp_target _prefix _no_cmake_path _no_cmake_environment_pat if (NOT TARGET PkgConfig::${_prefix} AND ( ${_prefix}_INCLUDE_DIRS OR _libs OR ${_prefix}_CFLAGS_OTHER )) add_library(PkgConfig::${_prefix} INTERFACE IMPORTED) + + unset(_props) if(${_prefix}_INCLUDE_DIRS) - set_target_properties(PkgConfig::${_prefix} PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${${_prefix}_INCLUDE_DIRS}") + list(APPEND _props INTERFACE_INCLUDE_DIRECTORIES "${${_prefix}_INCLUDE_DIRS}") endif() if(_libs) - set_target_properties(PkgConfig::${_prefix} PROPERTIES - INTERFACE_LINK_LIBRARIES "${_libs}") + list(APPEND _props INTERFACE_LINK_LIBRARIES "${_libs}") endif() if(${_prefix}_CFLAGS_OTHER) - set_property(TARGET PkgConfig::${_prefix} PROPERTY INTERFACE_COMPILE_OPTIONS "${${_prefix}_CFLAGS_OTHER}") + list(APPEND _props INTERFACE_COMPILE_OPTIONS "${${_prefix}_CFLAGS_OTHER}") endif() + set_target_properties(PkgConfig::${_prefix} PROPERTIES ${_props}) endif() endfunction() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake new file mode 100644 index 0000000..134648f --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.5) + +project(FindPkgConfig_IMPORTED_TARGET C) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(NCURSES IMPORTED_TARGET QUIET REQUIRED ncurses) + +if (NCURSES_FOUND) + set(tgt PkgConfig::NCURSES) + if (NOT TARGET ${tgt}) + message(FATAL_ERROR "FindPkgConfig found ncurses, but did not create an imported target for it") + endif () + set(prop_found FALSE) + foreach (prop IN ITEMS INTERFACE_INCLUDE_DIRECTORIES INTERFACE_LINK_LIBRARIES INTERFACE_COMPILE_OPTIONS) + get_target_property(value ${tgt} ${prop}) + if (value) + message(STATUS "Found property ${prop} on target: ${value}") + set(prop_found TRUE) + endif () + endforeach () + if (NOT prop_found) + message(FATAL_ERROR "target ${tgt} found, but it has no properties") + endif () +else () + message(STATUS "skipping test; ncurses not found") +endif () diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake index 24089e0..e12b52f 100644 --- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -15,4 +15,5 @@ find_package(PkgConfig) if (PKG_CONFIG_FOUND) run_cmake(FindPkgConfig_GET_VARIABLE) run_cmake(FindPkgConfig_cache_variables) + run_cmake(FindPkgConfig_IMPORTED_TARGET) endif () ----------------------------------------------------------------------- Summary of changes: Help/release/dev/FindPkgConfig-targets.rst | 5 ++++ Modules/FindPkgConfig.cmake | 11 +++++---- .../FindPkgConfig_IMPORTED_TARGET.cmake | 26 ++++++++++++++++++++ Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake | 1 + 4 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 Help/release/dev/FindPkgConfig-targets.rst create mode 100644 Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits