From af5eab238dbd1978c4a76165a880099f6e039208 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Thu, 25 Sep 2014 22:24:43 +0300 Subject: [PATCH] fixed older CMake versions using PATH instead of DIRECTORY in get_filename_component() --- macros.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/macros.cmake b/macros.cmake index caa81f7b6..7e3e5d250 100644 --- a/macros.cmake +++ b/macros.cmake @@ -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)