View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015782CMakeCMakepublic2015-10-11 20:302016-06-10 14:31
ReporterDario Oliveri 
Assigned ToKitware Robot 
PrioritynormalSeverityblockReproducibilityalways
StatusclosedResolutionmoved 
PlatformMSVC 19.0.23026.0OSWindowsOS Version
Product VersionCMake 3.1.2 
Target VersionFixed in Version 
Summary0015782: "--build" a generated test driver for Visual Studio 2015 fail because tests are not linked
DescriptionAfter some trial and error I believe the issue is a bug in Cmake where generating a test driver results in a project file (tests.vcxproj) that cannot be built directly with cmake (basically it don't links the tests object files to the generated test driver, so I believe the bug is in the solution/project generator).

The current workaround is using some other frameworks and manually adding test files instead of generating a test driver from a GLOB.


Steps To Reproducethe script I run from project folder are:

- mkdir build
- cd build
- cmake -G "Visual Studio 14 2015" ..

Building a regular target WORKS:

- cmake --build . --target libInfectorpp2 --config Release

Building ALL or test targets DO NOT WORK:
- cmake --build . --target ALL_BUILD --config Release


This is the "CONSOLE LOG" of the above scripts:
https://ci.appveyor.com/project/Darelbi/infectorpp2/build/1.0.38 [^]

this is the github project (where CMakeLists.txt is located):
https://github.com/Darelbi/Infectorpp2 [^]

No need to download the project, the console log already shows the log.
Additional InformationI need to get "TESTS.EXE" executable build from console using Cmake and the "--build" build command because I'm using a Continuos Integration server and hence I need to build the library and the tests executable at each commit, and I also need to run tests at each commit.

Actually there's no valid target for building the tests executable.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0039567)
Ben Boeckel (developer)
2015-10-11 23:24

Your test functions have the wrong type:

int mockSharedPtr(int , char** )

but:

unresolved external symbol "int __cdecl mockSharedPtr(int,char * * const)"
(0039571)
Dario Oliveri (reporter)
2015-10-12 03:52

Thanks that's fixing the issue, I'm guessing why wrong signature works with GCC/CLANG and why most tutorials about test drivers do not use "const".

For example fix this documentation where "const" is not mentioned:
https://cmake.org/cmake/help/v3.0/command/create_test_sourcelist.html [^]
(0042853)
Kitware Robot (administrator)
2016-06-10 14:29

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2015-10-11 20:30 Dario Oliveri New Issue
2015-10-11 23:24 Ben Boeckel Note Added: 0039567
2015-10-12 03:52 Dario Oliveri Note Added: 0039571
2016-06-10 14:29 Kitware Robot Note Added: 0042853
2016-06-10 14:29 Kitware Robot Status new => resolved
2016-06-10 14:29 Kitware Robot Resolution open => moved
2016-06-10 14:29 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team