@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_potential)
set(@PROJECT_NAME@_LIBRARY gctl_potential)

set(@PROJECT_NAME@_FFTW3 @GCTL_POTENTIAL_FFTW3@)
set(@PROJECT_NAME@_TESS @GCTL_POTENTIAL_TESS@)
set(@PROJECT_NAME@_MAGTESS @GCTL_POTENTIAL_MAGTESS@)
set(@PROJECT_NAME@_OPENMP @GCTL_POTENTIAL_OPENMP@)
set(@PROJECT_NAME@_AUTODIFF @GCTL_POTENTIAL_AUTODIFF@)

message(STATUS "[GCTL_POTENTIAL] Use the FFTW3 library: " @GCTL_POTENTIAL_FFTW3@)
message(STATUS "[GCTL_POTENTIAL] Use the Tess library: " @GCTL_POTENTIAL_TESS@)
message(STATUS "[GCTL_POTENTIAL] Use the MagTess library: " @GCTL_POTENTIAL_MAGTESS@)
message(STATUS "[GCTL_POTENTIAL] Use the OpenMP library:" @GCTL_POTENTIAL_OPENMP@)
message(STATUS "[GCTL_POTENTIAL] Use the autodiff library:" @GCTL_POTENTIAL_AUTODIFF@)

if(NOT GCTL_FOUND)
    find_package(GCTL REQUIRED)
    include_directories(${GCTL_INC_DIR})
endif()

if(NOT GCTL_MESH_FOUND)
    find_package(GCTL_MESH REQUIRED)
    include_directories(${GCTL_MESH_INC_DIR})
endif()

if(NOT GCTL_OPTIMIZATION_FOUND)
    find_package(GCTL_OPTIMIZATION REQUIRED)
    include_directories(${GCTL_OPTIMIZATION_INC_DIR})
endif()

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

if(@PROJECT_NAME@_TESS)
    if(NOT LibTess_FOUND)
        find_package(LibTess REQUIRED)
        include_directories(${LibTess_INC_DIR})
    endif()
endif()

if(@PROJECT_NAME@_MAGTESS)
    if(NOT LibMagTess_FOUND)
        find_package(LibMagTess REQUIRED)
        include_directories(${LibMagTess_INC_DIR})
    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()

if(@PROJECT_NAME@_AUTODIFF)
	if(NOT autodiff_FOUND)
		find_package(Eigen3 REQUIRED)
		if(EIGEN3_FOUND)
			include_directories(${EIGEN3_INCLUDE_DIR})
		endif()

		find_package(autodiff REQUIRED)
	endif()
endif()

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

check_required_components(@PROJECT_NAME@)