I would like to build an executable from static libraries (i. e. .a-files) only. This is possible, because the main()
function is contained in one of these libr
There is no way to do it without a hack. You need at least one *.c or *.cpp file.
What I do is make a dummy null.cpp
file (zero bytes) and use that. You can also use /dev/null
but that only works on Linux.
file(WRITE null.cpp "")
add_executable(tester
null.cpp
)
target_link_libraries(tester
-Wl,--whole-archive
libtest1
libtest2
libtest3
libtest4
-Wl,--no-whole-archive
gtest_main
)