https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100439

--- Comment #11 from Florin Iucha <florin.iucha at amd dot com> ---
Updated Makefile for clang12:

#-----------------------

ALL: bin/test_hello

.PHONY: clean

CXX=/opt/clang12-for-tng/bin/clang++

CXXFLAGS=-m64 -g -std=c++20 --gcc-toolchain=/opt/gcc11-for-tng
-fsanitize=undefined -fno-omit-frame-pointer

LDFLAGS=-L/opt/gcc11-for-tng/lib64 -Wl,-rpath,/opt/gcc11-for-tng/lib64
-fsanitize=undefined

GOOGLE_TEST_PATH=googletest/googletest
GOOGLE_TEST_OBJECTS=obj/gtest.o obj/gtest_main.o obj/gtest-port.o
obj/gtest-filepath.o obj/gtest-death-test.o obj/gtest-test-part.o
obj/gtest-printers.o

obj/test_hello.o: test_hello.cpp
        $(CXX) $(CXXFLAGS) -o $@ -I$(GOOGLE_TEST_PATH)/include -c $<

obj/gtest.o: $(GOOGLE_TEST_PATH)/src/gtest.cc
        $(CXX) $(CXXFLAGS) -o $@ -I$(GOOGLE_TEST_PATH)/include
-I$(GOOGLE_TEST_PATH) -c $<

obj/gtest%.o: $(GOOGLE_TEST_PATH)/src/gtest%.cc
        $(CXX) $(CXXFLAGS) -o $@ -I$(GOOGLE_TEST_PATH)/include
-I$(GOOGLE_TEST_PATH) -c $<

bin/test_hello: obj/test_hello.o $(GOOGLE_TEST_OBJECTS)
        $(CXX) -o $@ $(LDFLAGS) $^ -lpthread

clean:
        $(RM) bin/test_hello obj/*.o


# -----

The content of the test file:

#include <gtest/gtest.h>

#include <string>

TEST(Hello, World)
{
    ASSERT_EQ(43, std::stoi("42"));
}

Reply via email to