FindCoMISo.cmake 2.23 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
17
18
           PATHS "${CMAKE_SOURCE_DIR}/libs/" )

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
FILE(READ ${COMISO_INCLUDE_DIR}/CoMISo/Config/config.hh CURRENT_COMISO_CONFIG)

set(COMISO_OPT_DEPS "")


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

if ( COMISO_MPI_BUILD_TIME_AVAILABLE )

 find_package(MPI)

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

 list (APPEND  COMISO_OPT_DEPS "MPI")

endif()

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

if ( COMISO_PETSC_BUILD_TIME_AVAILABLE )

 find_package(PETSC)

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

 list (APPEND  COMISO_OPT_DEPS "PETSC")

endif()

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

if ( COMISO_IPOPT_BUILD_TIME_AVAILABLE )

 find_package(IPOPT)

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

 list (APPEND  COMISO_OPT_DEPS "IPOPT")

endif()

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

if ( COMISO_TAO_BUILD_TIME_AVAILABLE )

 find_package(TAO)

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

 list (APPEND  COMISO_OPT_DEPS "TAO")
endif()

79
80
81
82
add_definitions (-DCOMISODLL -DUSECOMISO )

IF (COMISO_INCLUDE_DIR)
  SET(COMISO_FOUND TRUE)
Jan Möbius's avatar
Jan Möbius committed
83
  SET( COMISO_LIBRARY_DIR "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR}" )
84
  SET( COMISO_LIBRARY "CoMISo")
85
  SET( COMISO_DEPS "GMM;BLAS;SUITESPARSE" )
86
87
88
89
90
ELSE (COMISO_INCLUDE_DIR)
  SET( COMISO_FOUND FALSE )
  SET( COMISO_LIBRARY_DIR )
ENDIF (COMISO_INCLUDE_DIR)