From 182550a831aaf387219ab06a4062030a121031af Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Fri, 7 Aug 2020 10:53:16 -0400 Subject: [PATCH] [cmake] Make sure imported targets are always global, some copyright header adjustments --- deps/external_dependency.cmake | 49 +++++++++++++++++---------- share/cmake/app4triqs-config.cmake.in | 8 ++++- share/cmake/extract_flags.cmake | 30 +++++++--------- 3 files changed, 50 insertions(+), 37 deletions(-) diff --git a/deps/external_dependency.cmake b/deps/external_dependency.cmake index 7ba1b7ad..19dd26dc 100644 --- a/deps/external_dependency.cmake +++ b/deps/external_dependency.cmake @@ -1,25 +1,38 @@ -################################################################################### +# Copyright (c) 2020 Simons Foundation # -# APP4TRIQS: a Toolbox for Research in Interacting Quantum Systems +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# Copyright (C) 2020 Simons Foundation -# authors: N. Wentzell +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# APP4TRIQS is free software: you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later -# version. -# -# APP4TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# APP4TRIQS. If not, see . -# -################################################################################### +# You may obtain a copy of the License at +# https://www.gnu.org/licenses/gpl-3.0.txt + +# Consider ROOT env variables in find_package +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() + +# Make sure that imported targets are always global +get_property(IMPORTED_ALWAYS_GLOBAL GLOBAL PROPERTY IMPORTED_ALWAYS_GLOBAL) +if(NOT IMPORTED_ALWAYS_GLOBAL) + function(add_library) + set(_args ${ARGN}) + if ("${_args}" MATCHES ";IMPORTED") + list(APPEND _args GLOBAL) + endif() + _add_library(${_args}) + endfunction() + set_property(GLOBAL PROPERTY IMPORTED_ALWAYS_GLOBAL TRUE) +endif() + +# Define External Dependency Function function(external_dependency) cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL;BUILD_ALWAYS" "VERSION;GIT_REPO;GIT_TAG" "" ${ARGN}) diff --git a/share/cmake/app4triqs-config.cmake.in b/share/cmake/app4triqs-config.cmake.in index ef926eff..940e75f6 100644 --- a/share/cmake/app4triqs-config.cmake.in +++ b/share/cmake/app4triqs-config.cmake.in @@ -15,7 +15,13 @@ set(@PROJECT_NAME@_GIT_HASH @PROJECT_GIT_HASH@ CACHE STRING "@PROJECT_NAME@ git set(@PROJECT_NAME@_ROOT @CMAKE_INSTALL_PREFIX@ CACHE STRING "@PROJECT_NAME@ root directory") ## Find the target dependencies -#find_package(... REQUIRED HINTS @CMAKE_INSTALL_PREFIX@) +#function(find_dep) +# get_property(${ARGV0}_FOUND GLOBAL PROPERTY ${ARGV0}_FOUND) +# if(NOT ${ARGV0}_FOUND) +# find_package(${ARGN} REQUIRED HINTS @CMAKE_INSTALL_PREFIX@) +# endif() +#endfunction() +#find_dep(depname 1.0) # Include the exported targets of this project include(@CMAKE_INSTALL_PREFIX@/lib/cmake/@PROJECT_NAME@/@PROJECT_NAME@-targets.cmake) diff --git a/share/cmake/extract_flags.cmake b/share/cmake/extract_flags.cmake index e00ee628..ed5b6c1f 100644 --- a/share/cmake/extract_flags.cmake +++ b/share/cmake/extract_flags.cmake @@ -1,24 +1,18 @@ -################################################################################### +# Copyright (c) 2019-2020 Simons Foundation # -# TRIQS: a Toolbox for Research in Interacting Quantum Systems +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# Copyright (C) 2019-2020 Simons Foundation -# author: N. Wentzell +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# TRIQS is free software: you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or (at your option) any later -# version. -# -# TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# TRIQS. If not, see . -# -################################################################################### +# You may obtain a copy of the License at +# https://www.gnu.org/licenses/gpl-3.0.txt + # Recursively fetch all targets that the interface of a target depends upon macro(get_all_interface_targets name target)