@PACKAGE_INIT@

set(@PROJECT_NAME@_VERSION "@PROJECT_VERSION@")
set_and_check(@PROJECT_NAME@_INSTALL_PREFIX "${PACKAGE_PREFIX_DIR}")
set_and_check(@PROJECT_NAME@_INC_DIR "${PACKAGE_PREFIX_DIR}/include")
set_and_check(@PROJECT_NAME@_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")
set_and_check(@PROJECT_NAME@_LIB_DIR "${PACKAGE_PREFIX_DIR}/lib")
set_and_check(@PROJECT_NAME@_LIBRARY_DIR "${PACKAGE_PREFIX_DIR}/lib")

set(@PROJECT_NAME@_LIB gctl)
set(@PROJECT_NAME@_LIBRARY gctl)

set(@PROJECT_NAME@_NETCDF @GCTL_NETCDF@)
set(@PROJECT_NAME@_FFTW3 @GCTL_FFTW3@)
set(@PROJECT_NAME@_EEMD @GCTL_EEMD@)
set(@PROJECT_NAME@_OPENMP @GCTL_OPENMP@)
set(@PROJECT_NAME@_OPENBLAS @GCTL_OPENBLAS@)
set(@PROJECT_NAME@_EXPRTK @GCTL_EXPRTK@)
set(@PROJECT_NAME@_CHECK_BOUNDER @GCTL_CHECK_BOUNDER@)
set(@PROJECT_NAME@_CHECK_SIZE @GCTL_CHECK_SIZE@)

message(STATUS "[GCTL] Use the NetCDF library: " @GCTL_NETCDF@)
message(STATUS "[GCTL] Use the FFTW3 library: " @GCTL_FFTW3@)
message(STATUS "[GCTL] Use the EEMD library: " @GCTL_EEMD@)
message(STATUS "[GCTL] Use the OpenMP library: " @GCTL_OPENMP@)
message(STATUS "[GCTL] Use the Openblas library: " @GCTL_OPENBLAS@)
message(STATUS "[GCTL] Use the ExprTK library: " @GCTL_EXPRTK@)
message(STATUS "[GCTL] Check Bounder: " @GCTL_CHECK_BOUNDER@)
message(STATUS "[GCTL] Check Size: " @GCTL_CHECK_SIZE@)

set(CMAKE_CXX_STANDARD 11)

if(@PROJECT_NAME@_NETCDF)
    if(NOT netCDF_FOUND)
        find_package(netCDF REQUIRED)
        include_directories(${netCDF_INCLUDE_DIR})
    endif()
    
    if(NOT netCDF_CXX_LEGACY_FOUND)
        find_package(netCDF_CXX_LEGACY REQUIRED)
        include_directories(${netCDF_CXX_LEGACY_INC_DIR})
    endif()
endif()

if(@PROJECT_NAME@_FFTW3)
    if(NOT FFTW3_FOUND)
        find_package(FFTW3 REQUIRED)
        include_directories(${FFTW3_INC_DIR})
    endif()
endif()

if(@PROJECT_NAME@_EEMD)
    if(NOT EEMD_FOUND)
        find_package(EEMD REQUIRED)
        include_directories(${EEMD_INC_DIR})
    endif()
endif()

if(@PROJECT_NAME@_OPENBLAS)
    if(NOT OpenBLAS_FOUND)
        find_package(OpenBLAS REQUIRED)
        include_directories(${OpenBLAS_INCLUDE_DIRS})
    endif()
endif()

if(@PROJECT_NAME@_OPENMP)
    if(NOT OpenMP_CXX_FOUND)
        find_package(OpenMP REQUIRED)
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
        include_directories(${OpenMP_CXX_INCLUDE_DIRS})
    endif()
endif()

# include target information
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")

check_required_components(@PROJECT_NAME@)