[libcxx-commits] [PATCH] D128035: [CMake] Use explicit header path when using in-tree libc++ for tests
Petr Hosek via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 8 20:19:06 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG61b410cb8b9a: [CMake] Use explicit header path when using in-tree libc++ for tests (authored by phosek).
Changed prior to commit:
https://reviews.llvm.org/D128035?vs=437816&id=443408#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128035/new/
https://reviews.llvm.org/D128035
Files:
compiler-rt/CMakeLists.txt
compiler-rt/lib/memprof/tests/CMakeLists.txt
compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
compiler-rt/lib/tsan/tests/CMakeLists.txt
Index: compiler-rt/lib/tsan/tests/CMakeLists.txt
===================================================================
--- compiler-rt/lib/tsan/tests/CMakeLists.txt
+++ compiler-rt/lib/tsan/tests/CMakeLists.txt
@@ -6,6 +6,7 @@
set(TSAN_UNITTEST_CFLAGS
${COMPILER_RT_UNITTEST_CFLAGS}
+ ${SANITIZER_TEST_CXX_CFLAGS}
${COMPILER_RT_GTEST_CFLAGS}
-I${COMPILER_RT_SOURCE_DIR}/include
-I${COMPILER_RT_SOURCE_DIR}/lib
Index: compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
===================================================================
--- compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
+++ compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
@@ -6,6 +6,7 @@
set(SCUDO_UNITTEST_CFLAGS
${COMPILER_RT_UNITTEST_CFLAGS}
+ ${SANITIZER_TEST_CXX_CFLAGS}
${COMPILER_RT_GTEST_CFLAGS}
-I${COMPILER_RT_SOURCE_DIR}/include
-I${COMPILER_RT_SOURCE_DIR}/lib
Index: compiler-rt/lib/memprof/tests/CMakeLists.txt
===================================================================
--- compiler-rt/lib/memprof/tests/CMakeLists.txt
+++ compiler-rt/lib/memprof/tests/CMakeLists.txt
@@ -4,6 +4,7 @@
set(MEMPROF_UNITTEST_CFLAGS
${COMPILER_RT_UNITTEST_CFLAGS}
+ ${SANITIZER_TEST_CXX_CFLAGS}
${COMPILER_RT_GTEST_CFLAGS}
${COMPILER_RT_GMOCK_CFLAGS}
-I${COMPILER_RT_SOURCE_DIR}/lib/
Index: compiler-rt/CMakeLists.txt
===================================================================
--- compiler-rt/CMakeLists.txt
+++ compiler-rt/CMakeLists.txt
@@ -521,6 +521,17 @@
list(APPEND COMPILER_RT_COMMON_CFLAGS ${stdlib_flag})
list(APPEND COMPILER_RT_COMMON_LINK_FLAGS ${stdlib_flag})
+# TODO: There's a lot of duplication across lib/*/tests/CMakeLists.txt files,
+# move some of the common flags to COMPILER_RT_UNITTEST_CFLAGS.
+
+# Unittests need access to C++ standard library.
+string(APPEND COMPILER_RT_TEST_COMPILER_CFLAGS " ${stdlib_flag}")
+
+# When cross-compiling, COMPILER_RT_TEST_COMPILER_CFLAGS help in compilation
+# and linking of unittests.
+string(REPLACE " " ";" COMPILER_RT_UNITTEST_CFLAGS "${COMPILER_RT_TEST_COMPILER_CFLAGS}")
+set(COMPILER_RT_UNITTEST_LINK_FLAGS ${COMPILER_RT_UNITTEST_CFLAGS})
+
if(COMPILER_RT_USE_LLVM_UNWINDER)
if (COMPILER_RT_ENABLE_STATIC_UNWINDER)
set(unwinder_target unwind_static)
@@ -583,7 +594,11 @@
else()
set(cxx_target cxx_shared)
endif()
- list(APPEND SANITIZER_TEST_CXX_LIBRARIES "$<$<BOOL:$<TARGET_NAME_IF_EXISTS:${cxx_target}>>:$<TARGET_LINKER_FILE:${cxx_target}>>")
+ list(APPEND SANITIZER_TEST_CXX_LIBRARIES "$<$<TARGET_EXISTS:${cxx_target}>:$<TARGET_LINKER_FILE:${cxx_target}>>")
+ list(APPEND SANITIZER_TEST_CXX_CFLAGS "$<$<TARGET_EXISTS:cxx-headers>:-isystem$<JOIN:$<TARGET_PROPERTY:cxx-headers,INTERFACE_INCLUDE_DIRECTORIES>,$<SEMICOLON>-isystem>>")
+ # We are using the in tree libc++ so avoid including the default one.
+ append_list_if(COMPILER_RT_HAS_NOSTDINCXX_FLAG -nostdinc++ COMPILER_RT_UNITTEST_CFLAGS)
+ append_list_if(COMPILER_RT_HAS_NOSTDLIBXX_FLAG -nostdlib++ COMPILER_RT_UNITTEST_LINK_FLAGS)
else()
append_list_if(COMPILER_RT_HAS_LIBCXX -lc++ SANITIZER_TEST_CXX_LIBRARIES)
endif()
@@ -591,17 +606,6 @@
append_list_if(COMPILER_RT_HAS_LIBSTDCXX -lstdc++ SANITIZER_TEST_CXX_LIBRARIES)
endif()
-# TODO: There's a lot of duplication across lib/*/tests/CMakeLists.txt files,
-# move some of the common flags to COMPILER_RT_UNITTEST_CFLAGS.
-
-# Unittests need access to C++ standard library.
-string(APPEND COMPILER_RT_TEST_COMPILER_CFLAGS " ${stdlib_flag}")
-
-# When cross-compiling, COMPILER_RT_TEST_COMPILER_CFLAGS help in compilation
-# and linking of unittests.
-string(REPLACE " " ";" COMPILER_RT_UNITTEST_CFLAGS "${COMPILER_RT_TEST_COMPILER_CFLAGS}")
-set(COMPILER_RT_UNITTEST_LINK_FLAGS ${COMPILER_RT_UNITTEST_CFLAGS})
-
# Unittests support.
set(COMPILER_RT_GTEST_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest)
set(COMPILER_RT_GTEST_SOURCE ${COMPILER_RT_GTEST_PATH}/src/gtest-all.cc)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128035.443408.patch
Type: text/x-patch
Size: 3963 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220709/536b6ea7/attachment.bin>
More information about the libcxx-commits
mailing list