CMakeLists.txt 15.6 KB
Newer Older
1
project(Xdmf)
2 3 4 5
cmake_minimum_required(VERSION 3.1)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
6

7 8 9
#Needed to build DSM because relative paths are used to add its libraries
if (POLICY CMP0015)
	cmake_policy(SET CMP0015 NEW)
10
endif ()
11

12 13 14 15
if(MSVC10)
	SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
	SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
	SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
16 17 18
endif()

set(XDMF_LIBNAME "Xdmf" CACHE STRING "Name for this xdmf library to avoid collision")
19

20 21
set(XDMF_MAJOR_VERSION 3)
set(XDMF_MINOR_VERSION 0)
Nico Schlömer's avatar
Nico Schlömer committed
22 23
set(XDMF_PATCH_VERSION 0)
set(XDMF_VERSION "${XDMF_MAJOR_VERSION}.${XDMF_MINOR_VERSION}.${XDMF_PATCH_VERSION}")
24

25 26 27 28 29 30 31 32 33
if(BUILD_SHARED_LIBS)
  set(LIBTYPE SHARED)
  set(BUILD_SHARED 1)
else()
  set(LIBTYPE STATIC)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/XdmfConfig.hpp.in
               ${CMAKE_CURRENT_BINARY_DIR}/XdmfConfig.hpp)

34 35 36 37 38 39 40
if (WIN32)
  set(XDMF_STATIC_AND_SHARED OFF)
else()
  option(XDMF_STATIC_AND_SHARED
       "Build both static and shared libraries" ON)
  mark_as_advanced(FORCE XDMF_STATIC_AND_SHARED)
endif()
41 42 43 44 45 46 47

# Enable CMake testing
option(XDMF_BUILD_TESTING "Build Tests" OFF)
if(XDMF_BUILD_TESTING)
  enable_testing()
  include(CTest)
endif()
48

49
if (XDMF_STATIC_AND_SHARED)
50
  add_definitions(-DXDMFSTATIC)
51
endif ()
52

53
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
54 55 56 57 58 59 60 61 62
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
list(APPEND CMAKE_MODULE_PATH
  ${CMAKE_CURRENT_SOURCE_DIR}/CMake
  ${CMAKE_CURRENT_SOURCE_DIR}/CMake/VersionSuite)
if(XDMF_BUILD_TESTING)
  list(APPEND CMAKE_MODULE_PATH
    ${CMAKE_CURRENT_SOURCE_DIR}/CMake/TestingSuite)
endif()
Ken Leiter (Civ's avatar
Ken Leiter (Civ committed
63

64
include(XdmfFunctions)
65

66 67
option(XDMF_INSTALL_NO_DEVELOPMENT "Prevent install from writing out developement files." OFF)
mark_as_advanced(XDMF_INSTALL_NO_DEVELOPMENT)
68 69 70
# Converting Install Prefix to an absolute path
get_filename_component(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)

71
# RPath
Andrew Burns's avatar
Andrew Burns committed
72 73 74 75 76 77 78
option(XDMF_SET_RPATH ON)
if (XDMF_SET_RPATH)
  set(CMAKE_SKIP_BUILD_RPATH  FALSE)
  set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
  set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
  set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif ()
79

80 81 82
# Should we build with documentation
option(XDMF_BUILD_DOCUMENTATION OFF)
if(XDMF_BUILD_DOCUMENTATION)
83
  add_subdirectory(doc)
84
endif()
85

86 87 88 89
# Wrapper Setup
option(XDMF_WRAP_PYTHON OFF)
option(XDMF_WRAP_JAVA OFF)

90 91 92 93 94 95 96 97 98 99 100 101 102
#check for TIFF
find_package(TIFF)
if (TIFF_FOUND)
  add_definitions(-DXDMF_BUILD_TIFF)
  mark_as_advanced(FORCE TIFF_INCLUDE_DIR)
  mark_as_advanced(FORCE TIFF_LIBRARIES)
  mark_as_advanced(FORCE TIFF_LIBRARY)
  include_directories(${TIFF_INCLUDE_DIR})
  get_filename_component(TIFF_LIBRARY_DIR "${TIFF_LIBRARY}" PATH)
  set(XDMF_LIBRARY_DIRS ${XDMF_LIBRARY_DIRS} ${TIFF_LIBRARY_DIR})
  set(XDMF_LIBRARIES ${XDMF_LIBRARIES} ${TIFF_LIBRARIES})
endif (TIFF_FOUND)

103 104
# Test for DSM
option(XDMF_BUILD_DSM OFF)
105
mark_as_advanced(XDMF_BUILD_DSM)
106
if(XDMF_BUILD_DSM)
107 108 109 110 111 112
  find_package(MPI REQUIRED)
  if(MPI_FOUND)
    include_directories(${MPI_INCLUDE_PATH})
    set(XDMF_LIBRARIES ${XDMF_LIBRARIES} ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
    get_filename_component(MPI_LIBRARY_DIR ${MPI_LIBRARY} PATH)
    set(XDMF_LIBRARY_DIRS ${XDMF_LIBRARY_DIRS} ${MPI_LIBRARY_DIR})
113 114 115 116
    # intel compiler requires an extra tag for CXX_FLAGS in order to properly build
    STRING(REGEX MATCH "icpc" IS_INTEL "${CMAKE_CXX_COMPILER}")
    if (NOT "${IS_INTEL}" STREQUAL "")
      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMPICH_IGNORE_CXX_SEEK")
117 118
    endif ()
  endif()
119
  option(XDMF_BUILD_DSM_THREADS ON)
120 121 122
  if (XDMF_WRAP_PYTHON)
    mark_as_advanced(FORCE PYTHON_INCLUDE_MPI4PY_DIR)
    set(PYTHON_INCLUDE_MPI4PY_DIR "" CACHE STRING "Directory containing mpi4py/mpi4py.i")
123
  endif ()
124
  add_definitions(-DXDMF_BUILD_DSM)
125
endif()
126

127 128
# If we are wrapping either, we need swig
if(XDMF_WRAP_PYTHON OR XDMF_WRAP_JAVA)
129 130 131 132
  find_package(SWIG REQUIRED)
  include(${SWIG_USE_FILE})
  if(${SWIG_VERSION} LESS 2.0.0)
    message(SEND_ERROR "Swig must be version 2.0.0 or greater")
133 134
  endif()
endif()
135 136 137

# If we are wrapping python, let's include it in the top level
if(XDMF_WRAP_PYTHON)
138 139
  find_package(PythonInterp ${REQUESTED_PYTHON_VERSION} REQUIRED)
  find_package(PythonLibs ${REQUESTED_PYTHON_VERSION} REQUIRED)
140
  if (XDMF_BUILD_DSM)
141 142 143 144 145 146
    find_package (MPI4PY REQUIRED)
    if (MPI4PY_FOUND)
      if ("${PYTHON_INCLUDE_MPI4PY_DIR}" STREQUAL "")
        set(PYTHON_INCLUDE_MPI4PY_DIR ${MPI4PY_INCLUDE_DIR})
      endif ()
    endif ()
147
    include_directories(${PYTHON_INCLUDE_DIRS} ${MPI_CXX_INCLUDE_PATH} ${PYTHON_INCLUDE_MPI4PY_DIR})
148
  else ()
149
    include_directories(${PYTHON_INCLUDE_DIRS})
150
  endif ()
151 152 153 154 155 156 157 158

  # A macro to swig and create the python files
  # Since we essentually do the same thing inside and outside core, it
  # would be easier as a macro
  # Parameters:
  #     python_name = the name of the intended target to be wrapped
  #     ${ARGN} = any dependencies needed by the target
  # Output:
159 160
  #     Target Name = the output target name will have ${python_name} as its name
  macro(XDMF_SWIG_PYTHON python_name)
161
    set(CMAKE_SWIG_OUTDIR ${CMAKE_BINARY_DIR})
162 163
    # optimize swig generation --- these are all flags corresponding to -O
    # except -fvirtual which breaks visitor operation
164
    set(CMAKE_SWIG_FLAGS ${XDMF_SWIG_FLAGS} -modern -fastdispatch -nosafecstrings -noproxydel -fastproxy -fastinit -fastunpack -fastquery -modernargs -nobuildnone)
165 166 167
    #Enables DSM
    if (XDMF_BUILD_DSM)
      set(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} -DXDMF_BUILD_DSM)
168 169
      if (XDMF_BUILD_DSM_THREADS)
        set(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} -DXDMF_BUILD_DSM_THREADS)
170 171
      endif ()
    endif ()
172 173 174
    if (TIFF_FOUND)
      set(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} -DXDMF_BUILD_TIFF)
    endif ()
175
    set_source_files_properties(${python_name}.i PROPERTIES CPLUSPLUS ON)
176
    set(swig_extra_generated_files "")
Andrew J. Burns (Cont's avatar
Andrew J. Burns (Cont committed
177
    swig_add_module(${python_name}Python python ${python_name}.i)
178 179 180 181 182 183 184

    if (NOT APPLE)
      swig_link_libraries(${python_name}Python ${python_name} ${PYTHON_LIBRARIES})
    else ()
      swig_link_libraries(${python_name}Python ${python_name})
    endif ()

185 186
    set_property(DIRECTORY APPEND PROPERTY
      ADDITIONAL_MAKE_CLEAN_FILES
187
      ${CMAKE_CURRENT_BINARY_DIR}/${python_name}.pyc
188
    )
189 190 191

    if("${ARGN}" STRGREATER "")
      add_dependencies(${python_name} "${ARGN}")
192
    endif()
193 194

    if(WIN32)
195
      if(NOT MSVC10)
196
        set_target_properties(${SWIG_MODULE_${python_name}Python_REAL_NAME}
197 198 199
          PROPERTIES
          PREFIX ../
          IMPORT_PREFIX ../
200 201 202
          RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
          LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
          ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
203
      endif()
204
    endif()
205

206 207 208 209 210 211
    if(APPLE)
      set_target_properties(${SWIG_MODULE_${python_name}Python_REAL_NAME}
        PROPERTIES
        LINK_FLAGS "-undefined dynamic_lookup")
    endif()

212 213 214 215
    set_target_properties(${SWIG_MODULE_${python_name}Python_REAL_NAME}
      PROPERTIES
      OUTPUT_NAME "_${python_name}")

216 217 218 219 220
    set(
      PYTHON_INSTALL_DIR
      ${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/xdmf
      )

221 222
    string(TOUPPER ${python_name} python_name_upper)
    set(${python_name_upper}_PYTHON
223
      ${PYTHON_INSTALL_DIR}/${python_name}.py)
224 225 226 227
    get_directory_property(${python_name}Parent PARENT_DIRECTORY)
    if(NOT "${${python_name}Parent}" STREQUAL "")
      set(${python_name_upper}_PYTHON ${${python_name_upper}_PYTHON}
        PARENT_SCOPE)
228
    endif()
229

Joseph G. Hennessey's avatar
Joseph G. Hennessey committed
230
    install(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${python_name}.py
231
      DESTINATION ${PYTHON_INSTALL_DIR})
232
    install(TARGETS ${SWIG_MODULE_${python_name}Python_REAL_NAME}
233
      DESTINATION ${PYTHON_INSTALL_DIR})
234 235
  endmacro()
endif()
236 237 238

# If we are wrapping java, let's include it in the top level
if(XDMF_WRAP_JAVA)
239 240 241 242 243 244 245 246 247 248 249 250 251
  find_package(Java REQUIRED)
  find_package(JNI REQUIRED)
  include_directories(${CMAKE_CURRENT_SOURCE_DIR}
    ${JAVA_INCLUDE_PATH}
    ${JAVA_INCLUDE_PATH2})

  # A macro to swig and create the jar files
  # Since we essentually do the same thing inside and outside core, it
  # would be easier as a macro
  # Parameters:
  #     java_name = the name of the intended target to be wrapped
  #     ${ARGN} = any dependencies needed by the target
  # Output:
252 253 254
  #     Target Name     = the output target name will have ${java_name}Java as its name
  #     Target Jar      = the output target jar will have ${java_name}Java.jar as its name
  macro(XDMF_SWIG_JAVA java_name)
255
    set(${java_name}_JAVA_JAR ${CMAKE_BINARY_DIR}/${java_name}.jar)
256
    set(XDMF_JAVA_PACKAGE_DIR mil/army/arl/xdmf)
257
    set(XDMF_JAVA_DIR ${CMAKE_BINARY_DIR}/${XDMF_JAVA_PACKAGE_DIR})
258
    set(CMAKE_SWIG_OUTDIR ${XDMF_JAVA_DIR})
259
    set(CMAKE_SWIG_FLAGS ${XDMF_SWIG_FLAGS} -v -make_default -package mil.army.arl.xdmf)
260
    set_source_files_properties(${java_name}.i PROPERTIES CPLUSPLUS ON)
261
    set(swig_extra_generated_files "")
262 263 264 265
    swig_add_module(${java_name}Java java ${java_name}.i)
    swig_link_libraries(${java_name}Java ${java_name})

    if(WIN32)
266 267 268 269 270
	  if(NOT MSVC10)
        set_target_properties(${SWIG_MODULE_${java_name}Java_REAL_NAME}
          PROPERTIES
          PREFIX ../
          IMPORT_PREFIX ../
271 272 273 274
          RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
          LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
          ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
	  endif()
275
      set(java_files *.java)
276
      set(java_dest "bin")
277
      set(separator "\;")
278
    else()
279
      set(java_files ${XDMF_JAVA_DIR}/*.java)
280
      set(java_dest "lib/java")
281
      set(separator ":")
282
    endif()
283 284 285 286 287 288 289 290

    add_custom_target(${java_name}_Java_Dir ALL DEPENDS ${XDMF_JAVA_DIR})
    add_custom_command(OUTPUT ${XDMF_JAVA_DIR}
      COMMAND ${CMAKE_COMMAND} -E make_directory ${XDMF_JAVA_DIR})
    add_custom_target(Compiled_${java_name}_Jar ALL DEPENDS
      ${${java_name}_JAVA_JAR})
    add_custom_command(OUTPUT ${${java_name}_JAVA_JAR}
      COMMAND ${CMAKE_COMMAND} -E chdir ${XDMF_JAVA_PACKAGE_DIR}
291
              ${JAVA_COMPILE} -cp \".${java_cp_jars}\" ${java_files}
292 293
      COMMAND ${JAVA_ARCHIVE} -cvf ${${java_name}_JAVA_JAR}
             "${XDMF_JAVA_PACKAGE_DIR}/*.class")
294 295 296 297 298
    add_dependencies(${java_name}Java ${java_name}_Java_Dir)
    add_dependencies(Compiled_${java_name}_Jar ${java_name}Java)

    if(NOT ${ARGN} EQUAL "")
      add_dependencies(Compiled_${java_name}_Jar "${ARGN}")
299
    endif()
300 301 302

    set_property(DIRECTORY APPEND PROPERTY
      ADDITIONAL_MAKE_CLEAN_FILES
303
      ${CMAKE_CURRENT_BINARY_DIR}/${java_name}.jar
304
      ${XDMF_JAVA_DIR})
305

306
    set(java_cp_jars "${java_cp_jars}${separator}${${java_name}_JAVA_JAR}")
307 308 309 310 311 312 313
    string(TOUPPER ${java_name} java_name_upper)
    set(${java_name_upper}_JAVA_JAR
      ${CMAKE_INSTALL_PREFIX}/lib/java/${java_name}.jar)
    get_directory_property(${java_name}Parent PARENT_DIRECTORY)
    if(NOT "${${java_name}Parent}" STREQUAL "")
      set(${java_name_upper}_JAVA_JAR ${${java_name_upper}_JAVA_JAR}
        PARENT_SCOPE)
314
      set(java_cp_jars "${java_cp_jars}" PARENT_SCOPE)
315
    endif()
316

317
    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${java_name}.jar
318 319 320
      DESTINATION lib/java)
    install(TARGETS ${SWIG_MODULE_${java_name}Java_REAL_NAME}
      DESTINATION ${java_dest})
321 322
  endmacro()
endif()
323

324
add_subdirectory(core)
325
include_directories(${XdmfCore_INCLUDE_DIRS} ${XdmfDSM_INCLUDE_DIRS})
326
link_directories(${XDMF_LIBRARY_DIRS})
327

328 329
include(GNUInstallDirs)

330
option(XDMF_BUILD_CORE_ONLY OFF)
331
mark_as_advanced(XDMF_BUILD_CORE_ONLY)
332
if(NOT XDMF_BUILD_CORE_ONLY)
333
  set(XdmfSources
334
    XdmfAggregate
335 336 337 338 339 340 341
    XdmfAttribute
    XdmfAttributeCenter
    XdmfAttributeType
    XdmfCurvilinearGrid
    XdmfDomain
    XdmfGeometry
    XdmfGeometryType
Kenneth Leiter's avatar
Kenneth Leiter committed
342
    XdmfGraph
343 344 345
    XdmfGrid
    XdmfGridCollection
    XdmfGridCollectionType
346
    XdmfGridController
347
    XdmfGridTemplate
348 349 350 351 352 353 354
    XdmfItemFactory
    XdmfMap
    XdmfReader
    XdmfRectilinearGrid
    XdmfRegularGrid
    XdmfSet
    XdmfSetType
355
    XdmfTemplate
356 357 358 359
    XdmfTime
    XdmfTopology
    XdmfTopologyType
    XdmfUnstructuredGrid)
360

361 362
  if(XDMF_STATIC_AND_SHARED)
    add_library(XdmfObjects OBJECT ${XdmfSources})
363 364 365 366 367
    SET_TARGET_PROPERTIES(
      XdmfObjects PROPERTIES
      VERSION ${XDMF_VERSION}
      SOVERSION ${XDMF_MAJOR_VERSION}
      )
368 369 370 371 372
    set_target_properties(XdmfObjects PROPERTIES
      POSITION_INDEPENDENT_CODE True)
    add_library(${XDMF_LIBNAME} $<TARGET_OBJECTS:XdmfObjects>)
    if (BUILD_SHARED_LIBS)
      add_library(Xdmf_Static STATIC $<TARGET_OBJECTS:XdmfObjects>)
373 374 375 376
      set_target_properties(
        Xdmf_Static PROPERTIES
        OUTPUT_NAME "Xdmf"
        )
377 378
    endif (BUILD_SHARED_LIBS)
  else()
379
    add_library(${XDMF_LIBNAME} ${LIBTYPE} ${XdmfSources})
380
  endif()
381 382 383 384 385
  SET_TARGET_PROPERTIES(
    ${XDMF_LIBNAME} PROPERTIES
    VERSION ${XDMF_VERSION}
    SOVERSION ${XDMF_MAJOR_VERSION}
    )
386
  if(XDMF_BUILD_DSM)
David E. DeMarle's avatar
David E. DeMarle committed
387
    target_link_libraries(${XDMF_LIBNAME} XdmfCore XdmfDSM)
388 389 390
    if(XDMF_STATIC_AND_SHARED AND BUILD_SHARED_LIBS)
        target_link_libraries(Xdmf_Static XdmfCore_Static XdmfDSM_Static)
    endif()
391
  else(XDMF_BUILD_DSM)
David E. DeMarle's avatar
David E. DeMarle committed
392
    target_link_libraries(${XDMF_LIBNAME} XdmfCore)
393
    if(XDMF_STATIC_AND_SHARED AND BUILD_SHARED_LIBS)
394
      target_link_libraries(Xdmf_Static XdmfCore_Static)
395
    endif ()
396
  endif(XDMF_BUILD_DSM)
397 398 399
  if (COMMAND vtk_target_install)
    vtk_target_install(${XDMF_LIBNAME})
  endif()
400 401

  if(WIN32)
402 403
    if (BUILD_SHARED_LIBS)
      set_target_properties(${XDMF_LIBNAME} PROPERTIES
404 405 406 407 408
        DEFINE_SYMBOL XDMF_EXPORTS)
      if(XDMF_STATIC_AND_SHARED)
        set_target_properties(Xdmf_Static PROPERTIES
          DEFINE_SYMBOL Xdmf_EXPORTS)
      endif()
409 410
    endif ()
  endif()
411 412

  if(XDMF_WRAP_JAVA)
413 414
    XDMF_SWIG_JAVA(${XDMF_LIBNAME} Compiled_XdmfCore_Jar)
  endif()
415 416

  if(XDMF_WRAP_PYTHON)
417 418 419 420
    if (NOT BUILD_SHARED_LIBS)
      message(FATAL_ERROR "Python Wrappers do not function"
                          " properly without shared libraries")
    endif (NOT BUILD_SHARED_LIBS)
David DeMarle's avatar
David DeMarle committed
421
    if (XDMF_BUILD_DSM)
David DeMarle's avatar
David DeMarle committed
422 423 424 425
      XDMF_SWIG_PYTHON(${XDMF_LIBNAME} XdmfCore XdmfDSM)
    else()
      XDMF_SWIG_PYTHON(${XDMF_LIBNAME} XdmfCore)
    endif()
426 427 428 429
    set(
      XDMF_PYTHON_INSTALL_DIR
      ${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/xdmf
      )
430
  endif()
431

432
  if(XDMF_BUILD_TESTING)
433
    add_subdirectory(tests)
434
  endif()
435 436 437 438

  option(XDMF_BUILD_UTILS OFF)
  if(XDMF_BUILD_UTILS)
    add_subdirectory(utils)
439
  endif()
440

441
  if(WIN32)
442 443
    set(XDMF_LIBRARY ${CMAKE_INSTALL_PREFIX}/lib/${XDMF_LIBNAME}.lib)
  endif()
Nico Schlömer's avatar
Nico Schlömer committed
444

445
  if(UNIX)
446
    if (BUILD_SHARED_LIBS)
447
      set(XDMF_LIBRARY ${CMAKE_INSTALL_LIBDIR}/lib${XDMF_LIBNAME}.so)
448
    else (BUILD_SHARED_LIBS)
449
      set(XDMF_LIBRARY ${CMAKE_INSTALL_LIBDIR}/lib${XDMF_LIBNAME}.a)
450
    endif (BUILD_SHARED_LIBS)
451
  endif(UNIX)
452

453
  if(APPLE)
454
    set(XDMF_LIBRARY ${CMAKE_INSTALL_LIBDIR}/lib${XDMF_LIBNAME}.dylib)
455
  endif()
Nico Schlömer's avatar
Nico Schlömer committed
456 457 458 459 460

  file(GLOB XdmfHeaders
    "*.hpp"
    "*.tpp"
    "*.i"
461
    "CMake/VersionSuite/*.hpp"
462
    "${CMAKE_CURRENT_BINARY_DIR}/*.hpp"
463
  )
464 465 466
  if (NOT XDMF_INSTALL_NO_DEVELOPMENT) 
    install(FILES ${XdmfHeaders} DESTINATION include)
  endif()
467
  install(TARGETS ${XDMF_LIBNAME}
468 469 470
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
471
  if (XDMF_STATIC_AND_SHARED AND BUILD_SHARED_LIBS)
472
    install(TARGETS Xdmf_Static
473 474 475
      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
      LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
476
  endif()
477
endif()
478

479 480 481 482 483 484
if(WIN32 AND NOT CYGWIN)
  set(DEF_INSTALL_CMAKE_DIR CMake)
else()
  set(DEF_INSTALL_CMAKE_DIR
    "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
endif()
485
xdmf_create_config_file(${PROJECT_NAME})
486
install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
487
  DESTINATION ${DEF_INSTALL_CMAKE_DIR})