target_enable_zoltan.cmake 1013 Bytes
Newer Older
1 2
macro(target_enable_zoltan _TARGET_ _SCOPE_)
    if (${ARGC} GREATER 2)
3 4 5 6
      set(LINK_EXECUTABLE ON)
    else ()
      set(LINK_EXECUTABLE OFF)
    endif ()
7

8 9 10 11 12 13 14
    find_file(ZOLTAN_HEADER_FILE "zoltan_cpp.h" HINTS ${ZOLTAN_DIR}/include ${PETSC_INCLUDE_DIRS})
    if (ZOLTAN_HEADER_FILE)
      get_filename_component(ZOLTAN_HEADER_DIR "${ZOLTAN_HEADER_FILE}" PATH CACHE)
      target_include_directories(${_TARGET_} ${_SCOPE_} ${ZOLTAN_HEADER_DIR})
    else()
      message(FATAL_ERROR "Could not find Zoltan include file 'zoltan_cpp.h'!")
    endif(ZOLTAN_HEADER_FILE)
15

16 17 18 19 20 21
    if (LINK_EXECUTABLE)
      find_library(ZOLTAN_LIB zoltan
        HINTS ENV LIBRARY_PATH DOC "Full path to the zoltan library")
      if (NOT ZOLTAN_LIB)
        message(FATAL_ERROR "Could not find zoltan library!")
      endif (NOT ZOLTAN_LIB)
22
      target_link_libraries(${_TARGET_} ${_SCOPE_} ${ZOLTAN_LIB})
23
    endif (LINK_EXECUTABLE)
24 25 26

    target_compile_definitions(${_TARGET_} ${_SCOPE_} HAVE_ZOLTAN=1)
endmacro(target_enable_zoltan)