[cmake] Make sure imported targets are always global, some copyright header adjustments

This commit is contained in:
Nils Wentzell 2020-08-07 10:53:16 -04:00
parent abdc51ca94
commit 182550a831
3 changed files with 50 additions and 37 deletions

View File

@ -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 <http://www.gnu.org/licenses/>.
#
###################################################################################
# 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})

View File

@ -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)

View File

@ -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 <http://www.gnu.org/licenses/>.
#
###################################################################################
# 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)