Skip to content

Instantly share code, notes, and snippets.

@ngladitz
Created June 5, 2014 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngladitz/43fd252af53ebf503f9b to your computer and use it in GitHub Desktop.
Save ngladitz/43fd252af53ebf503f9b to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 2.8.12)
set(CTEST_USE_LAUNCHERS ON CACHE BOOL "Use CTest launchers")
add_executable(myexe myexe.cpp)
add_library(mylib mylib.cpp mylib.hpp)
target_link_libraries(myexe mylib)
include(CTest)
mkdir build
cd build
cmake ..
ctest -M Experimental -T Build
#include "mylib.hpp"
int main()
{
hello_world();
}
#include "mylib.hpp"
#include <iostream>
void hello_world()
{
std::cout << "Hello World" << std::endl;
}
void hello_world();
<ProcessStats>
<!-- Per command statistics -->
<Process targetName='mylib' sourceFile='' outputFile='libmylib.a'>
<Stat key='ElapsedRealTime' value='0.00245094'/>
</Process>
<Process targetName='myexe' sourceFile='' outputFile='myexe'>
<Stat key='ElapsedRealTime' value='0.043865'/>
</Process>
<Process targetName='mylib' sourceFile='/home/ngladitz/src/test/helloworld/mylib.cpp' outputFile='CMakeFiles/mylib.dir/mylib.cpp.o'>
<Stat key='ElapsedRealTime' value='0.00890899'/>
</Process>
<Process targetName='myexe' sourceFile='/home/ngladitz/src/test/helloworld/myexe.cpp' outputFile='CMakeFiles/myexe.dir/myexe.cpp.o'>
<Stat key='ElapsedRealTime' value='0.00293088'/>
</Process>
<Process targetName='mylib' sourceFile='' outputFile='libmylib.a'>
<Stat key='ElapsedRealTime' value='0.00315309'/>
</Process>
<!-- Accumulated per target statistics -->
<Target name='myexe'>
<Stat key='ElapsedRealTime' value='0.0467959'/>
</Target>
<Target name='mylib'>
<Stat key='ElapsedRealTime' value='0.014513'/>
</Target>
</ProcessStats>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment