Skip to content

Commit 99cc28b

Browse files
committed
Revert "[CMake] Use explicit header path when using in-tree libc++ for tests"
This reverts commit 61b410c as this appears to have broken some sanitizer tests.
1 parent 61b410c commit 99cc28b

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

compiler-rt/CMakeLists.txt

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -521,17 +521,6 @@ string(REGEX REPLACE "-stdlib=[a-zA-Z+]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}
521521
list(APPEND COMPILER_RT_COMMON_CFLAGS ${stdlib_flag})
522522
list(APPEND COMPILER_RT_COMMON_LINK_FLAGS ${stdlib_flag})
523523

524-
# TODO: There's a lot of duplication across lib/*/tests/CMakeLists.txt files,
525-
# move some of the common flags to COMPILER_RT_UNITTEST_CFLAGS.
526-
527-
# Unittests need access to C++ standard library.
528-
string(APPEND COMPILER_RT_TEST_COMPILER_CFLAGS " ${stdlib_flag}")
529-
530-
# When cross-compiling, COMPILER_RT_TEST_COMPILER_CFLAGS help in compilation
531-
# and linking of unittests.
532-
string(REPLACE " " ";" COMPILER_RT_UNITTEST_CFLAGS "${COMPILER_RT_TEST_COMPILER_CFLAGS}")
533-
set(COMPILER_RT_UNITTEST_LINK_FLAGS ${COMPILER_RT_UNITTEST_CFLAGS})
534-
535524
if(COMPILER_RT_USE_LLVM_UNWINDER)
536525
if (COMPILER_RT_ENABLE_STATIC_UNWINDER)
537526
set(unwinder_target unwind_static)
@@ -594,18 +583,25 @@ if (SANITIZER_TEST_CXX_LIBNAME STREQUAL "libc++")
594583
else()
595584
set(cxx_target cxx_shared)
596585
endif()
597-
list(APPEND SANITIZER_TEST_CXX_LIBRARIES "$<$<TARGET_EXISTS:${cxx_target}>:$<TARGET_LINKER_FILE:${cxx_target}>>")
598-
list(APPEND SANITIZER_TEST_CXX_CFLAGS "$<$<TARGET_EXISTS:cxx-headers>:-isystem$<JOIN:$<TARGET_PROPERTY:cxx-headers,INTERFACE_INCLUDE_DIRECTORIES>,$<SEMICOLON>-isystem>>")
599-
# We are using the in tree libc++ so avoid including the default one.
600-
append_list_if(COMPILER_RT_HAS_NOSTDINCXX_FLAG -nostdinc++ COMPILER_RT_UNITTEST_CFLAGS)
601-
append_list_if(COMPILER_RT_HAS_NOSTDLIBXX_FLAG -nostdlib++ COMPILER_RT_UNITTEST_LINK_FLAGS)
586+
list(APPEND SANITIZER_TEST_CXX_LIBRARIES "$<$<BOOL:$<TARGET_NAME_IF_EXISTS:${cxx_target}>>:$<TARGET_LINKER_FILE:${cxx_target}>>")
602587
else()
603588
append_list_if(COMPILER_RT_HAS_LIBCXX -lc++ SANITIZER_TEST_CXX_LIBRARIES)
604589
endif()
605590
elseif (SANITIZER_TEST_CXX_LIBNAME STREQUAL "libstdc++")
606591
append_list_if(COMPILER_RT_HAS_LIBSTDCXX -lstdc++ SANITIZER_TEST_CXX_LIBRARIES)
607592
endif()
608593

594+
# TODO: There's a lot of duplication across lib/*/tests/CMakeLists.txt files,
595+
# move some of the common flags to COMPILER_RT_UNITTEST_CFLAGS.
596+
597+
# Unittests need access to C++ standard library.
598+
string(APPEND COMPILER_RT_TEST_COMPILER_CFLAGS " ${stdlib_flag}")
599+
600+
# When cross-compiling, COMPILER_RT_TEST_COMPILER_CFLAGS help in compilation
601+
# and linking of unittests.
602+
string(REPLACE " " ";" COMPILER_RT_UNITTEST_CFLAGS "${COMPILER_RT_TEST_COMPILER_CFLAGS}")
603+
set(COMPILER_RT_UNITTEST_LINK_FLAGS ${COMPILER_RT_UNITTEST_CFLAGS})
604+
609605
# Unittests support.
610606
set(COMPILER_RT_GTEST_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest)
611607
set(COMPILER_RT_GTEST_SOURCE ${COMPILER_RT_GTEST_PATH}/src/gtest-all.cc)

compiler-rt/lib/memprof/tests/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ include(CompilerRTLink)
44

55
set(MEMPROF_UNITTEST_CFLAGS
66
${COMPILER_RT_UNITTEST_CFLAGS}
7-
${SANITIZER_TEST_CXX_CFLAGS}
87
${COMPILER_RT_GTEST_CFLAGS}
98
${COMPILER_RT_GMOCK_CFLAGS}
109
-I${COMPILER_RT_SOURCE_DIR}/lib/

compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ set_target_properties(ScudoUnitTests PROPERTIES
66

77
set(SCUDO_UNITTEST_CFLAGS
88
${COMPILER_RT_UNITTEST_CFLAGS}
9-
${SANITIZER_TEST_CXX_CFLAGS}
109
${COMPILER_RT_GTEST_CFLAGS}
1110
-I${COMPILER_RT_SOURCE_DIR}/include
1211
-I${COMPILER_RT_SOURCE_DIR}/lib

compiler-rt/lib/tsan/tests/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ set_target_properties(TsanUnitTests PROPERTIES
66

77
set(TSAN_UNITTEST_CFLAGS
88
${COMPILER_RT_UNITTEST_CFLAGS}
9-
${SANITIZER_TEST_CXX_CFLAGS}
109
${COMPILER_RT_GTEST_CFLAGS}
1110
-I${COMPILER_RT_SOURCE_DIR}/include
1211
-I${COMPILER_RT_SOURCE_DIR}/lib

0 commit comments

Comments
 (0)