From 94d5f118db668b410d7be422792a5c7e597e8a13 Mon Sep 17 00:00:00 2001 From: Laurent Aphecetche Date: Wed, 20 Jan 2021 18:08:38 +0100 Subject: [PATCH] [O2-1977][CMake](fix) Filter out macros in build directory if any --- cmake/O2GetListOfMacros.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/O2GetListOfMacros.cmake b/cmake/O2GetListOfMacros.cmake index d032e24a506ad..2f8402f88a3c6 100644 --- a/cmake/O2GetListOfMacros.cmake +++ b/cmake/O2GetListOfMacros.cmake @@ -18,5 +18,9 @@ function(o2_get_list_of_macros dir varname) file(GLOB_RECURSE listOfMacros RELATIVE ${CMAKE_SOURCE_DIR} ${dir}/*.C) # Case sensitive filtering of .C files (to avoid .c files on Mac) list(FILTER listOfMacros INCLUDE REGEX "^.*\\.C$") + # Remove macros that were copied to the build directory, to deal with + # the (non-recommended-but-can-happen) case where the build directory + # is a subdirectory of the source dir + list(FILTER listOfMacros EXCLUDE REGEX "/stage/${CMAKE_INSTALL_DATADIR}") set(${varname} ${listOfMacros} PARENT_SCOPE) endfunction()