Use get_filename_component(PATH) instead of get_filename_component(DIRECTORY)

get_filename_component(DIRECTORY) is available only on CMake 2.8.12 or later
Fix elseif instead of if
AppVeyor test
AppVeyor test
AppVeyor test
AppVeyor test
AppVeyor test