1 dnl Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 dnl file Copyright.txt or https://cmake.org/licensing for details.
4 AC_DEFUN([CMAKE_FIND_BINARY],
5 [AC_ARG_VAR([CMAKE_BINARY], [path to the cmake binary])dnl
7 if test "x$ac_cv_env_CMAKE_BINARY_set" != "xset"; then
8 AC_PATH_TOOL([CMAKE_BINARY], [cmake])dnl
13 # $2: language (e.g. C/CXX/Fortran)
14 # $3: The compiler ID, defaults to GNU.
15 # Possible values are: GNU, Intel, Clang, SunPro, HP, XL, VisualAge, PGI,
16 # PathScale, Cray, SCO, MSVC, LCC
17 # $4: optional extra arguments to cmake, e.g. "-DCMAKE_SIZEOF_VOID_P=8"
18 # $5: optional path to cmake binary
19 AC_DEFUN([CMAKE_FIND_PACKAGE], [
20 AC_REQUIRE([CMAKE_FIND_BINARY])dnl
22 AC_ARG_VAR([$1][_][$2][FLAGS], [$2 compiler flags for $1. This overrides the cmake output])dnl
23 AC_ARG_VAR([$1][_LIBS], [linker flags for $1. This overrides the cmake output])dnl
26 AC_MSG_CHECKING([for $1])
27 if test -z "${$1[]_$2[]FLAGS}"; then
28 $1[]_$2[]FLAGS=`$CMAKE_BINARY --find-package "-DNAME=$1" "-DCOMPILER_ID=m4_default([$3], [GNU])" "-DLANGUAGE=$2" -DMODE=COMPILE $4` || failed=true
30 if test -z "${$1[]_LIBS}"; then
31 $1[]_LIBS=`$CMAKE_BINARY --find-package "-DNAME=$1" "-DCOMPILER_ID=m4_default([$3], [GNU])" "-DLANGUAGE=$2" -DMODE=LINK $4` || failed=true