← Back to team overview

dolfin team mailing list archive

[Fwd: [Branch ~dolfin-core/dolfin/main] Rev 4912: Add experimental CMake file for MTL4.]

 

I played around with a CMake test for MTL4, and once I got the hang of
it is was really easy!

Something I noticed is that if

  include_directories(${MTL4_INCLUDE_DIR})
  add_definitions(-DHAS_MTL4)

are used in the Foo.cmake file, then there is no need set the include
dirs and flags in dolfin/CMakeLists.txt.

Garth

-------- Forwarded Message --------
> From: noreply@xxxxxxxxxxxxx
> Reply-to: noreply@xxxxxxxxxxxxx
> To: Garth Wells <gnw20@xxxxxxxxx>
> Subject: [Branch ~dolfin-core/dolfin/main] Rev 4912: Add experimental
> CMake file for MTL4.
> Date: Mon, 09 Aug 2010 20:25:43 -0000
> 
> ------------------------------------------------------------
> revno: 4912
> committer: Garth N. Wells <gnw20@xxxxxxxxx>
> branch nick: dolfin-cmake
> timestamp: Mon 2010-08-09 21:14:55 +0100
> message:
>   Add experimental CMake file for MTL4.
> added:
>   cmake/FindMTL4.cmake
> modified:
>   CMakeLists.txt
> 
> 
> --
> lp:dolfin
> https://code.launchpad.net/~dolfin-core/dolfin/main
> 
> Your team DOLFIN Core Team is subscribed to branch lp:dolfin.
> To unsubscribe from this branch go to https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscription
> differences between files attachment (revision-diff.txt)
> === modified file 'CMakeLists.txt'
> --- CMakeLists.txt	2010-08-09 13:42:19 +0000
> +++ CMakeLists.txt	2010-08-09 20:14:55 +0000
> @@ -46,7 +46,7 @@
>  option(DOLFIN_ENABLE_UMFPACK "Compile with support for UMFPACK." ON)
>  option(DOLFIN_ENABLE_TRILINOS "Compile with support for Trilinos." ON)
>  option(DOLFIN_ENABLE_CHOLMOD "Compile with support for CHOLMOD." ON)
> -option(DOLFIN_ENABLE_MTL4 "Compile with support for MTL4." ON)
> +option(MTL4_ENABLE_MTL4 "Compile with support for MTL4." ON)
>  option(DOLFIN_ENABLE_PARMETIS "Compile with support for ParMETIS." ON)
>  option(DOLFIN_ENABLE_GMP "Compile with support for GMP." OFF)
>  option(DOLFIN_ENABLE_ZLIB "Compile with support for zlib." ON)
> @@ -84,9 +84,9 @@
>  #if(DOLFIN_ENABLE_CHOLMOD)
>  #  include(DOLFINFindCHOLMOD)
>  #endif(DOLFIN_ENABLE_CHOLMOD)
> -#if(DOLFIN_ENABLE_MTL4)
> -#  include(DOLFINFindMTL4)
> -#endif(DOLFIN_ENABLE_MTL4)
> +if(MTL4_ENABLE_MTL4)
> +  find_package(MTL4)
> +endif(MTL4_ENABLE_MTL4)
>  #if(DOLFIN_ENABLE_PARMETIS)
>  #  include(DOLFINFindParMETIS)
>  #endif(DOLFIN_ENABLE_PARMETIS)
> 
> === added file 'cmake/FindMTL4.cmake'
> --- cmake/FindMTL4.cmake	1970-01-01 00:00:00 +0000
> +++ cmake/FindMTL4.cmake	2010-08-09 20:14:55 +0000
> @@ -0,0 +1,22 @@
> +set(MTL4_FOUND 0)
> +
> +message(STATUS "checking for package 'MTL4'")
> +
> +find_path(MTL4_INCLUDE_DIR boost/numeric/mtl/mtl.hpp
> +  $ENV{MTL4_DIR}
> +  /usr/local/include
> +  /usr/include
> +  DOC "Directory where the MTL4 header directory is located"
> +  )
> +
> +if(MTL4_INCLUDE_DIR)
> +  set(MTL4_FOUND 1)
> +endif(MTL4_INCLUDE_DIR)
> +
> +if(MTL4_FOUND)
> +  message(STATUS "  found package MTL4")
> +  set(CMAKE_REQUIRED_INCLUDES ${MTL4_INCLUDE_DIR})
> +  add_definitions(-DHAS_MTL4)
> +else(MTL4_FOUND)
> +  message(STATUS "  package 'MTL4' not found")
> +endif(MTL4_FOUND)
> 

=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2010-08-09 13:42:19 +0000
+++ CMakeLists.txt	2010-08-09 20:14:55 +0000
@@ -46,7 +46,7 @@
 option(DOLFIN_ENABLE_UMFPACK "Compile with support for UMFPACK." ON)
 option(DOLFIN_ENABLE_TRILINOS "Compile with support for Trilinos." ON)
 option(DOLFIN_ENABLE_CHOLMOD "Compile with support for CHOLMOD." ON)
-option(DOLFIN_ENABLE_MTL4 "Compile with support for MTL4." ON)
+option(MTL4_ENABLE_MTL4 "Compile with support for MTL4." ON)
 option(DOLFIN_ENABLE_PARMETIS "Compile with support for ParMETIS." ON)
 option(DOLFIN_ENABLE_GMP "Compile with support for GMP." OFF)
 option(DOLFIN_ENABLE_ZLIB "Compile with support for zlib." ON)
@@ -84,9 +84,9 @@
 #if(DOLFIN_ENABLE_CHOLMOD)
 #  include(DOLFINFindCHOLMOD)
 #endif(DOLFIN_ENABLE_CHOLMOD)
-#if(DOLFIN_ENABLE_MTL4)
-#  include(DOLFINFindMTL4)
-#endif(DOLFIN_ENABLE_MTL4)
+if(MTL4_ENABLE_MTL4)
+  find_package(MTL4)
+endif(MTL4_ENABLE_MTL4)
 #if(DOLFIN_ENABLE_PARMETIS)
 #  include(DOLFINFindParMETIS)
 #endif(DOLFIN_ENABLE_PARMETIS)

=== added file 'cmake/FindMTL4.cmake'
--- cmake/FindMTL4.cmake	1970-01-01 00:00:00 +0000
+++ cmake/FindMTL4.cmake	2010-08-09 20:14:55 +0000
@@ -0,0 +1,22 @@
+set(MTL4_FOUND 0)
+
+message(STATUS "checking for package 'MTL4'")
+
+find_path(MTL4_INCLUDE_DIR boost/numeric/mtl/mtl.hpp
+  $ENV{MTL4_DIR}
+  /usr/local/include
+  /usr/include
+  DOC "Directory where the MTL4 header directory is located"
+  )
+
+if(MTL4_INCLUDE_DIR)
+  set(MTL4_FOUND 1)
+endif(MTL4_INCLUDE_DIR)
+
+if(MTL4_FOUND)
+  message(STATUS "  found package MTL4")
+  set(CMAKE_REQUIRED_INCLUDES ${MTL4_INCLUDE_DIR})
+  add_definitions(-DHAS_MTL4)
+else(MTL4_FOUND)
+  message(STATUS "  package 'MTL4' not found")
+endif(MTL4_FOUND)