ThirdPartyLoki.cmake 1.44 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
########################################################################
#
# ThirdParty configuration for Nektar++
#
# Loki headers library
#
########################################################################

# Try to find system Loki headers. Hint /opt/local/include for MacPorts
# (although there is no Portfile for Loki currently).
11
FIND_PATH(LOKI_INCLUDE_DIR loki/Singleton.h PATHS /opt/local/include)
12 13 14 15 16 17 18

IF (LOKI_INCLUDE_DIR)
    SET(BUILD_LOKI OFF)
ELSE()
    SET(BUILD_LOKI ON)
ENDIF()

19
OPTION(THIRDPARTY_BUILD_LOKI
20
    "Download and extract Loki library to ThirdParty." ${BUILD_LOKI})
21 22

IF (THIRDPARTY_BUILD_LOKI)
23
    # Download Loki if it doesn't already exist.
24
    IF (NOT EXISTS ${TPSRC}/loki-0.1.3.tar.bz2)
25
        FILE(DOWNLOAD ${TPURL}/loki-0.1.3.tar.bz2 ${TPSRC}/loki-0.1.3.tar.bz2)
26
    ENDIF()
27 28 29 30

    # TODO: Check hashes.
    
    # Extract.
31
    EXECUTE_PROCESS(
32 33
        COMMAND ${CMAKE_COMMAND} -E tar jxf ${TPSRC}/loki-0.1.3.tar.bz2
        WORKING_DIRECTORY ${TPSRC}
34
    )
35 36

    # Set LOKI_INCLUDE_DIR.
Dave Moxey's avatar
Dave Moxey committed
37
    FILE(COPY ${TPSRC}/loki-0.1.3/include/loki/ DESTINATION ${TPDIST}/include/loki/)
38 39 40 41 42 43 44
    SET(LOKI_INCLUDE_DIR ${TPDIST}/include CACHE PATH "" FORCE)

    MESSAGE(STATUS "Build Loki: ${LOKI_INCLUDE_DIR}")
    SET(LOKI_CONFIG_INCLUDE_DIR ${TPINC})
ELSE()
    MESSAGE(STATUS "Found Loki: ${LOKI_INCLUDE_DIR}")
    SET(LOKI_CONFIG_INCLUDE_DIR ${LOKI_INCLUDE_DIR})
45 46
ENDIF()

47
INCLUDE_DIRECTORIES(SYSTEM ${LOKI_INCLUDE_DIR})
48
MARK_AS_ADVANCED(LOKI_INCLUDE_DIR)