AMDISConfig.cmake.in 17.3 KB
Newer Older
1
2
3
#This configuration file is shipped with the great FEM-Toolbox AMDiS.
#It simplifies the configure of different amdis-version and sets some variables.
#We set the following variables:
Naumann, Andreas's avatar
Naumann, Andreas committed
4
5
6
# AMDIS_INCLUDE_DIR 	the amdis-directory only
# AMDIS_INCLUDE_DIRS	all include directories (mtl, umfpack, parmetis, metis, ...)
# AMDIS_LIBRARIES	the needed libraries
Naumann, Andreas's avatar
Naumann, Andreas committed
7
# AMDIS_LIBRARY_DIRS	the link directories
8
9
10
11
12
13
# AMDiS_COMPILEFLAGS	some compile flags for amdis
#
#
# For a fast start, you use this package in the following way
# simply look for it, possibly set the AMDiS directory
# find_package(AMDiS )
Naumann, Andreas's avatar
Naumann, Andreas committed
14
# include(${AMDIS_USE_FILE})
15
# add_executable(yourTarget <yourSources>)
Naumann, Andreas's avatar
Naumann, Andreas committed
16
# target_link_libraries(yourTarget ${AMDIS_LIBRARIES})
17
18
#
#
Naumann, Andreas's avatar
Naumann, Andreas committed
19
#The AMDIS_USE_FILE adds the include and link-directories for amdis to cmake.
20
#
Naumann, Andreas's avatar
Naumann, Andreas committed
21
#If you use the parallel amdis-version, the AMDIS_USE_FILE also trys to detect
22
23
#the mpi and petsc configuration. If those versions don't fit your needs,
#you can change the corresponding directories, or simply do this work at your own
24
#and omit the AMDIS_USE_FILE. Then you also have to set the flags, include
25
26
#and library directories.

27
################## ONLY WORKAROUND AND WARNING ###################
28
29
30
#if(NOT "$ENV{LIBRARY_PATH}" STREQUAL "")
#        message(WARNING "the environment variable LIBRARY_PATH is set. this can lead to problems during linking. \n You can unset it in your CMakeLists.txt with the command unset(ENV{LIBRARY_PATH}).\n")
#endif()
31
##################################################################
32
33
34

# try to detect the AMDiS include directory
# -------------------------------------------
Naumann, Andreas's avatar
Naumann, Andreas committed
35
36
37
find_file(_AMDIS_H AMDiS.h PATHS ${AMDIS_INCLUDE_DIR} ${AMDIS_DIR}/../../include/amdis/ /usr/include/amdis/)
if(_AMDIS_H)
	get_filename_component(AMDIS_INCLUDE_DIR ${_AMDIS_H} PATH CACHE)
Naumann, Andreas's avatar
Naumann, Andreas committed
38
	set(AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR})
39
else()
Naumann, Andreas's avatar
Naumann, Andreas committed
40
	message(ERROR "could not detect the AMDiS include directory. Please set the variable AMDIS_INCLUDE_DIR to the directory containing the AMDiS headers.")
41
endif()
Naumann, Andreas's avatar
Naumann, Andreas committed
42
unset(_AMDIS_H CACHE)
43
44
# set(MTL_DIR @MTL_INCLUDE_DIR@ CACHE PATH "the mtl directory")
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/mtl4)
45

46
47
# AMDiS base libraries
# --------------------
Naumann, Andreas's avatar
Naumann, Andreas committed
48
49
find_library(_AMDIS_LIB amdis PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/ /usr/include/amdis)
if(_AMDIS_LIB)
50
51
52
  get_filename_component(AMDIS_LIBRARY_DIR ${_AMDIS_LIB} PATH CACHE)
  set(AMDIS_LIBRARY_DIRS ${AMDIS_LIBRARY_DIR})
  set(AMDIS_LIBRARIES "${_AMDIS_LIB}" CACHE STRING "amdis libraries")
53
else()
54
  message(ERROR "could not detect the AMDiS library directory. Please set the variable AMDIS_LIBRARY_DIR to the directory containg the AMDiS library")
55
endif()
Naumann, Andreas's avatar
Naumann, Andreas committed
56
unset(_AMDIS_LIB CACHE)
57

58

59
60
# Boost libraries
# ---------------
61
set(AMDIS_HAS_PARALLEL_DOMAIN @ENABLE_PARALLEL_DOMAIN@)
62
set(AMDIS_NEED_COMPRESSION @ENABLE_COMPRESSION@)
63

Praetorius, Simon's avatar
Praetorius, Simon committed
64
65
66
67
68
69
70
set(BOOST_LIBS_REQUIRED system iostreams filesystem program_options date_time)
if(WIN32)
  list(APPEND BOOST_LIBS_REQUIRED zlib)
  if (AMDIS_NEED_COMPRESSION)
    list(APPEND BOOST_LIBS_REQUIRED bzip2)
  endif ()
endif()
71
72
73
74
75
76

set(BOOST_VERSION "1.42")
if(AMDIS_HAS_PARALLEL_DOMAIN)
  set(BOOST_VERSION "1.48")
endif(AMDIS_HAS_PARALLEL_DOMAIN)

77
78
if(WIN32)
  set(Boost_USE_STATIC_LIBS ON)
79
  find_package(Boost ${BOOST_VERSION} REQUIRED ${BOOST_LIBS_REQUIRED})
80
81
else()
  set(Boost_USE_STATIC_LIBS OFF)
82
  find_package(Boost ${BOOST_VERSION} REQUIRED ${BOOST_LIBS_REQUIRED})
83
endif()
84
if(Boost_FOUND)
85
86
87
88
89
  list(APPEND AMDIS_LIBRARIES ${Boost_LIBRARIES})
  list(APPEND AMDIS_LIBRARY_DIRS ${Boost_LIBRARY_DIRS})
  list(APPEND AMDIS_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
else()
  message(ERROR "Boost libraries not found")
90
endif(Boost_FOUND)
91

92
93
94
95
96
97
98
99
# more libraries and include-directories added by default
# -------------------------------------------------------
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/reinit)
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/compositeFEM)
list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/muparser)

# ------------------------------------------------------------------

100
set(AMDIS_NEED_ZOLTAN @ENABLE_ZOLTAN@)
101
set(AMDIS_OPENMP @ENABLE_OPENMP@)
Praetorius, Simon's avatar
Praetorius, Simon committed
102
set(AMDIS_NEED_CXX11 @ENABLE_CXX11@)
103
set(AMDIS_NEED_UMFPACK @ENABLE_UMFPACK@)
104
set(AMDIS_NEED_HYPRE @ENABLE_HYPRE@)
105
set(AMDIS_NEED_SEQ_PETSC @ENABLE_SEQ_PETSC@)
Praetorius, Simon's avatar
Praetorius, Simon committed
106
set(AMDIS_NEED_PNG @ENABLE_PNG@)
107
set(AMDIS_NEED_BDDCML @ENABLE_BDDCML@)
108
set(AMDIS_NEED_MKL @ENABLE_MKL@)
109
110
set(AMDIS_NEED_EXTENSIONS @ENABLE_EXTENSIONS@)
set(AMDIS_NEED_BASE_PROBLEMS @ENABLE_BASE_PROBLEMS@)
111
112
set(AMDIS_USE_FILE ${AMDIS_DIR}/AMDISUse.cmake)
set(AMDIS_COMPILEFLAGS "@COMPILEFLAGS@")
113
114
115
set(AMDIS_VERSION @CurrentRevision@)
set(AMDIS_MAJOR_VERSION @AMDIS_MAJOR@)
set(AMDIS_MINOR_VERSION @AMDIS_MINOR@)
Naumann, Andreas's avatar
Naumann, Andreas committed
116
set(AMDIS_SUB_MINOR_VERSION @AMDIS_SUB_MINOR@)
117

118
119
120
121
if(CMAKE_BUILD_TYPE STREQUAL "")
	set(CMAKE_BUILD_TYPE "Release")
endif()

Praetorius, Simon's avatar
Praetorius, Simon committed
122
if (AMDIS_NEED_CXX11)
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
  list(APPEND AMDIS_COMPILEFLAGS "-DHAS_CXX11=1")
  if (${CMAKE_VERSION} VERSION_GREATER "3.0")
      set(CMAKE_CXX_STANDARD 11)
      set(CMAKE_CXX_STANDARD_REQUIRED ON)
  else()
    if (CMAKE_COMPILER_IS_GNUCXX)
        set(GXX_MIN_VER "4.8")
        if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS GXX_MIN_VER)
            message (FATAL_ERROR "For C++11-Features the G++ Compiler must be at least version $GXX_MIN_VER")
        endif ()
        list(APPEND AMDIS_COMPILEFLAGS "-std=gnu++11")
    elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
        set(CLANG_MIN_VER "3.0")
        if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_MIN_VER)
            message (FATAL_ERROR "For C++11-Features the Clang Compiler must be at least version $CLANG_MIN_VER")
        endif ()
        list(APPEND AMDIS_COMPILEFLAGS "-std=c++11")
    elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
        set(INTEL_MIN_VER "12.1")
        if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS INTEL_MIN_VER)
            message (FATAL_ERROR "For C++11-Features the Intel C++ Compiler must be at least version $INTEL_MIN_VER")
        endif ()
        list(APPEND AMDIS_COMPILEFLAGS "-std=c++11")
    elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
        set(MSVC_MIN_VER "12.0")
        if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS MSVC_MIN_VER)
            message (FATAL_ERROR "For C++11-Features the MSVC C++ Compiler must be at least version $MSVC_MIN_VER")
        endif ()
    endif ()
  endif()
else ()
  list(APPEND AMDIS_COMPILEFLAGS "-DHAS_CXX11=0")
Praetorius, Simon's avatar
Praetorius, Simon committed
155
156
endif (AMDIS_NEED_CXX11)

157
158
159
#load mpi-compiler for use with parmetis and parallel_domain
if(AMDIS_HAS_PARALLEL_DOMAIN)
	find_package(MPI REQUIRED)
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
    list(APPEND AMDIS_LIBRARIES ${MPI_LIBRARIES})
    list(APPEND AMDIS_COMPILEFLAGS ${MPI_COMPILE_FLAGS})
    list(APPEND AMDIS_INCLUDE_DIRS ${MPI_INCLUDE_PATH})

    find_library(PARMETIS_LIB parmetis)
    if(PARMETIS_LIB)
        list(APPEND AMDIS_LIBRARIES ${PARMETIS_LIB})
    else(PARMETIS_LIB)
        message(FATAL_ERROR "could not find the parmetis libraries needed by amdis")
    endif(PARMETIS_LIB)
    find_library(METIS_LIB metis)
    if(METIS_LIB)
        list(APPEND AMDIS_LIBRARIES ${METIS_LIB})
    else(METIS_LIB)
        message(FATAL_ERROR "could not find the metis libraries needed by amdis")
    endif(METIS_LIB)

177
	if(AMDIS_HAS_PARALLEL_DOMAIN STREQUAL "PETSC")
178
179
180
181
182
183
184
185
186
187
188
189
190
		set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${AMDIS_DIR})
		set(PETSC_EXECUTABLE_RUNS ON)
		find_package(PETSc REQUIRED)
		if(PETSC_FOUND)
			list(APPEND AMDIS_LIBRARIES ${PETSC_LIBRARY_SYS} ${PETSC_LIBRARIES})
			list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_INCLUDES})
		else()
			message(FATAL_ERROR "Could not find PETSc!")
		endif(PETSC_FOUND)
	elseif(AMDIS_HAS_PARALLEL_DOMAIN STREQUAL "PMTL")
		find_package(MTL REQUIRED)
		list(APPEND AMDIS_LIBRARIES ${MTL_LIBRARIES})
	endif()
191

192
193
194
195
196
197
198
elseif(AMDIS_NEED_SEQ_PETSC)
    find_package(MPI REQUIRED)
    if(MPI_FOUND)
	    list(APPEND AMDIS_LIBRARIES ${MPI_LIBRARIES})
	    list(APPEND AMDIS_COMPILEFLAGS ${MPI_COMPILE_FLAGS})
	    list(APPEND AMDIS_INCLUDE_DIRS ${MPI_INCLUDE_PATH})
    endif(MPI_FOUND)
199

200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
  set(CMAKE_MODULE_PATH ${AMDIS_DIR})
    set(PETSC_EXECUTABLE_RUNS ON)
    find_package(PETSc REQUIRED)
    if(PETSC_FOUND)
	    list(APPEND AMDIS_LIBRARIES ${PETSC_LIBRARY_SYS} ${PETSC_LIBRARIES})
	    list(APPEND AMDIS_INCLUDE_DIRS ${PETSC_INCLUDES})
    else()
	    message(FATAL_ERROR "Could not find PETSc!")
    endif(PETSC_FOUND)
endif()

if(AMDIS_NEED_HYPRE)
  find_package(HYPRE REQUIRED HINTS ${AMDIS_DIR})
  if(HAVE_HYPRE)
    if(NOT MPI_FOUND)
      find_package(MPI REQUIRED)
      if(MPI_FOUND)
	    list(APPEND AMDIS_LIBRARIES ${MPI_LIBRARIES})
	    list(APPEND AMDIS_COMPILEFLAGS ${MPI_COMPILE_FLAGS})
	    list(APPEND AMDIS_INCLUDE_DIRS ${MPI_INCLUDE_PATH})
      endif()
    endif()
    list(APPEND AMDIS_INCLUDE_DIRS ${HYPRE_INCLUDE_DIRECTORIES})
    list(APPEND AMDIS_COMPILEFLAGS "-DMTL_HAS_HYPRE")
    list(APPEND AMDIS_LIBRARIES ${HYPRE_LIBRARIES} )
  endif()
endif(AMDIS_NEED_HYPRE)

228
229
230
231
232
233
234
235
236
237
if(AMDIS_OPENMP)
  if(CMAKE_CXX_COMPILER MATCHES ".*icpc")
        list(APPEND AMDIS_COMPILEFLAGS "-openmp")
        list(APPEND AMDIS_LIBRARIES "-openmp")
  else()
    list(APPEND AMDIS_COMPILEFLAGS "-fopenmp")
        list(APPEND AMDIS_LIBRARIES "-fopenmp")
  endif()
endif(AMDIS_OPENMP)

238
239
240
241
242
243
244
245

# AMDiS-Extensions library
# ------------------------
if(AMDIS_NEED_EXTENSIONS)
  list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions)
  list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/time)
  list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/nanoflann)
  list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/extensions/pugixml)
246

247
248
249
250
251
252
253
254
255
256
257
  find_library(_EXTENSIONS_LIB extensions PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/)
  if(_EXTENSIONS_LIB)
    list(APPEND AMDIS_LIBRARIES ${_EXTENSIONS_LIB})
  endif()
  unset(_EXTENSIONS_LIB CACHE)
endif(AMDIS_NEED_EXTENSIONS)

# AMDiS BaseProblems libraries
# ----------------------------
if(AMDIS_NEED_BASE_PROBLEMS)
  list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_INCLUDE_DIR}/base_problems)
258

259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
  find_library(_BASE_PROBLEMS_LIB base_problems PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/)
  if(_BASE_PROBLEMS_LIB)
    list(APPEND AMDIS_LIBRARIES ${_BASE_PROBLEMS_LIB})
  endif()
  unset(_BASE_PROBLEMS_LIB CACHE)
endif(AMDIS_NEED_BASE_PROBLEMS)

# ----------------------------

find_library(_REINIT_LIB reinit PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/)
find_library(_COMPOSITE_FEM_LIB compositeFEM PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/)
find_library(_MUPARSER_LIB muparser PATHS ${AMDIS_LIBRARY_DIR} ${AMDIS_DIR}/../../lib/amdis/)

if(_REINIT_LIB)
  list(APPEND AMDIS_LIBRARIES ${_REINIT_LIB})
else()
  message(ERROR "Reinit library not found")
endif()
unset(_REINIT_LIB CACHE)
if(_COMPOSITE_FEM_LIB)
  list(APPEND AMDIS_LIBRARIES ${_COMPOSITE_FEM_LIB})
else()
  message(ERROR "CompositeFEM library not found")
endif()
unset(_COMPOSITE_FEM_LIB CACHE)
if(_MUPARSER_LIB)
  list(APPEND AMDIS_LIBRARIES ${_MUPARSER_LIB})
else()
  message(ERROR "MuParser library not found")
endif()
unset(_MUPARSER_LIB CACHE)

# ----------------------------

293
if(AMDIS_NEED_UMFPACK)
294
295
296
    if (WIN32)
        set(SuiteSparse_USE_LAPACK_BLAS ON)
    endif (WIN32)
Praetorius, Simon's avatar
Praetorius, Simon committed
297
    find_package(SuiteSparse QUIET)
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436

    if (SuiteSparse_FOUND)
        include(${USE_SuiteSparse})
        list(APPEND AMDIS_LIBRARIES ${SuiteSparse_LIBRARIES})
        list(APPEND AMDIS_INCLUDE_DIRS ${SuiteSparse_INCLUDE_DIR} ${SuiteSparse_METIS_INCLUDE_DIR})
        message("AMDIS_INCLUDE_DIRS = ${AMDIS_INCLUDE_DIRS}")
    else (SuiteSparse_FOUND)

        set(AMDIS_UMFPACK_PATH @UMFPACK_PATH@)
        list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_UMFPACK_PATH})
        find_library(UMFPACK_LIB umfpack
            HINTS ENV LIBRARY_PATH
            DOC "The UMFPACK library")
        if(UMFPACK_LIB)
            list(APPEND AMDIS_LIBRARIES ${UMFPACK_LIB})
        else()
            message(FATAL_ERROR "Could not find the UMFPACK library")
        endif()
        if("$ENV{BLA_VENDOR}" STREQUAL "ACML")
        find_library(ACML_LIBRARY acml HINTS ENV ACML_LIB)
        if(ACML_LIBRARY)
            list(APPEND AMDIS_LIBRARIES ${ACML_LIBRARY}) #fortran ffio m rt) #needed for open64
        else()
            message(FATAL_ERROR "could not find the acml libraries, required by acml blas")
        endif(ACML_LIBRARY)
        else()
        find_library(BLAS_LIBRARY NAMES "blas" "goto" "mkl"
            HINTS ENV MKL_LIB
            DOC "The BLAS library")
        if(BLAS_LIBRARY)
            list(APPEND AMDIS_LIBRARIES ${BLAS_LIBRARY})
            list(APPEND AMDIS_LIBRARY_DIRS ${BLAS_LIBRARY_DIR})
        else()
            find_package(BLAS)
            if(BLAS_FOUND)
                list(APPEND AMDIS_LIBRARIES ${BLAS_LIBRARIES})
            else()
                message(STATUS "Could not find the BLAS library. Please set the variable BLAS_LIBRARY to the blas library with full path")
            endif()
        endif()
        endif("$ENV{BLA_VENDOR}" STREQUAL "ACML")

        find_library(AMD_LIB amd
            HINTS ENV LIBRARY_PATH
            DOC "The AMD library")
        if(AMD_LIB)
            list(APPEND AMDIS_LIBRARIES ${AMD_LIB})
        else()
            message(FATAL_ERROR "Could not find the AMD library.")
        endif()
        #check for if we need cholmod
        set(_CHOLMOD_TEST_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/cholmodTest/)
        file(WRITE ${_CHOLMOD_TEST_DIR}/CMakeLists.txt "project(cholmodTest)
                cmake_minimum_required(VERSION 2.8)
                include_directories(${AMDIS_INCLUDE_DIRS})
                add_executable(cholmodTest cholmodTest.cpp)
                target_link_libraries(cholmodTest ${AMDIS_LIBRARIES})")
        file(WRITE ${_CHOLMOD_TEST_DIR}/cholmodTest.cpp "#include <stdio.h>

    #include \"umfpack.h\"

    int n = 5 ;

    int Ap [ ] = {0, 2, 5, 9, 10, 12} ;

    int Ai [ ] = { 0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4} ;

    double Ax [ ] = {2., 3., 3., -1., 4., 4., -3., 1., 2., 2., 6., 1.} ;

    double b [ ] = {8., 45., -3., 3., 19.} ;

    double x [5] ;

    int main (void)

    {

    double *null = (double *) NULL ;

    int i ;

    void *Symbolic, *Numeric ;

    double stats [2];
    umfpack_tic (stats);

    (void) umfpack_di_symbolic (n, n, Ap, Ai, Ax, &Symbolic, null, null) ;

    (void) umfpack_di_numeric (Ap, Ai, Ax, Symbolic, &Numeric, null, null) ;

    umfpack_di_free_symbolic (&Symbolic) ;

    (void) umfpack_di_solve (UMFPACK_A, Ap, Ai, Ax, x, b, Numeric, null, null) ;

    umfpack_di_free_numeric (&Numeric) ;

    umfpack_toc (stats);


    return (0) ;

    }")
    # "#include <umfpack.h>
    #			int main(int , char* argv[]) { double c[UMFPACK_CONTROL]; umfpack_dl_defaults(c); return 0;}")
        try_compile(CHOLMOD_TEST ${_CHOLMOD_TEST_DIR}/build ${_CHOLMOD_TEST_DIR} cholmodTest
                OUTPUT_VARIABLE CHOLMOD_OUT)
        if(NOT CHOLMOD_TEST)
        file(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "cholmodTest-output: \n ${CHOLMOD_OUT}")
        find_library(CHOLMOD_LIB cholmod)
        find_library(COLAMD_LIB colamd)

        if(CHOLMOD_LIB)
            list(APPEND AMDIS_LIBRARIES ${CHOLMOD_LIB})
        else()
            message(FATAL_ERROR "your umfpack seems to need cholmod, but cmake could not find it")
        endif()
        if(COLAMD_LIB)
            list(APPEND AMDIS_LIBRARIES ${COLAMD_LIB})
        else()
            message(FATAL_ERROR "your umfpack seems to need colamd, but cmake could not find it")
        endif()

        #test with cholmod and colamd..
        file(WRITE ${_CHOLMOD_TEST_DIR}/CMakeLists.txt "project(cholmodTest)
                cmake_minimum_required(VERSION 2.8)
                include_directories(${AMDIS_INCLUDE_DIRS})
                add_executable(cholmodTest cholmodTest.cpp)
                target_link_libraries(cholmodTest ${AMDIS_LIBRARIES})")
        try_compile(CHOLMOD_TEST2 ${_CHOLMOD_TEST_DIR}/build ${_CHOLMOD_TEST_DIR} cholmodTest
            OUTPUT_VARIABLE CHOLMOD_OUT)
        if(NOT CHOLMOD_TEST2)
            file(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "cholmodTest2-output: \n ${CHOLMOD_OUT}")
            find_library(SUITESPARSECONFIG_LIB suitesparseconfig)
            if(SUITESPARSECONFIG_LIB)
            list(APPEND AMDIS_LIBRARIES ${SUITESPARSECONFIG_LIB})
            else()
            message(STATUS "your umfpack seems to need suitesparseconfig, but cmake could not find it")
            endif()
        endif()
437

438
439
        endif()
    endif ()
440
endif(AMDIS_NEED_UMFPACK)
441

442
443
# PNG library
# -----------
Praetorius, Simon's avatar
Praetorius, Simon committed
444
if(AMDIS_NEED_PNG)
445
446
447
448
449
450
451
452
453
454
455
  set(AMDIS_PNG_PATH @PNG_PATH@)
  list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_PNG_PATH})

  find_library(PNG_LIB png
	  HINTS ENV LIBRARY_PATH
	  DOC "The PNG library")
  if(PNG_LIB)
    list(APPEND AMDIS_LIBRARIES ${PNG_LIB})
  else()
    message(FATAL_ERROR "Could not find the PNG library")
  endif()
Praetorius, Simon's avatar
Praetorius, Simon committed
456
endif(AMDIS_NEED_PNG)
Thomas Witkowski's avatar
Thomas Witkowski committed
457

458
459
# BDDCML-library
# --------------
460
if(AMDIS_NEED_BDDCML)
461
462
  set(AMDIS_BDDCML_PATH @BDDCML_PATH@)
  list(APPEND AMDIS_INCLUDE_DIRS ${AMDIS_BDDCML_PATH})
463

464
465
  set(AMDIS_BDDCML_LIB @BDDCML_LIB@)
  list(APPEND AMDIS_LIBRARIES ${AMDIS_BDDCML_LIB})
466

467
468
  set(AMDIS_BDDCML_LINK_LIST @BDDCML_LINK_LIST@)
  list(APPEND AMDIS_LIBRARIES ${AMDIS_BDDCML_LINK_LIST})
469
470
endif(AMDIS_NEED_BDDCML)

471
472
473
# Zoltan library
# --------------
if(AMDIS_NEED_ZOLTAN)
474
  find_library(ZOLTAN_LIB zoltan
475
	  HINTS ENV LIBRARY_PATH
476
	  DOC "full path to the zoltan library")
Praetorius, Simon's avatar
Praetorius, Simon committed
477

478
  if(ZOLTAN_LIB)
479
    list(APPEND AMDIS_LIBRARIES ${ZOLTAN_LIB})
480
481
482
483
  else()
    message(FATAL_ERROR "Could not find zoltan library!")
  endif()
endif()
Praetorius, Simon's avatar
Praetorius, Simon committed
484

Praetorius, Simon's avatar
Praetorius, Simon committed
485

Naumann, Andreas's avatar
Naumann, Andreas committed
486
if(${AMDIS_FIND_COMPONENTS} MATCHES umfpack )
487
488
489
	if(NOT AMDIS_NEED_UMFPACK)
	  set(AMDIS_umfpack_FOUND FALSE)
	  message(SEND_ERROR "The selected amdis was not compiled with umfpack")
490
491
	endif()
endif()