Commits (43)
......@@ -11,5 +11,5 @@ Find:
- cd modules/find/tests
- mkdir -p build
- cd build
- cmake .. -DENABLE_CTEST=ON -DLAPACKE_COMPONENTS="TMG" -DQUARK_COMPONENTS="HWLOC" -DPASTIX_COMPONENTS="PARSEC;STARPU"
- cmake .. -DENABLE_CTEST=ON -DLAPACKE_COMPONENTS="TMG" -DQUARK_COMPONENTS="HWLOC" -DCHAMELEON_COMPONENTS="MPI;FXT;STARPU"
- ctest -V
......@@ -23,18 +23,19 @@ See the file [morse_cmakefind_doc.org](modules/find/morse_cmakefind_doc.org).
Installation
---------------------
We recommend to use this project as a `git submodule` of your project.
# Example if morse_cmake is defined as a git submodule in ./cmake_modules/
git submodule add https://gitlab.inria.fr/solverstack/morse_cmake.git cmake_modules/morse_cmake
To use MORSE modules you have to add the path to the modules in your
CMake project and include the MorseInit module:
# Define where are located module files on your system
set(MORSE_CMAKE_MODULE_PATH "/where/is/morse_cmake" CACHE PATH "Path to morse_cmake sources")
# Append this directory to the list of directories containing CMake modules
list(APPEND CMAKE_MODULE_PATH "${MORSE_CMAKE_MODULE_PATH}/modules/" )
# Example if Morse CMake modules are located in ./cmake_modules/morse_cmake/modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/morse_cmake/modules" )
# Include the init module
include(MorseInit)
We recommend to use this project as a `git submodule` of your project.
Testing
---------------------
......
......@@ -27,6 +27,9 @@
#
###
# Path to Morse modules
get_filename_component(MORSE_CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_FILE} DIRECTORY CACHE)
# Global Morse options
option(MORSE_ENABLE_WARNING "Enable warning messages" OFF)
option(MORSE_ENABLE_COVERAGE "Enable flags for coverage test" OFF)
......@@ -47,13 +50,6 @@ if (MORSE_ENABLE_COLOR_MESSAGE)
include(ColorizeMessage)
endif()
# To find headers and libs
include(FindHeadersAndLibs)
# Some macros to print status when search for headers and libs
# PrintFindStatus.cmake is in cmake_modules/morse/find directory
include(PrintFindStatus)
# Define some auxilary flags
include(AuxilaryFlags)
......@@ -63,6 +59,9 @@ include(Ressources)
# Add the path where we handle our FindFOO.cmake to seek for liraries
list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find)
# To load some macros used in Finds (could be useful for other projects)
include(FindInit)
##
## @end file MorseInit.cmake
##
......@@ -233,16 +233,21 @@ MACRO(precisions_rules_py)
# We generate a dependency only if a file will be generated
if( got_file )
set( _compile_flags "-DPRECISION_${_dependency_PREC}" )
set( _listtmp ${PREC_RULE_PRECISIONS})
list(REMOVE_ITEM _listtmp ${_dependency_PREC})
foreach( _prec ${_listtmp})
set( _compile_flags "${_compile_flags} -UPRECISION_${_prec}" )
endforeach()
if( generate_out )
# the custom command is executed in CMAKE_CURRENT_BINARY_DIR
ADD_CUSTOM_COMMAND(
OUTPUT ${_dependency_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E remove -f ${_dependency_OUTPUT} && ${pythoncmd} && chmod a-w ${_dependency_OUTPUT}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_dependency_INPUT} ${RP_CODEGEN} ${RP_${CMAKE_PROJECT_NAME}_DICTIONNARY})
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS "-DPRECISION_${_dependency_PREC}" GENERATED 1 IS_IN_BINARY_DIR 1 )
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS ${_compile_flags} GENERATED 1 IS_IN_BINARY_DIR 1 )
else( generate_out )
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS "-DPRECISION_${_dependency_PREC}" GENERATED 0 )
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS ${_compile_flags} GENERATED 0 )
endif( generate_out )
list(APPEND ${OUTPUTLIST} ${_dependency_OUTPUT})
......
This diff is collapsed.
......@@ -18,20 +18,18 @@
#
# The following variables have been added to manage links with sequential or multithreaded
# versions:
# BLAS_INCLUDE_DIRS - BLAS include directories
# BLAS_LIBRARY_DIRS - Link directories for BLAS libraries
# BLAS_SEQ_LIBRARIES - BLAS component libraries to be linked (sequential)
# BLAS_SEQ_COMPILER_FLAGS - uncached list of required compiler flags (including -I for mkl headers).
# BLAS_SEQ_LINKER_FLAGS - uncached list of required linker flags (excluding -l
# and -L)
# BLAS_PAR_LIBRARIES - BLAS component libraries to be linked (multithreaded)
# BLAS_PAR_COMPILER_FLAGS - uncached list of required compiler flags (including -I for mkl headers)
# BLAS_PAR_LINKER_FLAGS - uncached list of required linker flags (excluding -l
# and -L)
# BLASEXT_FOUND - if a BLAS has been found
# BLASEXT_LIBRARIES - Idem BLAS_LIBRARIES
# BLASEXT_INCLUDE_DIRS - Idem BLAS_INCLUDE_DIRS
# BLASEXT_LIBRARY_DIRS - Idem BLAS_LIBRARY_DIRS
# BLAS_INCLUDE_DIRS - BLAS include directories
# BLAS_LIBRARY_DIRS - Link directories for BLAS libraries
# BLAS_SEQ_LIBRARIES - BLAS component libraries to be linked (sequential)
# BLAS_SEQ_CFLAGS_OTHER - compiler flags without headers paths
# BLAS_SEQ_LDFLAGS_OTHER - linker flags without libraries
# BLAS_PAR_LIBRARIES - BLAS component libraries to be linked (multithreaded)
# BLAS_PAR_CFLAGS_OTHER - compiler flags without headers paths
# BLAS_PAR_LDFLAGS_OTHER - linker flags without libraries
# BLASEXT_FOUND - if a BLAS has been found
# BLASEXT_LIBRARIES - Idem BLAS_LIBRARIES
# BLASEXT_INCLUDE_DIRS - Idem BLAS_INCLUDE_DIRS
# BLASEXT_LIBRARY_DIRS - Idem BLAS_LIBRARY_DIRS
#=============================================================================
# Copyright 2012-2013 Inria
......@@ -90,11 +88,9 @@ if(NOT BLASEXT_FIND_QUIETLY)
"\n ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
endif()
if (NOT BLAS_FOUND)
# First blas detection in order to decide if we should look for a
# multitheaded version
find_package_blas(0)
endif ()
# First blas detection in order to decide if we should look for a
# multitheaded version
find_package_blas(0)
# detect the cases where SEQ and PAR libs are handled
if(BLA_VENDOR STREQUAL "All" AND
......@@ -152,7 +148,6 @@ if(BLA_VENDOR MATCHES "Intel*")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
set(ENV_MKLROOT "$ENV{MKLROOT}")
if (ENV_MKLROOT)
......@@ -206,11 +201,11 @@ if(BLA_VENDOR MATCHES "Intel*")
find_package_blas(0)
if(BLAS_FOUND)
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
if (BLAS_COMPILER_FLAGS)
set (BLAS_SEQ_COMPILER_FLAGS "${BLAS_COMPILER_FLAGS}")
if (BLAS_CFLAGS_OTHER)
set (BLAS_SEQ_CFLAGS_OTHER "${BLAS_CFLAGS_OTHER}")
endif()
if (BLAS_LINKER_FLAGS)
set (BLAS_SEQ_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
if (BLAS_LDFLAGS_OTHER)
set (BLAS_SEQ_LDFLAGS_OTHER "${BLAS_LDFLAGS_OTHER}")
endif()
else()
set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")
......@@ -224,11 +219,11 @@ if(BLA_VENDOR MATCHES "Intel*")
find_package_blas(0)
if(BLAS_FOUND)
set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")
if (BLAS_COMPILER_FLAGS)
set (BLAS_PAR_COMPILER_FLAGS "${BLAS_COMPILER_FLAGS}")
if (BLAS_CFLAGS_OTHER)
set (BLAS_PAR_CFLAGS_OTHER "${BLAS_CFLAGS_OTHER}")
endif()
if (BLAS_LINKER_FLAGS)
set (BLAS_PAR_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
if (BLAS_LDFLAGS_OTHER)
set (BLAS_PAR_LDFLAGS_OTHER "${BLAS_LDFLAGS_OTHER}")
endif()
else()
set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")
......@@ -301,33 +296,34 @@ endif()
# Reset pure BLAS cmake variables to the sequential case (arbitrary default)
if(BLAS_SEQ_LIBRARIES)
set(BLAS_LIBRARIES "${BLAS_SEQ_LIBRARIES}")
set(BLAS_COMPILER_FLAGS "${BLAS_SEQ_COMPILER_FLAGS}")
set(BLAS_LINKER_FLAGS "${BLAS_SEQ_LINKER_FLAGS}")
set(BLAS_CFLAGS_OTHER "${BLAS_SEQ_CFLAGS_OTHER}")
set(BLAS_LDFLAGS_OTHER "${BLAS_SEQ_LDFLAGS_OTHER}")
endif()
# extract libs paths
# remark: because it is not given by find_package(BLAS)
set(BLAS_LIBRARY_DIRS "")
string(REPLACE " " ";" BLAS_LIBRARIES "${BLAS_LIBRARIES}")
foreach(blas_lib ${BLAS_LIBRARIES})
if (EXISTS "${blas_lib}")
get_filename_component(a_blas_lib_dir "${blas_lib}" PATH)
list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" )
else()
string(REPLACE "-L" "" blas_lib "${blas_lib}")
# extract libs paths if not given by find_package(BLAS)
if (NOT BLAS_LIBRARY_DIRS)
set(BLAS_LIBRARY_DIRS "")
string(REPLACE " " ";" BLAS_LIBRARIES "${BLAS_LIBRARIES}")
foreach(blas_lib ${BLAS_LIBRARIES})
if (EXISTS "${blas_lib}")
list(APPEND BLAS_LIBRARY_DIRS "${blas_lib}" )
else()
get_filename_component(a_blas_lib_dir "${blas_lib}" PATH)
if (EXISTS "${a_blas_lib_dir}")
list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" )
list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" )
else()
string(REPLACE "-L" "" blas_lib "${blas_lib}")
if (EXISTS "${blas_lib}")
list(APPEND BLAS_LIBRARY_DIRS "${blas_lib}" )
else()
get_filename_component(a_blas_lib_dir "${blas_lib}" PATH)
if (EXISTS "${a_blas_lib_dir}")
list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" )
endif()
endif()
endif()
endif()
endforeach()
if (BLAS_LIBRARY_DIRS)
list(REMOVE_DUPLICATES BLAS_LIBRARY_DIRS)
endif ()
endforeach()
if (BLAS_LIBRARY_DIRS)
list(REMOVE_DUPLICATES BLAS_LIBRARY_DIRS)
endif ()
endif(NOT BLAS_LIBRARY_DIRS)
# check that BLASEXT has been found
# ---------------------------------
......
This diff is collapsed.
This diff is collapsed.
......@@ -59,7 +59,6 @@ else()
string(REPLACE ":" ";" _path_env "$ENV{PATH}")
list(APPEND where_to_look "${_path_env}")
endif()
list(APPEND where_to_look "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND where_to_look "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES where_to_look)
......
###
#
# @copyright (c) 2018 Inria. All rights reserved.
#
###
#
# @file FindCommon.cmake
#
# @project MORSE
# MORSE is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 1.0.0
# @author Florent Pruvost
# @date 13-04-2018
#
###
# clean these variables before using them in CMAKE_REQUIRED_* variables in
# check_function_exists
macro(finds_remove_duplicates)
if (REQUIRED_DEFINITIONS)
list(REMOVE_DUPLICATES REQUIRED_DEFINITIONS)
endif()
if (REQUIRED_INCDIRS)
list(REMOVE_DUPLICATES REQUIRED_INCDIRS)
endif()
if (REQUIRED_FLAGS)
list(REMOVE_DUPLICATES REQUIRED_FLAGS)
endif()
if (REQUIRED_LDFLAGS)
list(REMOVE_DUPLICATES REQUIRED_LDFLAGS)
endif()
if (REQUIRED_LIBS)
list(REVERSE REQUIRED_LIBS)
list(REMOVE_DUPLICATES REQUIRED_LIBS)
list(REVERSE REQUIRED_LIBS)
endif()
endmacro()
##
## @end file FindCommon
##
......@@ -20,11 +20,23 @@
# This module finds headers and eztrace library.
# Results are reported in variables:
# EZTRACE_FOUND - True if headers and requested libraries were found
# EZTRACE_C_FLAGS - list of required compilation flags (excluding -I)
# EZTRACE_INCLUDE_DIRS - eztrace include directories
# EZTRACE_LIBRARY_DIRS - Link directories for eztrace libraries
# EZTRACE_LIBRARIES - eztrace component libraries to be linked
#
# EZTRACE_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables are set
# <PREFIX> = EZTRACE
# <XPREFIX> = <PREFIX> for common case
# <XPREFIX> = <PREFIX>_STATIC for static linking
# <XPREFIX>_FOUND ... set to 1 if module(s) exist
# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
# <XPREFIX>_LDFLAGS ... all required linker flags
# <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
# <XPREFIX>_CFLAGS ... all required cflags
# <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
#
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DEZTRACE_DIR=path/to/eztrace):
......@@ -51,6 +63,9 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if (NOT EZTRACE_FOUND)
set(EZTRACE_DIR "" CACHE PATH "Installation directory of EZTRACE library")
if (NOT EZTRACE_FIND_QUIETLY)
......@@ -73,14 +88,10 @@ find_package(PkgConfig QUIET)
if( PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_GIVEN_BY_USER )
pkg_search_module(EZTRACE eztrace)
if (NOT EZTRACE_FIND_QUIETLY)
if (EZTRACE_FOUND AND EZTRACE_LIBRARIES)
message(STATUS "Looking for EZTRACE - found using PkgConfig")
#if(NOT EZTRACE_INCLUDE_DIRS)
# message("${Magenta}EZTRACE_INCLUDE_DIRS is empty using PkgConfig."
# "Perhaps the path to eztrace headers is already present in your"
# "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}")
#endif()
else()
message(STATUS "${Magenta}Looking for EZTRACE - not found using PkgConfig."
"\n Perhaps you should add the directory containing eztrace.pc to"
......@@ -88,13 +99,12 @@ if( PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_GIVEN_BY_USER )
endif()
if (EZTRACE_FOUND AND EZTRACE_LIBRARIES)
set(EZTRACE_FOUND_WITH_PKGCONFIG "TRUE")
find_pkgconfig_libraries_absolute_path(EZTRACE)
else()
set(EZTRACE_FOUND_WITH_PKGCONFIG "FALSE")
endif()
endif()
set(EZTRACE_C_FLAGS "${EZTRACE_CFLAGS_OTHER}")
endif( PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_GIVEN_BY_USER )
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND) OR (EZTRACE_GIVEN_BY_USER) )
......@@ -117,7 +127,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND)
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
endif()
list(REMOVE_DUPLICATES _lib_env)
......@@ -167,7 +176,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND)
list(APPEND _inc_env "${_path_env}")
endif()
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES _inc_env)
......@@ -235,7 +243,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND)
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
endif()
endif()
......@@ -288,51 +295,71 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND)
list(REMOVE_DUPLICATES EZTRACE_LIBRARY_DIRS)
endif ()
# check a function to validate the find
if(EZTRACE_LIBRARIES)
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND) OR (EZTRACE_GIVEN_BY_USER) )
set(REQUIRED_INCDIRS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
# check a function to validate the find
if(EZTRACE_LIBRARIES)
# EZTRACE
if (EZTRACE_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${EZTRACE_INCLUDE_DIRS}")
endif()
if (EZTRACE_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${EZTRACE_LIBRARY_DIRS}")
endif()
set(REQUIRED_LIBS "${EZTRACE_LIBRARIES}")
set(REQUIRED_INCDIRS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
set(CMAKE_REQUIRED_LIBRARIES)
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
# test link
unset(EZTRACE_WORKS CACHE)
include(CheckFunctionExists)
check_function_exists(eztrace_start EZTRACE_WORKS)
mark_as_advanced(EZTRACE_WORKS)
if(NOT EZTRACE_WORKS)
if(NOT EZTRACE_FIND_QUIETLY)
message(STATUS "Looking for eztrace : test of eztrace_topology_init with eztrace library fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
# EZTRACE
if (EZTRACE_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${EZTRACE_INCLUDE_DIRS}")
endif()
if (EZTRACE_CFLAGS_OTHER)
set(REQUIRED_FLAGS "${EZTRACE_CFLAGS_OTHER}")
endif()
if (EZTRACE_LDFLAGS_OTHER)
set(REQUIRED_LDFLAGS "${EZTRACE_LDFLAGS_OTHER}")
endif()
if (EZTRACE_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${EZTRACE_LIBRARY_DIRS}")
endif()
set(REQUIRED_LIBS "${EZTRACE_LIBRARIES}")
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
if (REQUIRED_FLAGS)
set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
set(REQUIRED_FLAGS)
set(REQUIRED_DEFINITIONS)
foreach(_flag ${REQUIRED_FLAGS_COPY})
if (_flag MATCHES "^-D")
list(APPEND REQUIRED_DEFINITIONS "${_flag}")
endif()
string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
finds_remove_duplicates()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
# test link
unset(EZTRACE_WORKS CACHE)
include(CheckFunctionExists)
check_function_exists(eztrace_start EZTRACE_WORKS)
mark_as_advanced(EZTRACE_WORKS)
if(NOT EZTRACE_WORKS)
if(NOT EZTRACE_FIND_QUIETLY)
message(STATUS "Looking for eztrace : test of eztrace_topology_init with eztrace library fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "CMAKE_REQUIRED_FLAGS: ${CMAKE_REQUIRED_FLAGS}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
endif(EZTRACE_LIBRARIES)
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND) OR (EZTRACE_GIVEN_BY_USER) )
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
endif(EZTRACE_LIBRARIES)
if (EZTRACE_LIBRARIES)
if (EZTRACE_LIBRARY_DIRS)
......@@ -355,11 +382,6 @@ mark_as_advanced(EZTRACE_DIR_FOUND)
# check that EZTRACE has been found
# -------------------------------
include(FindPackageHandleStandardArgs)
if (PKG_CONFIG_EXECUTABLE AND EZTRACE_FOUND)
find_package_handle_standard_args(EZTRACE DEFAULT_MSG
EZTRACE_LIBRARIES)
else()
find_package_handle_standard_args(EZTRACE DEFAULT_MSG
EZTRACE_LIBRARIES
EZTRACE_WORKS)
endif()
find_package_handle_standard_args(EZTRACE DEFAULT_MSG
EZTRACE_LIBRARIES
EZTRACE_WORKS)
This diff is collapsed.
......@@ -28,15 +28,30 @@
# This module finds headers and fftw library.
# Results are reported in variables:
# FFTW_FOUND - True if headers and requested libraries were found
# FFTW_C_FLAGS - list of required compilation flags (excluding -I)
# FFTW_LINKER_FLAGS - list of required linker flags (excluding -l and -L)
# FFTW_INCLUDE_DIRS - fftw include directories
# FFTW_LIBRARY_DIRS - Link directories for fftw libraries
# FFTW_LIBRARIES - fftw component libraries to be linked
# FFTW_INCLUDE_DIRS_DEP - fftw + dependencies include directories
# FFTW_LIBRARY_DIRS_DEP - fftw + dependencies link directories
# FFTW_LIBRARIES_DEP - fftw libraries + dependencies
# FFTW_CFLAGS_OTHER - fftw compiler flags without headers paths
# FFTW_LDFLAGS_OTHER - fftw linker flags without libraries
# FFTW_INCLUDE_DIRS - fftw include directories
# FFTW_LIBRARY_DIRS - fftw link directories
# FFTW_LIBRARIES - fftw libraries to be linked (absolute path)
# FFTW_CFLAGS_OTHER_DEP - fftw + dependencies compiler flags without headers paths
# FFTW_LDFLAGS_OTHER_DEP - fftw + dependencies linker flags without libraries
# FFTW_INCLUDE_DIRS_DEP - fftw + dependencies include directories
# FFTW_LIBRARY_DIRS_DEP - fftw + dependencies link directories
# FFTW_LIBRARIES_DEP - fftw + dependencies libraries
#
# FFTW_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables are set
# <PREFIX> = FFTW3F or FFTW3 or FFTW3L or FFTW3Q
# <XPREFIX> = <PREFIX> for common case
# <XPREFIX> = <PREFIX>_STATIC for static linking
# <XPREFIX>_FOUND ... set to 1 if module(s) exist
# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
# <XPREFIX>_LDFLAGS ... all required linker flags
# <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
# <XPREFIX>_CFLAGS ... all required cflags
# <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
#
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DFFTW_DIR=path/to/fftw):
......@@ -65,6 +80,8 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if (NOT FFTW_FOUND)
set(FFTW_DIR "" CACHE PATH "Installation directory of FFTW library given by user")
......@@ -184,10 +201,10 @@ if (FFTW_LOOK_FOR_MKL)
endif()
if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_MKL)
find_package(Threads REQUIRED)
find_package(BLASEXT REQUIRED)
find_package(BLAS REQUIRED)
else()
find_package(Threads)
find_package(BLASEXT)
find_package(BLAS)
endif()
endif()
......@@ -201,12 +218,17 @@ if (FFTW_LOOK_FOR_ESSL)
set(BLA_VENDOR "IBMESSL")
endif()
if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_ESSL)
find_package(BLASEXT REQUIRED)
find_package(BLAS REQUIRED)
else()
find_package(BLASEXT)
find_package(BLAS)
endif()
endif()
if( THREADS_FOUND )
libraries_absolute_path(CMAKE_THREAD_LIBS_INIT "")
endif ()
set(ENV_FFTW_DIR "$ENV{FFTW_DIR}")
set(ENV_FFTW_INCDIR "$ENV{FFTW_INCDIR}")
set(ENV_FFTW_LIBDIR "$ENV{FFTW_LIBDIR}")
......@@ -231,11 +253,11 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
pkg_search_module(FFTW3F fftw3f)
pkg_search_module(FFTW3 fftw3)
if (FFTW3F_FOUND)
set(FFTW_C_FLAGS "${FFTW3F_CFLAGS_OTHER}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3F - found using PkgConfig")
endif()
if (FFTW3F_LIBRARIES)
find_pkgconfig_libraries_absolute_path(FFTW3F)
list(APPEND FFTW_LIBRARIES "${FFTW3F_LIBRARIES}")
endif()
if(FFTW3F_INCLUDE_DIRS)
......@@ -261,11 +283,11 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
pkg_search_module(FFTW3L fftw3l)
pkg_search_module(FFTW3 fftw3)
if (FFTW3L_FOUND)
set(FFTW_C_FLAGS "${FFTW3L_CFLAGS_OTHER}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3L - found using PkgConfig")
endif()
if (FFTW3L_LIBRARIES)
find_pkgconfig_libraries_absolute_path(FFTW3L)
list(APPEND FFTW_LIBRARIES "${FFTW3L_LIBRARIES}")
endif()
if(FFTW3L_INCLUDE_DIRS)
......@@ -291,11 +313,11 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
pkg_search_module(FFTW3Q fftw3q)
pkg_search_module(FFTW3 fftw3)
if (FFTW3Q_FOUND)
set(FFTW_C_FLAGS "${FFTW3Q_CFLAGS_OTHER}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3Q - found using PkgConfig")
endif()
if (FFTW3Q_LIBRARIES)
find_pkgconfig_libraries_absolute_path(FFTW3Q)
list(APPEND FFTW_LIBRARIES "${FFTW3Q_LIBRARIES}")
endif()
if(FFTW3Q_INCLUDE_DIRS)
......@@ -319,13 +341,16 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
endif(FFTW3Q_FOUND)
else()
pkg_search_module(FFTW3 fftw3)
if (FFTW3_FOUND AND FFTW3_LIBRARIES)
find_pkgconfig_libraries_absolute_path(FFTW3)
endif()
endif()
if (FFTW3_FOUND)
set(FFTW_C_FLAGS "${FFTW3_CFLAGS_OTHER}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3 - found using PkgConfig")
endif()
if (FFTW3_LIBRARIES)
find_pkgconfig_libraries_absolute_path(FFTW3)
list(APPEND FFTW_LIBRARIES "${FFTW3_LIBRARIES}")
endif()
if(FFTW3_INCLUDE_DIRS)
......@@ -348,14 +373,6 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
endif()
endif(FFTW3_FOUND)
set(FFTW_INCLUDE_DIRS_DEP "${FFTW_STATIC_INCLUDE_DIRS}")
set(FFTW_LIBRARY_DIRS_DEP "${FFTW_STATIC_LIBRARY_DIRS}")
set(FFTW_LIBRARIES_DEP "${FFTW_STATIC_LIBRARIES}" )
if (FFTW_LIBRARIES)
set(FFTW_WORKS TRUE)
endif()
if (FFTW_FOUND AND FFTW_LIBRARIES)
set(FFTW_FOUND_WITH_PKGCONFIG "TRUE")
else()
......@@ -407,7 +424,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
list(APPEND _inc_env "${_path_env}")
endif()
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES _inc_env)
......@@ -496,7 +512,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
string(REPLACE ":" ";" _lib_env2 "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${_lib_env2}")
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
endif()
endif()
......@@ -604,8 +619,8 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
# FFTW relies on blas libs
if (FFTW_LOOK_FOR_THREADS)
if (FFTW_LOOK_FOR_MKL)
if (BLAS_PAR_LIBRARIES)
list(APPEND FFTW_LIBRARIES "${BLAS_PAR_LIBRARIES}")
if (BLAS_LIBRARIES_PAR)
list(APPEND FFTW_LIBRARIES "${BLAS_LIBRARIES_PAR}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Multithreaded FFTW has been found: ${FFTW_LIBRARIES}")
endif()
......@@ -617,10 +632,10 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
message(STATUS "Multithreaded FFTW not found.")
endif()
endif()
endif(BLAS_PAR_LIBRARIES)
endif(BLAS_LIBRARIES_PAR)
elseif (FFTW_LOOK_FOR_ESSL)
if (FFTW_LIBRARIES AND BLAS_PAR_LIBRARIES)
list(APPEND FFTW_LIBRARIES "${BLAS_PAR_LIBRARIES}")
if (FFTW_LIBRARIES AND BLAS_LIBRARIES_PAR)
list(APPEND FFTW_LIBRARIES "${BLAS_LIBRARIES_PAR}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Multithreaded FFTW has been found: ${FFTW_LIBRARIES}")
endif()
......@@ -632,12 +647,12 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
message(STATUS "Multithreaded FFTW not found.")
endif()
endif()
endif(FFTW_LIBRARIES AND BLAS_PAR_LIBRARIES)
endif(FFTW_LIBRARIES AND BLAS_LIBRARIES_PAR)
endif()
else(FFTW_LOOK_FOR_THREADS)
if (FFTW_LOOK_FOR_MKL)
if (BLAS_SEQ_LIBRARIES)
list(APPEND FFTW_LIBRARIES "${BLAS_SEQ_LIBRARIES}")
if (BLAS_LIBRARIES_SEQ)
list(APPEND FFTW_LIBRARIES "${BLAS_LIBRARIES_SEQ}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "FFTW has been found: ${FFTW_LIBRARIES}")
endif()
......@@ -649,10 +664,10 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
message(STATUS "FFTW not found.")
endif()
endif()
endif(BLAS_SEQ_LIBRARIES)
endif(BLAS_LIBRARIES_SEQ)
elseif (FFTW_LOOK_FOR_ESSL)
if (FFTW_LIBRARIES AND BLAS_SEQ_LIBRARIES)
list(APPEND FFTW_LIBRARIES "${BLAS_SEQ_LIBRARIES}")
if (FFTW_LIBRARIES AND BLAS_LIBRARIES_SEQ)
list(APPEND FFTW_LIBRARIES "${BLAS_LIBRARIES_SEQ}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "FFTW has been found: ${FFTW_LIBRARIES}")
endif()
......@@ -664,7 +679,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
message(STATUS "FFTW not found.")
endif()
endif()
endif(FFTW_LIBRARIES AND BLAS_SEQ_LIBRARIES)
endif(FFTW_LIBRARIES AND BLAS_LIBRARIES_SEQ)
endif()
endif(FFTW_LOOK_FOR_THREADS)
......@@ -688,98 +703,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
endif()
endforeach()
# check a function to validate the find
if(FFTW_LIBRARIES)
set(REQUIRED_FLAGS)
set(REQUIRED_LDFLAGS)
set(REQUIRED_INCDIRS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
# FFTW
if (FFTW_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${FFTW_INCLUDE_DIRS}")
endif()
if (FFTW_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${FFTW_LIBRARY_DIRS}")
endif()
set(REQUIRED_LIBS "${FFTW_LIBRARIES}")
# THREADS
if (FFTW_LOOK_FOR_THREADS)
list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}")
endif()
# OMP
if(FFTW_LOOK_FOR_OMP)
list(APPEND REQUIRED_FLAGS "${OPENMP_C_FLAGS}")
#if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
# # either gomp ...
# list(APPEND REQUIRED_LIBS "-lgomp")
# # or iomp5
# list(APPEND REQUIRED_LIBS "-liomp5")
#elseif (CMAKE_C_COMPILER_ID STREQUAL "Intel")
# list(APPEND REQUIRED_LIBS "-liomp5")
#endif()
endif()
# MKL
if(FFTW_LOOK_FOR_MKL)
list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND REQUIRED_LDFLAGS "-Wl,--no-as-needed")
endif()
endif()
# m
find_library(M_LIBRARY NAMES m)
mark_as_advanced(M_LIBRARY)
if(M_LIBRARY)
list(APPEND REQUIRED_LIBS "-lm")
endif()
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
list(APPEND CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
# test link
unset(FFTW_WORKS CACHE)
include(CheckFunctionExists)
if (FFTW_LOOK_FOR_ESSL)
check_function_exists(${FFTW_PREC_TESTFUNC}fftw_execute FFTW_WORKS)
else()
check_function_exists(${FFTW_PREC_TESTFUNC}fftw_execute_ FFTW_WORKS)
endif()
mark_as_advanced(FFTW_WORKS)
if(FFTW_WORKS)
# save link with dependencies
set(FFTW_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(FFTW_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(FFTW_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(FFTW_C_FLAGS "${REQUIRED_FLAGS}")
set(FFTW_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES FFTW_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES FFTW_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES FFTW_LINKER_FLAGS)
else()
if(NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW : test of ${FFTW_PREC_TESTFUNC}fftw_execute_ with fftw library fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "CMAKE_REQUIRED_FLAGS: ${CMAKE_REQUIRED_FLAGS}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
endif(FFTW_LIBRARIES)
endif( (NOT PKG_CONFIG_EXECUTABLE) OR
(PKG_CONFIG_EXECUTABLE AND NOT FFTW_FOUND) OR
FFTW_GIVEN_BY_USER OR
......@@ -787,6 +710,105 @@ endif( (NOT PKG_CONFIG_EXECUTABLE) OR
FFTW_LOOK_FOR_ESSL
)
# check a function to validate the find
if(FFTW_LIBRARIES)
set(REQUIRED_FLAGS)
set(REQUIRED_LDFLAGS)
set(REQUIRED_INCDIRS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
# FFTW
if (FFTW_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${FFTW_INCLUDE_DIRS}")
endif()
if (FFTW_CFLAGS_OTHER)
set(REQUIRED_FLAGS "${FFTW_CFLAGS_OTHER}")
endif()
if (FFTW_LDFLAGS_OTHER)
set(REQUIRED_LDFLAGS "${FFTW_LDFLAGS_OTHER}")
endif()
if (FFTW_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${FFTW_LIBRARY_DIRS}")
endif()
set(REQUIRED_LIBS "${FFTW_LIBRARIES}")
# THREADS
if (FFTW_LOOK_FOR_THREADS)
list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}")
endif()
# OMP
if(FFTW_LOOK_FOR_OMP)
list(APPEND REQUIRED_FLAGS "${OPENMP_C_FLAGS}")
endif()
# MKL
if(FFTW_LOOK_FOR_MKL)
list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND REQUIRED_LDFLAGS "-Wl,--no-as-needed")
endif()
endif()
# m
find_library(M_LIBRARY NAMES m)
mark_as_advanced(M_LIBRARY)
if(M_LIBRARY)
list(APPEND REQUIRED_LIBS "-lm")
endif()
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
if (REQUIRED_FLAGS)
set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
set(REQUIRED_FLAGS)
set(REQUIRED_DEFINITIONS)
foreach(_flag ${REQUIRED_FLAGS_COPY})
if (_flag MATCHES "^-D")
list(APPEND REQUIRED_DEFINITIONS "${_flag}")
endif()
string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
finds_remove_duplicates()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
list(APPEND CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
# test link
unset(FFTW_WORKS CACHE)
include(CheckFunctionExists)
if (FFTW_LOOK_FOR_ESSL)
check_function_exists(${FFTW_PREC_TESTFUNC}fftw_execute FFTW_WORKS)
else()
check_function_exists(${FFTW_PREC_TESTFUNC}fftw_execute_ FFTW_WORKS)
endif()
mark_as_advanced(FFTW_WORKS)
if(FFTW_WORKS)
# save link with dependencies
set(FFTW_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(FFTW_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(FFTW_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(FFTW_CFLAGS_OTHER_DEP "${REQUIRED_FLAGS}")
set(FFTW_LDFLAGS_OTHER_DEP "${REQUIRED_LDFLAGS}")
else()
if(NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW : test of ${FFTW_PREC_TESTFUNC}fftw_execute_ with fftw library fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "CMAKE_REQUIRED_FLAGS: ${CMAKE_REQUIRED_FLAGS}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
endif(FFTW_LIBRARIES)
if (FFTW_LIBRARIES)
list(GET FFTW_LIBRARIES 0 first_lib)
get_filename_component(first_lib_path "${first_lib}" PATH)
......@@ -806,13 +828,6 @@ mark_as_advanced(FFTW_DIR_FOUND)
# check that FFTW has been found
# -------------------------------
include(FindPackageHandleStandardArgs)
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FFTW_FOUND) OR (FFTW_GIVEN_BY_USER) )
find_package_handle_standard_args(FFTW DEFAULT_MSG
FFTW_LIBRARIES
FFTW_INCLUDE_DIRS
FFTW_WORKS)
else()
find_package_handle_standard_args(FFTW DEFAULT_MSG
FFTW_LIBRARIES
FFTW_WORKS)
endif()
find_package_handle_standard_args(FFTW DEFAULT_MSG
FFTW_LIBRARIES
FFTW_WORKS)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -45,6 +45,9 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if (NOT HYPRE_FOUND)
set(HYPRE_DIR "" CACHE PATH "Installation directory of HYPRE library")
if (NOT HYPRE_FIND_QUIETLY)
......@@ -86,7 +89,6 @@ else()
list(APPEND _inc_env "${_path_env}")
endif()
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES _inc_env)
......@@ -154,7 +156,6 @@ else()
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
endif()
endif()
......@@ -224,6 +225,7 @@ if(HYPRE_LIBRARIES)
set(REQUIRED_LIBS "${HYPRE_LIBRARIES}")
# set required libraries for link
finds_remove_duplicates()
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
set(CMAKE_REQUIRED_LIBRARIES)
foreach(lib_dir ${REQUIRED_LIBDIRS})
......
......@@ -27,14 +27,9 @@
#
###
# Add the path where we handle our FindFOO.cmake to seek for liraries
list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find)
# Some macros to print status when search for headers and libs
# PrintFindStatus.cmake is in cmake_modules/morse/find directory
include(PrintFindStatus)
function(FindHeader _libname _header_to_find)
# save _libname upper and lower case
......@@ -59,7 +54,6 @@ function(FindHeader _libname _header_to_find)
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES _inc_env)
......
This diff is collapsed.