FindCoMISo.cmake 2.72 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# - Try to find COMISO
# Once done this will define
#  
#  COMISO_FOUND        - system has COMISO
#  COMISO_INCLUDE_DIR  - the COMISO include directory
#  COMISO_LIBRARY_DIR  - where the libraries are
#  COMISO_LIBRARY      - Link these to use COMISO
#   

IF (COMISO_INCLUDE_DIR)
  # Already in cache, be silent
  SET(COMISO_FIND_QUIETLY TRUE)
ENDIF (COMISO_INCLUDE_DIR)

15
16
# Find CoMISo config file
FIND_PATH( COMISO_INCLUDE_DIR CoMISo/Config/config.hh
David Bommes's avatar
David Bommes committed
17
           PATHS "${CMAKE_SOURCE_DIR}/../" "${CMAKE_SOURCE_DIR}/libs/" )
18

19
if ( COMISO_INCLUDE_DIR )
20

21
  FILE(READ ${COMISO_INCLUDE_DIR}/CoMISo/Config/config.hh CURRENT_COMISO_CONFIG)
22

23
  set(COMISO_OPT_DEPS "")
24
25


26
  STRING(REGEX MATCH "\#define COMISO_MPI_AVAILABLE 1" COMISO_MPI_BUILD_TIME_AVAILABLE ${CURRENT_COMISO_CONFIG} )
27

28
  if ( COMISO_MPI_BUILD_TIME_AVAILABLE )
29

30
   find_package(MPI)
31

32
33
34
   if ( NOT MPI_FOUND )
     message(ERROR "COMISO configured with mpi but mpi not available")
   endif()
35

36
   list (APPEND  COMISO_OPT_DEPS "MPI")
37

38
  endif()
39

40
  STRING(REGEX MATCH "\#define COMISO_PETSC_AVAILABLE 1" COMISO_PETSC_BUILD_TIME_AVAILABLE ${CURRENT_COMISO_CONFIG} )
41

42
  if ( COMISO_PETSC_BUILD_TIME_AVAILABLE )
43

44
   find_package(PETSC)
45

46
47
48
   if ( NOT PETSC_FOUND )
     message(ERROR "COMISO configured with petsc but petsc not available")
   endif()
49

50
   list (APPEND  COMISO_OPT_DEPS "PETSC")
51

52
  endif()
53

54
  STRING(REGEX MATCH "\#define COMISO_IPOPT_AVAILABLE 1" COMISO_IPOPT_BUILD_TIME_AVAILABLE ${CURRENT_COMISO_CONFIG} )
55

56
  if ( COMISO_IPOPT_BUILD_TIME_AVAILABLE )
57

58
   find_package(IPOPT)
59

60
61
62
   if ( NOT IPOPT_FOUND )
     message(ERROR "COMISO configured with ipopt but ipopt not available")
   endif()
63

64
   list (APPEND  COMISO_OPT_DEPS "IPOPT")
65

66
  endif()
67

David Bommes's avatar
David Bommes committed
68
69
70
71
72
73
74
75
76
77
78
79
80
81
  STRING(REGEX MATCH "\#define COMISO_MUMPS_AVAILABLE 1" COMISO_MUMPS_BUILD_TIME_AVAILABLE ${CURRENT_COMISO_CONFIG} )

  if ( COMISO_MUMPS_BUILD_TIME_AVAILABLE )

   find_package(MUMPS)

   if ( NOT MUMPS_FOUND )
     message(ERROR "COMISO configured with mumps but mumps not available")
   endif()

   list (APPEND  COMISO_OPT_DEPS "MUMPS")

  endif()

82
  STRING(REGEX MATCH "\#define COMISO_TAO_AVAILABLE 1" COMISO_TAO_BUILD_TIME_AVAILABLE ${CURRENT_COMISO_CONFIG} )
83

84
  if ( COMISO_TAO_BUILD_TIME_AVAILABLE )
85

86
   find_package(TAO)
87

88
89
90
   if ( NOT TAO_FOUND )
     message(ERROR "COMISO configured with tao but tao not available")
   endif()
91

92
93
94
95
96
97
   list (APPEND  COMISO_OPT_DEPS "TAO")
  endif()

  add_definitions (-DCOMISODLL -DUSECOMISO )

endif(COMISO_INCLUDE_DIR)
98
99
100

IF (COMISO_INCLUDE_DIR)
  SET(COMISO_FOUND TRUE)
Jan Möbius's avatar
Jan Möbius committed
101
  SET( COMISO_LIBRARY_DIR "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR}" )
102
  SET( COMISO_LIBRARY "CoMISo")
103
  SET( COMISO_DEPS "GMM;BLAS;SUITESPARSE" )
104
105
106
107
108
ELSE (COMISO_INCLUDE_DIR)
  SET( COMISO_FOUND FALSE )
  SET( COMISO_LIBRARY_DIR )
ENDIF (COMISO_INCLUDE_DIR)