Commit 56f3d16f authored by PRUVOST Florent's avatar PRUVOST Florent

cmake: update finds of morse, add a light doc

parent 9c74d2c1
......@@ -53,14 +53,14 @@ set(BLA_VENDOR "" CACHE STRING "list of possible BLAS vendor:
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "In FindBLASEXT")
message(STATUS "If you want to force the use of one specific library, "
"please specify the BLAS vendor by setting -DBLA_VENDOR=blas_vendor_name"
"at cmake configure.")
"\n please specify the BLAS vendor by setting -DBLA_VENDOR=blas_vendor_name"
"\n at cmake configure.")
message(STATUS "List of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, "
"DXML, SunPerf, SCSL, SGIMATH, IBMESSL, IBMESSLMT, Intel10_32 (intel mkl v10 32 bit),"
"Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model),"
"Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
"Intel( older versions of mkl 32 and 64 bit),"
"ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
"\n DXML, SunPerf, SCSL, SGIMATH, IBMESSL, IBMESSLMT, Intel10_32 (intel mkl v10 32 bit),"
"\n Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model),"
"\n Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"
"\n Intel( older versions of mkl 32 and 64 bit),"
"\n ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
endif()
if (NOT BLAS_FOUND)
......@@ -87,24 +87,24 @@ if(BLA_VENDOR STREQUAL "All" AND
endif()
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "A BLAS library has been found (${BLAS_LIBRARIES}) but we"
"have also potentially detected some multithreaded BLAS libraries from the MKL."
"We try to find both libraries lists (Sequential/Multithreaded).")
"\n have also potentially detected some multithreaded BLAS libraries from the MKL."
"\n We try to find both libraries lists (Sequential/Multithreaded).")
endif()
set(BLAS_FOUND "")
elseif(BLA_VENDOR STREQUAL "All" AND BLAS_acml_LIBRARY)
set(BLA_VENDOR "ACML")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "A BLAS library has been found (${BLAS_LIBRARIES}) but we"
"have also potentially detected some multithreaded BLAS libraries from the ACML."
"We try to find both libraries lists (Sequential/Multithreaded).")
"\n have also potentially detected some multithreaded BLAS libraries from the ACML."
"\n We try to find both libraries lists (Sequential/Multithreaded).")
endif()
set(BLAS_FOUND "")
elseif(BLA_VENDOR STREQUAL "All" AND BLAS_essl_LIBRARY)
set(BLA_VENDOR "IBMESSL")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "A BLAS library has been found (${BLAS_LIBRARIES}) but we"
"have also potentially detected some multithreaded BLAS libraries from the ESSL."
"We try to find both libraries lists (Sequential/Multithreaded).")
"\n have also potentially detected some multithreaded BLAS libraries from the ESSL."
"\n We try to find both libraries lists (Sequential/Multithreaded).")
endif()
set(BLAS_FOUND "")
endif()
......@@ -321,8 +321,8 @@ if(BLA_VENDOR MATCHES "Intel*")
if(BLA_VENDOR MATCHES "Intel10_64lp*")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS found is Intel MKL:"
"we manage two lists of libs,"
" one sequential and one parallel if found (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")
"\n we manage two lists of libs, one sequential and one parallel if found"
"\n (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")
message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(BLAS DEFAULT_MSG
......@@ -348,8 +348,8 @@ if(BLA_VENDOR MATCHES "Intel*")
elseif(BLA_VENDOR MATCHES "ACML*")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS found is ACML:"
"we manage two lists of libs,"
" one sequential and one parallel if found (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")
"\n we manage two lists of libs, one sequential and one parallel if found"
"\n (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")
message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(BLAS DEFAULT_MSG
......@@ -365,8 +365,8 @@ elseif(BLA_VENDOR MATCHES "ACML*")
elseif(BLA_VENDOR MATCHES "IBMESSL*")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "BLAS found is ESSL:"
"we manage two lists of libs,"
" one sequential and one parallel if found (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")
"\n we manage two lists of libs, one sequential and one parallel if found"
"\n (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")
message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(BLAS DEFAULT_MSG
......
......@@ -28,6 +28,7 @@
# CBLAS_INCLUDE_DIRS_DEP - cblas + dependencies include directories
# CBLAS_LIBRARY_DIRS_DEP - cblas + dependencies link directories
# CBLAS_LIBRARIES_DEP - cblas libraries + dependencies
# CBLAS_HAS_ZGEMM3M - True if cblas contains zgemm3m fast complex mat-mat product
#
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DCBLAS_DIR=path/to/cblas):
......@@ -104,10 +105,18 @@ if (BLAS_FOUND)
set(CMAKE_REQUIRED_FLAGS "${BLAS_COMPILER_FLAGS}")
unset(CBLAS_WORKS CACHE)
check_function_exists(cblas_dscal CBLAS_WORKS)
check_function_exists(cblas_zgemm3m CBLAS_ZGEMM3M_FOUND)
mark_as_advanced(CBLAS_WORKS)
set(CMAKE_REQUIRED_LIBRARIES)
if(CBLAS_WORKS)
# Check for faster complex GEMM routine
# (only C/Z, no S/D version)
if ( CBLAS_ZGEMM3M_FOUND )
add_definitions(-DCBLAS_HAS_ZGEMM3M -DCBLAS_HAS_CGEMM3M)
endif()
if(NOT CBLAS_FIND_QUIETLY)
message(STATUS "Looking for cblas: test with blas succeeds")
endif()
......@@ -318,6 +327,14 @@ if (BLAS_FOUND)
mark_as_advanced(CBLAS_WORKS)
if(CBLAS_WORKS)
# Check for faster complex GEMM routine
# (only C/Z, no S/D version)
check_function_exists(cblas_zgemm3m CBLAS_ZGEMM3M_FOUND)
if ( CBLAS_ZGEMM3M_FOUND )
add_definitions(-DCBLAS_HAS_ZGEMM3M -DCBLAS_HAS_CGEMM3M)
endif()
# save link with dependencies
set(CBLAS_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(CBLAS_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
......
......@@ -139,9 +139,9 @@ if(PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_GIVEN_BY_USER)
# "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}")
#endif()
else()
message("${Magenta}Looking for CHAMELEON - not found using PkgConfig."
"Perhaps you should add the directory containing chameleon.pc"
"to the PKG_CONFIG_PATH environment variable.${ColourReset}")
message(STATUS "${Magenta}Looking for CHAMELEON - not found using PkgConfig."
"\n Perhaps you should add the directory containing chameleon.pc"
"\n to the PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
endif()
......
......@@ -80,9 +80,9 @@ if( PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_GIVEN_BY_USER )
# "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}")
#endif()
else()
message("${Magenta}Looking for EZTRACE - not found using PkgConfig."
"Perhaps you should add the directory containing eztrace.pc to"
"the PKG_CONFIG_PATH environment variable.${ColourReset}")
message(STATUS "${Magenta}Looking for EZTRACE - not found using PkgConfig."
"\n Perhaps you should add the directory containing eztrace.pc to"
"\n the PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
endif()
......
......@@ -251,8 +251,8 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
else(FFTW3F_FOUND)
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3F - not found using PkgConfig."
"Perhaps you should add the directory containing fftw3f.pc to"
"the PKG_CONFIG_PATH environment variable.")
"\n Perhaps you should add the directory containing fftw3f.pc to"
"\n the PKG_CONFIG_PATH environment variable.")
endif()
endif(FFTW3F_FOUND)
elseif(FFTW_LOOK_FOR_FFTW_LONG)
......@@ -280,8 +280,8 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
else(FFTW3L_FOUND)
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3L - not found using PkgConfig."
"Perhaps you should add the directory containing fftw3l.pc to"
"the PKG_CONFIG_PATH environment variable.")
"\n Perhaps you should add the directory containing fftw3l.pc to"
"\n the PKG_CONFIG_PATH environment variable.")
endif()
endif(FFTW3L_FOUND)
elseif(FFTW_LOOK_FOR_FFTW_QUAD)
......@@ -309,8 +309,8 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
else(FFTW3Q_FOUND)
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3Q - not found using PkgConfig."
"Perhaps you should add the directory containing fftw3q.pc to"
"the PKG_CONFIG_PATH environment variable.")
"\n Perhaps you should add the directory containing fftw3q.pc to"
"\n the PKG_CONFIG_PATH environment variable.")
endif()
endif(FFTW3Q_FOUND)
else()
......@@ -338,8 +338,8 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
else(FFTW3_FOUND)
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3 - not found using PkgConfig."
"Perhaps you should add the directory containing fftw3.pc to"
"the PKG_CONFIG_PATH environment variable.")
"\n Perhaps you should add the directory containing fftw3.pc to"
"\n the PKG_CONFIG_PATH environment variable.")
endif()
endif(FFTW3_FOUND)
......
......@@ -76,9 +76,9 @@ if(PKG_CONFIG_EXECUTABLE AND NOT FXT_GIVEN_BY_USER)
# "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}")
#endif()
else()
message("${Magenta}Looking for FXT - not found using PkgConfig."
"Perhaps you should add the directory containing fxt.pc to the"
"PKG_CONFIG_PATH environment variable.${ColourReset}")
message(STATUS "${Magenta}Looking for FXT - not found using PkgConfig."
"\n Perhaps you should add the directory containing fxt.pc to the"
"\n PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
endif()
......
......@@ -79,9 +79,9 @@ if( PKG_CONFIG_EXECUTABLE AND NOT HWLOC_GIVEN_BY_USER )
# "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}")
#endif()
else()
message("${Magenta}Looking for HWLOC - not found using PkgConfig."
"Perhaps you should add the directory containing hwloc.pc to"
"the PKG_CONFIG_PATH environment variable.${ColourReset}")
message(STATUS "${Magenta}Looking for HWLOC - not found using PkgConfig."
"\n Perhaps you should add the directory containing hwloc.pc to"
"\n the PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
endif()
......
......@@ -278,11 +278,9 @@ if(BLA_VENDOR MATCHES "Intel*")
if(BLA_VENDOR MATCHES "Intel10_64lp*")
if(NOT LAPACKEXT_FIND_QUIETLY)
message(STATUS "LAPACK found is Intel MKL:"
"we manage two lists of libs,"
" one sequential and one parallel (see"
"LAPACK_SEQ_LIBRARIES and LAPACK_PAR_LIBRARIES)")
message(STATUS "LAPACK sequential libraries stored in"
"LAPACK_SEQ_LIBRARIES")
"\n we manage two lists of libs, one sequential and one parallel"
"\n (see LAPACK_SEQ_LIBRARIES and LAPACK_PAR_LIBRARIES)")
message(STATUS "LAPACK sequential libraries stored in LAPACK_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(LAPACK DEFAULT_MSG
LAPACK_SEQ_LIBRARIES
......@@ -290,8 +288,7 @@ if(BLA_VENDOR MATCHES "Intel*")
LAPACK_INCLUDE_DIRS)
if(LAPACK_PAR_LIBRARIES)
if(NOT LAPACKEXT_FIND_QUIETLY)
message(STATUS "LAPACK parallel libraries stored in"
"LAPACK_PAR_LIBRARIES")
message(STATUS "LAPACK parallel libraries stored in LAPACK_PAR_LIBRARIES")
endif()
find_package_handle_standard_args(LAPACK DEFAULT_MSG
LAPACK_PAR_LIBRARIES)
......@@ -299,8 +296,7 @@ if(BLA_VENDOR MATCHES "Intel*")
else()
if(NOT LAPACKEXT_FIND_QUIETLY)
message(STATUS "LAPACK sequential libraries stored in"
"LAPACK_SEQ_LIBRARIES")
message(STATUS "LAPACK sequential libraries stored in LAPACK_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(LAPACK DEFAULT_MSG
LAPACK_SEQ_LIBRARIES
......@@ -310,19 +306,16 @@ if(BLA_VENDOR MATCHES "Intel*")
elseif(BLA_VENDOR MATCHES "ACML*")
if(NOT LAPACKEXT_FIND_QUIETLY)
message(STATUS "LAPACK found is ACML:"
"we manage two lists of libs,"
" one sequential and one parallel (see"
"LAPACK_SEQ_LIBRARIES and LAPACK_PAR_LIBRARIES)")
message(STATUS "LAPACK sequential libraries stored in"
"LAPACK_SEQ_LIBRARIES")
"\n we manage two lists of libs, one sequential and one parallel"
"\n (see LAPACK_SEQ_LIBRARIES and LAPACK_PAR_LIBRARIES)")
message(STATUS "LAPACK sequential libraries stored in LAPACK_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(LAPACK DEFAULT_MSG
LAPACK_SEQ_LIBRARIES
LAPACK_LIBRARY_DIRS)
if(LAPACK_PAR_LIBRARIES)
if(NOT LAPACKEXT_FIND_QUIETLY)
message(STATUS "LAPACK parallel libraries stored in"
"LAPACK_PAR_LIBRARIES")
message(STATUS "LAPACK parallel libraries stored in LAPACK_PAR_LIBRARIES")
endif()
find_package_handle_standard_args(LAPACK DEFAULT_MSG
LAPACK_PAR_LIBRARIES)
......@@ -330,27 +323,23 @@ elseif(BLA_VENDOR MATCHES "ACML*")
elseif(BLA_VENDOR MATCHES "IBMESSL*")
if(NOT LAPACKEXT_FIND_QUIETLY)
message(STATUS "LAPACK found is IBMESSL:"
"we manage two lists of libs,"
" one sequential and one parallel (see"
"LAPACK_SEQ_LIBRARIES and LAPACK_PAR_LIBRARIES)")
message(STATUS "LAPACK sequential libraries stored in"
"LAPACK_SEQ_LIBRARIES")
"\n we manage two lists of libs, one sequential and one parallel"
"\n (see LAPACK_SEQ_LIBRARIES and LAPACK_PAR_LIBRARIES)")
message(STATUS "LAPACK sequential libraries stored in LAPACK_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(LAPACK DEFAULT_MSG
LAPACK_SEQ_LIBRARIES
LAPACK_LIBRARY_DIRS)
if(LAPACK_PAR_LIBRARIES)
if(NOT LAPACKEXT_FIND_QUIETLY)
message(STATUS "LAPACK parallel libraries stored in"
"LAPACK_PAR_LIBRARIES")
message(STATUS "LAPACK parallel libraries stored in LAPACK_PAR_LIBRARIES")
endif()
find_package_handle_standard_args(LAPACK DEFAULT_MSG
LAPACK_PAR_LIBRARIES)
endif()
else()
if(NOT LAPACKEXT_FIND_QUIETLY)
message(STATUS "LAPACK sequential libraries stored in"
"LAPACK_SEQ_LIBRARIES")
message(STATUS "LAPACK sequential libraries stored in LAPACK_SEQ_LIBRARIES")
endif()
find_package_handle_standard_args(LAPACK DEFAULT_MSG
LAPACK_SEQ_LIBRARIES
......
......@@ -124,9 +124,9 @@ if(PKG_CONFIG_EXECUTABLE AND NOT MAGMA_GIVEN_BY_USER)
# "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}")
#endif()
else()
message("${Magenta}Looking for MAGMA - not found using PkgConfig. "
"Perhaps you should add the directory containing magma.pc "
"to the PKG_CONFIG_PATH environment variable.${ColourReset}")
message(STATUS "${Magenta}Looking for MAGMA - not found using PkgConfig. "
"\n Perhaps you should add the directory containing magma.pc "
"\n to the PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
endif()
......
......@@ -230,9 +230,9 @@ if(PKG_CONFIG_EXECUTABLE AND NOT PARSEC_GIVEN_BY_USER)
# "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}")
#endif()
else()
message("${Magenta}Looking for PARSEC - not found using PkgConfig."
"Perhaps you should add the directory containing libparsec.pc"
"to the PKG_CONFIG_PATH environment variable.${ColourReset}")
message(STATUS "${Magenta}Looking for PARSEC - not found using PkgConfig."
"\n Perhaps you should add the directory containing libparsec.pc"
"\n to the PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
endif()
......
......@@ -76,9 +76,9 @@ if(PKG_CONFIG_EXECUTABLE AND NOT SIMGRID_GIVEN_BY_USER)
# "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}")
#endif()
else()
message("${Magenta}Looking for SIMGRID - not found using PkgConfig."
"Perhaps you should add the directory containing simgrid.pc to the"
"PKG_CONFIG_PATH environment variable.${ColourReset}")
message(STATUS "${Magenta}Looking for SIMGRID - not found using PkgConfig."
"\n Perhaps you should add the directory containing simgrid.pc to the"
"\n PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
endif()
......
......@@ -230,15 +230,15 @@ if(PKG_CONFIG_EXECUTABLE AND NOT STARPU_GIVEN_BY_USER)
list(GET STARPU_VERSION_STRING_LIST 0 STARPU_VERSION_MAJOR)
list(GET STARPU_VERSION_STRING_LIST 1 STARPU_VERSION_MINOR)
else()
message("${Magenta}Looking for STARPU - not found using PkgConfig."
"Perhaps you should add the directory containing libstarpu.pc"
"to the PKG_CONFIG_PATH environment variable.${ColourReset}")
message(STATUS "${Magenta}Looking for STARPU - not found using PkgConfig."
"\n Perhaps you should add the directory containing libstarpu.pc"
"\n to the PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
if (STARPU_LOOK_FOR_MPI)
if (STARPU_MPI_FOUND AND STARPU_MPI_LIBRARIES)
message(STATUS "Looking for STARPU MPI - found using PkgConfig")
else()
message("${Magenta}Looking for STARPU MPI - not found using PkgConfig."
message(STATUS "${Magenta}Looking for STARPU MPI - not found using PkgConfig."
"Perhaps you should add the directory containing libstarpumpi.pc to"
"the PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
......
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>MORSE CMake "Find modules" documentation</title>
<!-- 2016-09-15 jeu. 08:01 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="generator" content="Org-mode" />
<meta name="author" content="HiePACS" />
<link rel="stylesheet" title="Standard" href="css/worg.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/VisuGen.css" />
<link rel="stylesheet" type="text/css" href="css/VisuRubriqueEncadre.css" />
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2013 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
</head>
<body>
<div id="content">
<h1 class="title">MORSE CMake "Find modules" documentation</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1. CMake find modules: what is it, why is it useful?</a></li>
<li><a href="#sec-2">2. How CMake is aware of these specific modules?</a></li>
<li><a href="#sec-3">3. Internal mechanism: what a "find" mainly do, what are the paths scanned?</a>
<ul>
<li><a href="#sec-3-1">3.1. How to act on the searching process?</a></li>
<li><a href="#sec-3-2">3.2. A version of the library is found but I want another one, how to change?</a></li>
</ul>
</li>
<li><a href="#sec-4">4. How to get more information about a specific module usage?</a></li>
</ul>
</div>
</div>
<p>
This document aims at documenting MORSE find_package CMake modules
which allow to detect library dependencies on UNIX systems (mainly
Linux and MAC OS X). These additional modules have been written
because either, they are not distributed by the CMake community, or,
they already exist but some are outdated or miss the requirements we
need.
</p>
<div id="outline-container-sec-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> CMake find modules: what is it, why is it useful?</h2>
<div class="outline-text-2" id="text-1">
<p>
The CMake modules being here can be used to "find" some installed
libraries on the system through the invocation of the <code>find_package</code>
CMake command ("MODULE" mode signature, cf. CMake documentation of
<code>find_package</code> command)
</p>
<pre class="example">
find_package(BLAS) # look for BLAS libraries and compiler/linker flags
add_executable(foo ${FOO_SOURCES}) # define an executable from sources
target_link_libraries(foo ${BLAS_LIBRARIES}) # add BLAS libraries for the link
</pre>
<p>
It allows to find efficiently the libraries we depend on.
The modules are generally written by the library developers or very
active users so that they know very well how the library is built how
it is installed, etc.
</p>
</div>
</div>
<div id="outline-container-sec-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> How CMake is aware of these specific modules?</h2>
<div class="outline-text-2" id="text-2">
<p>
<code>find_package(LIBNAME)</code> rely on a CMake module file called
<i>FindLIBNAME.cmake</i> which should lies in a directory set in the CMake
variable <code>CMAKE_MODULE_PATH</code>. For example, <code>FindLIBNAME.cmake</code> is in the
relative path <code>./cmake_modules/FindLIBNAME.cmake</code>
</p>
<pre class="example">
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules")
find_package(LIBNAME)
</pre>
<p>
To use MORSE modules you can add the path to the modules in your CMake
project like this
</p>
<pre class="example">
list(APPEND CMAKE_MODULE_PATH "${MORSE_DISTRIB_DIR}/cmake_modules/morse/find" )
</pre>
</div>
</div>
<div id="outline-container-sec-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> Internal mechanism: what a "find" mainly do, what are the paths scanned?</h2>
<div class="outline-text-2" id="text-3">
<p>
The general process consists in looking into some system paths known
from CMake to find headers and libraries and define in output some
CMake variables the user need to link with his dependency. Additionaly
to the system paths, some environment variable can also be scanned
like <code>LD_LIBRARY_PATH</code> and <code>CPATH</code>. A custom CMake cache variable
<code>LIBNAME_DIR</code> is also introduced in our modules in order to let users
indicate directly during the "configure" step a specific installation
directory for the library (e.g. where are located the include/, lib/,
etc, sub-directories). The priority order is the following:
</p>
<ol class="org-ol">
<li>The CMake variable <code>LIBNAME_DIR</code> is set or both <code>LIBNAME_INCDIR</code> and
<code>LIBNAME_LIBDIR</code> are set
</li>
<li>The environment variable <code>LIBNAME_DIR</code> is set or both <code>LIBNAME_INCDIR</code> and
<code>LIBNAME_LIBDIR</code>
</li>
<li>A pkg-config .pc file (hwloc.pc) of the library is available in the
environment (cf. PKG_CONFIG_PATH environment variable) and is used
</li>
<li>Look into the following paths
<ol class="org-ol">
<li>for headers:
<ul class="org-ul">
<li>scan the paths present in the following environment variables
<code>INCLUDE</code>, <code>C_INCLUDE_PATH</code>, <code>CPATH</code>, <code>INCLUDE_PATH</code>
</li>
<li>scan the system paths for headers: look into path present in
the CMake variables
<code>CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES</code> and
<code>CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES</code>
</li>
</ul>
</li>
<li>for libraries:
<ul class="org-ul">
<li>scan the paths present in the following environment variables
<code>LIB</code> (Windows), <code>DYLD_LIBRARY_PATH</code> (Mac OS X), <code>LD_LIBRARY_PATH</code> (Linux)
</li>
<li>scan the system paths for headers: look into path present in
the CMake variables
<code>CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES</code>,
<code>CMAKE_C_IMPLICIT_LINK_DIRECTORIES</code>
</li>
</ul>
</li>
</ol>
</li>
</ol>
<p>
When it is possible, compiler flags are also given to users. This last
point suggest that the information can be found in the library
installation, e.g. through a pkg-config file.
</p>
<p>
In some cases, the library can be searched for a specific
configuration, e.g "I want to find an installation of this library
coming with all these components enabled" such as: MUMPS linear solver
must be able to use SCOTCH graph partitioner. See the "COMPONENTS"
option of the <code>find_package</code> command and look for the header of the
module file to get more information about possible components.
</p>
<p>
Once some header files and libraries have been found the module tries
to call a basic function of the library to test the link step. During
this process, the CMake <code>check_function_exists</code> is used. If the test
fails a message is given with the compiler and linker flags used
during the test. The precise error can also be found in the
<code>CMakeFiles/CMakeError.log</code> file of the build directory.
</p>
</div>
<div id="outline-container-sec-3-1" class="outline-3">
<h3 id="sec-3-1"><span class="section-number-3">3.1</span> How to act on the searching process?</h3>
<div class="outline-text-3" id="text-3-1">
<p>
If the user does not change the environment (do not modify environment
variables like <code>LD_LIBRARY_PATH</code>), and gives no hint at all about the
location of the libraries, the module will match the situation 4.2 and
will look into system paths.
</p>
<p>
To give an "exotic" locations, i.e. not in system paths, the user can
use scripts or a <code>module</code> like system to set the paths in environment
variables (<code>LD_LIBRARY_PATH</code>, <code>INCLUDE</code>, &#x2026;), cf. situation 4.1 and 2.
</p>
<p>
For some libraries it is possible to rely on <code>pkg-config</code> if the .pc
file path is in the <code>PKG_CONFIG_PATH</code> environment variable,
cf. situation 3.
</p>
<p>
Finally, to directly give "by hand" the path, the user can set a CMake
variable <code>LIBNAME_DIR</code>, or the pair <code>LIBNAME_INCDIR</code> and <code>LIBNAME_LIBDIR</code>,
cf. situation 1.
</p>
</div>
</div>
<div id="outline-container-sec-3-2" class="outline-3">
<h3 id="sec-3-2"><span class="section-number-3">3.2</span> A version of the library is found but I want another one, how to change?</h3>
<div class="outline-text-3" id="text-3-2">
<p>
If a first configuration has found a library somewhere but you are not
satisfied with this one and want to give some hints to look for it:
</p>
<ul class="org-ul">