atanasyan added a comment. In D56836#1361528 <https://reviews.llvm.org/D56836#1361528>, @abeserminji wrote:
> I am not sure if -static option passed as --cflag to lnt runtest enters the > LDFLAGS. I guess it doesn't. > But if there is a way to check which options are passed as --cflags, we > might be able to add -Wl, -whole-archive -lpthread -Wl -no-whole-archive only > in case when static is used. > That would be my preferable option in this situation, but I couldn't find > any clues on how to do that. You are right, LDFLAGS does not contain the `-static`. But if you pass linker options to the CMake by the `CMAKE_EXE_LINKER_FLAGS` variable, the following code should help. --- a/SingleSource/UnitTests/C++11/CMakeLists.txt +++ b/SingleSource/UnitTests/C++11/CMakeLists.txt @@ -1,3 +1,9 @@ list(APPEND CXXFLAGS -std=c++11 -pthread) list(APPEND LDFLAGS -lstdc++ -pthread) + +file(GLOB Source RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c *.cpp) +if(${CMAKE_EXE_LINKER_FLAGS} MATCHES "-static") + list(REMOVE_ITEM Source stdthreadbug.cpp) +endif() + llvm_singlesource() Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56836/new/ https://reviews.llvm.org/D56836 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits