C/C++test + CMake -> bdf file generation issue

sankosanko Posts: 2
edited July 7 in C/C++test

Hello,

I am using the CMake extension for creating C/C++ Test projects and what I noticed is, that the extension is also capturing commands which compile/link temporary files during a CMake build. This is especially, or maybe only, the case when the build has dependencies on other static libraries.

These commands will also make it into the bdf file, which in the end cause linking issues during test generation.

If I remove following entries from the bdf file, everything works as expected:

arg=--whole-archive
arg=CMakeFiles\MYAPPNAME.dir/objects.a

arg=--out-implib
arg=libMYAPPNAME.dll.a

Kind Regards
Konstantin

Tagged:

Comments

  • Andrey MadanAndrey Madan Posts: 375 ✭✭✭

    @sanko - are you running Unit Testing , Application level coverage or simply Static Analysis? If Static only - then there is an much easier way to get the .json file from CMake. Which tool distro are you using: Standard or Professional?

  • sankosanko Posts: 2

    @Andrey Madan
    We are currently using only unit testing.
    Its actually not about a .json file, its about creating C/C++test projects during a cmake build. Of course I can generate a compile_commands.json file and use this inside a C/C++test project.
    I prefer to use "cpptest_add_executable" directly inside the CMakeLists.txt.

  • MirekMirek Posts: 136 ✭✭✭

    Hello @sanko,

    If I'm correct, this is related to CMake's behavior on windows, where all the objects are first archived and then used for linking the final binary.

    C/C++test, when linking the test binary, assumes that objects.a is one of the user's third-party libraries and leaves it on the command line, generating linking errors.

    Please try to modify your test configuration using the following setting:
    TestConfiguration >Execution tab>Symbols tab>Ignore object/library files: [*/objects.a]

    Where "*/objects.a" is a value of the setting.

Sign In or Register to comment.