# See if we have env vars to help us find 3rd-party libs
function(FINDLIBHOME VAR)
    IF(${VAR})
        set(${VAR}_TEMP ${${VAR}})
    ELSE()
        set(${VAR}_TEMP $ENV{${VAR}})
        if (NOT ${VAR}_TEMP)
            set(${VAR}_TEMP "NOT FOUND")
        endif()
    ENDIF()
    string( REGEX REPLACE "\\\\" "/" ${VAR}_TEMP ${${VAR}_TEMP} )
    set(${VAR} ${${VAR}_TEMP} CACHE PATH "var ${VAR} in env." FORCE)
endfunction()


MACRO(SUBDIRLIST result curdir)
  FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
  SET(dirlist "")
  FOREACH(child ${children})
    IF(IS_DIRECTORY ${curdir}/${child})
      LIST(APPEND dirlist ${child})
    ENDIF()
  ENDFOREACH()
  SET(${result} ${dirlist})
ENDMACRO()