Reputation: 8315
So far this is my command line to start a Cmake build:
cmake .. --build .. -DCMAKE_BUILD_TYPE:STRING=release
This is good and works, and it generates a
Project.sln
and
tests/ProjectTests.sln
solution files.
I could open solution files with visual studio and build them and run tests from Visual Studio, however I'm running the script from a Continuos Integration server and hence I need to also start the build and run the tests from command line: how can I do that?
I need to
CTest
from the same folder in wich Tests.exe
is located)Until now I tried to build using the command
msbuild Infectorpp2.sln
But that is failing (error log just to long to post), if that can helps here's the script on github. The main problem is that I'm not able to finally generate the Tests.exe
file, once that is done calling CTest on it is trivial. Thanks in advance.
Upvotes: 2
Views: 7942
Reputation: 8315
To complete the information for random browsers, the problem was finally wrong signature of functions.
CMake test driver requires signature like these:
int filename(int, char*[])
GCC/Clang accept this signature
int filename(int, char**)
while Visual studio require
int filename(int char**const) //still works with GCC/Clang luckily
Upvotes: 0
Reputation: 3832
As mentioned in the documentation, the general syntax for building a target (i.e. after generating the .sln
files with cmake -G
) using CMake is:
cmake --build . [--config <config>] [--target <target>] [-- -i]
It will invoke the appropriate compiler/toolchain commands for you.
See cmake(1) for the full list of arguments accepted by the cmake
command.
Upvotes: 6