if(NOT DEFINED HOUDINI_ROOT)
	if (NOT DEFINED ENV{HOUDINI_ROOT})
	    message(FATAL_ERROR "Specify HOUDINI_ROOT")
	endif()
    set(HOUDINI_ROOT $ENV{HOUDINI_ROOT})
endif()

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
    message(STATUS "Setting CMAKE_INSTALL_PREFIX to HOUDINI_ROOT - ${HOUDINI_ROOT}")
    set(HOUDINI_INSTALL_PREFIX ${HOUDINI_ROOT})
    if(APPLE)
        set(HOUDINI_INSTALL_PREFIX ${HOUDINI_ROOT}/..)
    endif()
    set(CMAKE_INSTALL_PREFIX "${HOUDINI_INSTALL_PREFIX}" CACHE PATH "..." FORCE)
endif()

set(HOUDINI_INCLUDE_DIR ${HOUDINI_ROOT}/toolkit/include)
set(HOUDINI_RESOURCE_DIR_RELPATH ".")
if(WIN32)
    set(HOUDINI_PLUGIN_INSTALL_RELPATH bin)
    set(HOUDINI_LIB ${HOUDINI_ROOT}/custom/houdini/dsolib)
elseif(APPLE)
    set(HOUDINI_PLUGIN_INSTALL_RELPATH Libraries)
    set(HOUDINI_LIB ${HOUDINI_ROOT}/../Libraries)
    set(HOUDINI_RESOURCE_DIR_RELPATH "Resources")
else()
    set(HOUDINI_PLUGIN_INSTALL_RELPATH dsolib)
    set(HOUDINI_LIB ${HOUDINI_ROOT}/dsolib)
endif()
add_definitions(-DBUILD_AS_HOUDINI_PLUGIN)

list(APPEND CMAKE_PREFIX_PATH ${HOUDINI_LIB} ${HOUDINI_INCLUDE_DIR})
