diff options
Diffstat (limited to 'Modules/CMakeFindPackageMode.cmake')
-rw-r--r-- | Modules/CMakeFindPackageMode.cmake | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake index e5216f4e0..1261137c1 100644 --- a/Modules/CMakeFindPackageMode.cmake +++ b/Modules/CMakeFindPackageMode.cmake @@ -1,25 +1,33 @@ -# This file is executed by cmake when invoked with --find-package. -# It expects that the following variables are set using -D: -# NAME = name of the package -# COMPILER_ID = the CMake compiler ID for which the result is, i.e. GNU/Intel/Clang/MSVC, etc. -# LANGUAGE = language for which the result will be used, i.e. C/CXX/Fortan/ASM -# MODE = EXIST : only check for existence of the given package -# COMPILE : print the flags needed for compiling an object file which uses the given package -# LINK : print the flags needed for linking when using the given package -# QUIET = if TRUE, don't print anything - -#============================================================================= -# Copyright 2006-2011 Alexander Neundorf, <neundorf@kde.org> +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# CMakeFindPackageMode +# -------------------- +# # -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. # -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) +# This file is executed by cmake when invoked with --find-package. It +# expects that the following variables are set using -D: +# +# ``NAME`` +# name of the package +# ``COMPILER_ID`` +# the CMake compiler ID for which the result is, +# i.e. GNU/Intel/Clang/MSVC, etc. +# ``LANGUAGE`` +# language for which the result will be used, +# i.e. C/CXX/Fortan/ASM +# ``MODE`` +# ``EXIST`` +# only check for existence of the given package +# ``COMPILE`` +# print the flags needed for compiling an object file which uses +# the given package +# ``LINK`` +# print the flags needed for linking when using the given package +# ``QUIET`` +# if TRUE, don't print anything if(NOT NAME) message(FATAL_ERROR "Name of the package to be searched not specified. Set the CMake variable NAME, e.g. -DNAME=JPEG .") @@ -84,15 +92,18 @@ if(UNIX) # guess Debian multiarch if it has not been set: if(EXISTS /etc/debian_version) - if(NOT CMAKE_${LANGUAGE}_LANGUAGE_ARCHITECTURE ) + if(NOT CMAKE_${LANGUAGE}_LIBRARY_ARCHITECTURE ) file(GLOB filesInLib RELATIVE /lib /lib/*-linux-gnu* ) foreach(file ${filesInLib}) if("${file}" MATCHES "${CMAKE_LIBRARY_ARCHITECTURE_REGEX}") - set(CMAKE_${LANGUAGE}_LANGUAGE_ARCHITECTURE ${file}) + set(CMAKE_${LANGUAGE}_LIBRARY_ARCHITECTURE ${file}) break() endif() endforeach() endif() + if(NOT CMAKE_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE ${CMAKE_${LANGUAGE}_LIBRARY_ARCHITECTURE}) + endif() endif() endif() |