fixed older CMake versions using PATH instead of DIRECTORY in get_filename_component()

This commit is contained in:
Markus Makela 2014-09-25 22:24:43 +03:00
parent 5bef5d8f53
commit af5eab238d

View File

@ -212,9 +212,14 @@ endmacro()
function(subdirs VAR DIRPATH)
if(${CMAKE_VERSION} VERSION_LESS 2.12 )
set(COMP_VAR PATH)
else()
set(COMP_VAR DIRECTORY)
endif()
file(GLOB_RECURSE SDIR ${DIRPATH}/*)
foreach(LOOP ${SDIR})
get_filename_component(LOOP ${LOOP} DIRECTORY)
get_filename_component(LOOP ${LOOP} ${COMP_VAR})
list(APPEND ALLDIRS ${LOOP})
endforeach()
list(REMOVE_DUPLICATES ALLDIRS)