From ab9b9a083d5b52c9e156606ff499eab8dd26d0e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leo=20Nikkil=C3=A4?= Date: Tue, 4 Jul 2023 22:06:44 +0300 Subject: [PATCH] Fix CMake build in `test` subdirectories Due to the regexes, ortools_pdlp fails to build if any of its parent directories starts with `test` or `gtest`: CMake Error at test/ortools-src/ortools/pdlp/CMakeLists.txt:27 (add_library): No SOURCES given to target: ortools_pdlp --- ortools/pdlp/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ortools/pdlp/CMakeLists.txt b/ortools/pdlp/CMakeLists.txt index 73f4cf35f6d..3975b8cb7db 100644 --- a/ortools/pdlp/CMakeLists.txt +++ b/ortools/pdlp/CMakeLists.txt @@ -16,9 +16,9 @@ if(NOT USE_PDLP) endif() file(GLOB _SRCS "*.h" "*.cc") -list(FILTER _SRCS EXCLUDE REGEX ".*/.*_test.cc") -list(FILTER _SRCS EXCLUDE REGEX ".*/gtest.*") -list(FILTER _SRCS EXCLUDE REGEX ".*/test.*") +list(FILTER _SRCS EXCLUDE REGEX "/[^/]*_test\\.cc$") +list(FILTER _SRCS EXCLUDE REGEX "/gtest[^/]*$") +list(FILTER _SRCS EXCLUDE REGEX "/test[^/]*$") set(NAME ${PROJECT_NAME}_pdlp)