cmake.m4 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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.
  3. AC_DEFUN([CMAKE_FIND_BINARY],
  4. [AC_ARG_VAR([CMAKE_BINARY], [path to the cmake binary])dnl
  5. if test "x$ac_cv_env_CMAKE_BINARY_set" != "xset"; then
  6. AC_PATH_TOOL([CMAKE_BINARY], [cmake])dnl
  7. fi
  8. ])dnl
  9. # $1: package name
  10. # $2: language (e.g. C/CXX/Fortran)
  11. # $3: The compiler ID, defaults to GNU.
  12. # Possible values are: GNU, Intel, Clang, SunPro, HP, XL, VisualAge, PGI,
  13. # PathScale, Cray, SCO, MSVC
  14. # $4: optional extra arguments to cmake, e.g. "-DCMAKE_SIZEOF_VOID_P=8"
  15. # $5: optional path to cmake binary
  16. AC_DEFUN([CMAKE_FIND_PACKAGE], [
  17. AC_REQUIRE([CMAKE_FIND_BINARY])dnl
  18. AC_ARG_VAR([$1][_][$2][FLAGS], [$2 compiler flags for $1. This overrides the cmake output])dnl
  19. AC_ARG_VAR([$1][_LIBS], [linker flags for $1. This overrides the cmake output])dnl
  20. failed=false
  21. AC_MSG_CHECKING([for $1])
  22. if test -z "${$1[]_$2[]FLAGS}"; then
  23. $1[]_$2[]FLAGS=`$CMAKE_BINARY --find-package "-DNAME=$1" "-DCOMPILER_ID=m4_default([$3], [GNU])" "-DLANGUAGE=$2" -DMODE=COMPILE $4` || failed=true
  24. fi
  25. if test -z "${$1[]_LIBS}"; then
  26. $1[]_LIBS=`$CMAKE_BINARY --find-package "-DNAME=$1" "-DCOMPILER_ID=m4_default([$3], [GNU])" "-DLANGUAGE=$2" -DMODE=LINK $4` || failed=true
  27. fi
  28. if $failed; then
  29. unset $1[]_$2[]FLAGS
  30. unset $1[]_LIBS
  31. AC_MSG_RESULT([no])
  32. $6
  33. else
  34. AC_MSG_RESULT([yes])
  35. $5
  36. fi[]dnl
  37. ])