# A cmake script that searches for GPTL library 
# If we were to include this directory (cmake), when we do 
# FIND_PACKAGE(foo), it will search for the file Findfoo.cmake


INCLUDE(FindPackageHandleStandardArgs)

# Checks the environmental variable
if(GPTL_DIR)
	# Use the hint provided
	list(APPEND CMAKE_PREFIX_PATH ${GPTL_DIR})
endif() 

find_path(
    GPTL_INCLUDE_DIR 
        gptl.h
    HINTS
        ${GPTL_DIR}
)

find_library(GPTL_LIBRARY GPTL
	NAMES libgptl.a gptl
	HINTS ${GPTL_DIR}
)

find_package_handle_standard_args( GPTL DEFAULT_MSG
  GPTL_INCLUDE_DIR
  GPTL_LIBRARY
)

if (GPTL_FOUND)
    SET( GPTL_INCLUDE_DIRS ${GPTL_INCLUDE_DIR} )
    SET( GPTL_LIBRARIES ${GPTL_LIBRARY} )
    message("Found GPTL. GPTL_LIBRARY: ${GPTL_LIBRARIES}. GPTL_INCLUDE_DIRS: ${GPTL_INCLUDE_DIRS}.")
endif()