Skip to content

Commit 20a742c

Browse files
authored
[openmp][cmake] Don't glob for build dependencies (#165231)
LLVM's cmake standard explicitly lists all source in the CMakeLists.txt. Remove globbing for source files in OpenMP's CMakeLists.txt. Also see #4899, #71404, https://reviews.llvm.org/D79906, https://reviews.llvm.org/D31363, https://reviews.llvm.org/D61275, https://discourse.llvm.org/t/cmake-builds-clang/11536, and CMake's note at https://cmake.org/cmake/help/latest/command/file.html#glob. Two reasons to not glob for source files is that it breaks bisecting and incremental builds. Renaming a file, reverting or checking out an older reversion where a newly added source file disappears again will not trigger a CMake configure step and make the build fail because of a non-existing source file.
1 parent f29235d commit 20a742c

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

openmp/tools/CMakeLists.txt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
# Discover the tools that use CMake in the subdirectories.
2-
# Note that explicit cmake invocation is required every time a new tool
3-
# is added or removed.
4-
file(GLOB entries *)
5-
foreach(entry ${entries})
6-
if(IS_DIRECTORY ${entry} AND EXISTS ${entry}/CMakeLists.txt)
7-
add_subdirectory(${entry})
8-
endif()
9-
endforeach(entry)
1+
add_subdirectory(archer)
2+
add_subdirectory(Modules)
3+
add_subdirectory(multiplex)
4+
add_subdirectory(omptest)

openmp/tools/omptest/test/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
##===----------------------------------------------------------------------===##
66

77
# Target: ompTest library unit tests
8-
file(GLOB UNITTEST_SOURCES "unittests/*.cpp")
8+
set(UNITTEST_SOURCES
9+
unittests/asserter-seq-test.cpp
10+
unittests/internal-event-eq-test.cpp
11+
unittests/internal-event-tostring-test.cpp
12+
unittests/internal-util-test
13+
unittests/main-test.cpp
14+
)
915
add_executable(omptest-unittests ${UNITTEST_SOURCES})
1016

1117
# Add local and LLVM-provided GoogleTest include directories.

0 commit comments

Comments
 (0)