
INCLUDE (FindPackageHandleStandardArgs)

FIND_PACKAGE ( PkgConfig )

SET( NOWPAC_NLOPT_INCLUDE_PATH_SEARCH "NOWPAC_NLOPT_INCLUDE_PATH_SEARCH-NOTFOUND" )
FIND_PATH ( NOWPAC_NLOPT_INCLUDE_PATH_SEARCH "nlopt.h"          
            PATHS "${NOWPAC_NLOPT_INCLUDE_PATH}"
                  "${CMAKE_INSTALL_PREFIX}/nowpac/external/nlopt/include/"
                  "${NOWPAC_INSTALL_PREFIX}/nowpac/external/nlopt/include/"
                  "${NOWPAC_NLOPT_LIBRARY_PATH}/../include/" )

SET( NOWPAC_NLOPT_LIBRARY_PATH_SEARCH "NOWPAC_NLOPT_LIBRARY_PATH_SEARCH-NOTFOUND" )
FIND_PATH ( NOWPAC_NLOPT_LIBRARY_PATH_SEARCH "libnlopt.${NOWPAC_SHARED_LIBRARY_EXTENSION}" 
            PATHS "${NOWPAC_NLOPT_LIBRARY_PATH}/"
                  "${CMAKE_INSTALL_PREFIX}/nowpac/external/nlopt/lib/"
                  "${NOWPAC_INSTALL_PREFIX}/nowpac/external/nlopt/lib/"
                  "${NOWPAC_NLOPT_INCLUDE_PATH}/../lib/" )

IF ( ${NOWPAC_NLOPT_INCLUDE_PATH_SEARCH} STREQUAL "NOWPAC_NLOPT_INCLUDE_PATH_SEARCH-NOTFOUND" )
    SET( NOWPAC_NLOPT_INCLUDE_PATH "NOWPAC_NLOPT_INCLUDE_PATH-NOTFOUND" )
ELSE ()
    SET( NOWPAC_NLOPT_INCLUDE_PATH ${NOWPAC_NLOPT_INCLUDE_PATH_SEARCH} )
ENDIF ()
IF ( ${NOWPAC_NLOPT_LIBRARY_PATH_SEARCH} STREQUAL "NOWPAC_NLOPT_LIBRARY_PATH_SEARCH-NOTFOUND" )
    SET( NOWPAC_NLOPT_LIBRARY_PATH "NOWPAC_NLOPT_LIBRARY_PATH-NOTFOUND" )
ELSE ()
    SET( NOWPAC_NLOPT_LIBRARY_PATH ${NOWPAC_NLOPT_LIBRARY_PATH_SEARCH} )
ENDIF ()

FIND_PACKAGE_HANDLE_STANDARD_ARGS( NLOPT DEFAULT_MSG NOWPAC_NLOPT_INCLUDE_PATH NOWPAC_NLOPT_LIBRARY_PATH)

