<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 15, 2013 at 12:10 PM, Petr Kmoch <span dir="ltr"><<a href="mailto:petr.kmoch@gmail.com" target="_blank">petr.kmoch@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>The errors VS spews out aren't really useful. However, if you go to ${CMAKE_BINARY_DIR}/Testing/Temporary, there are log files. LastTest.log should tell you a bit more.<br>
<br>Can you also try/report on my second question? (2. Does it work if you use the enhanced signature of add_test? I mean 'add_test(NAME Test COMMAND test_rev)')<span class=""><font color="#888888"><br>
<br></font></span></div></div></blockquote><div><br></div><div>Sorry, I missed the important point you suggested try. Yes, When I tried the 'add_test(NAME Test COMMAND test_rev)')<span class=""></span> format, it works. <br>
<div><br></div><div>To make it work I had to manually copy the boost test library (dll) as well as the my libraries "dll" to the root of build folder. What is the approach used by "professional" developers? I tried looking at the cmake file of VTK, but it contains only "MAKE_DIRECTORY and ADD_SUBDIRECTORY" commands! <br>
<br></div><div>Thanks<br></div><div> Lloyd<br></div></div><div><br><br><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>
<span class=""><font color="#888888"></font></span></div><span class=""><font color="#888888">Petr<br></font></span></div><div class=""><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 15, 2013 at 6:43 AM, Lloyd <span dir="ltr"><<a href="mailto:lloydkl.tech@gmail.com" target="_blank">lloydkl.tech@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote"><div>On Fri, Apr 12, 2013 at 5:00 PM, Lloyd <span dir="ltr"><<a href="mailto:lloydkl.tech@gmail.com" target="_blank">lloydkl.tech@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">of course... This is the source of my test cmake file<br><br>#Cmake file of Tests<br>
cmake_minimum_required (VERSION 2.6)<br><br>SET(TST_SRC test_rev.cpp test_runner.cpp)<br><br>FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework)<br>
<br>INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})<br>INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}../../src/lib/reverse)<br>ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK)<br>ADD_EXECUTABLE(test_rev ${TST_SRC})<br>TARGET_LINK_LIBRARIES(test_rev ${Boost_LIBRARIES})<br>
TARGET_LINK_LIBRARIES(test_rev Reverse)<br></div></blockquote><div><br><br></div></div><div>As a temporary solution to this I have copied the test executable and its dependent dlls to the root folder of the build directory. When I run "RUN_TETS" project in Visual Studio, it throws me some other error like<br>
<br><br>------ Build started: Project: RUN_TESTS, Configuration: Debug Win32 ------<br> Test project E:/CMakeDemo/BuildDir<br> Start 1: Test<br> 1/1 Test #1: Test .............................***Failed 0.16 sec<br>
<br> 0% tests passed, 1 tests failed out of 1<br> <br> Total Test time (real) = 2.42 sec<br> <br> The following tests FAILED:<br> 1 - Test (Failed)<br> Errors while running CTest<br>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command "setlocal<br>
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: "C:\Program Files\CMake 2.8\bin\ctest.exe" --force-new-ctest-process -C Debug<br>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd<br>
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmEnd<br>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone<br>
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmErrorLevel<br>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: exit /b %1<br>
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :cmDone<br>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd<br>
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code 8.<br>======== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========<br> <br></div><div>
I cannot interpret these errors, can you please give some hint?<br><br></div><div><div><div>Thanks,<br></div><div> Lloyd<br></div><div><br><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Apr 12, 2013 at 4:55 PM, Petr Kmoch <span dir="ltr"><<a href="mailto:petr.kmoch@gmail.com" target="_blank">petr.kmoch@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>1. Can you post tests/CMakeLists.txt (or at least the parts relevant to creating test_rev)?<br>
<br></div>2. Does it work if you use the enhanced signature of add_test? I mean 'add_test(NAME Test COMMAND test_rev)'<span><font color="#888888"><br>
<br></font></span></div><span><font color="#888888">Petr<br></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Apr 12, 2013 at 1:18 PM, Lloyd <span dir="ltr"><<a href="mailto:lloydkl.tech@gmail.com" target="_blank">lloydkl.tech@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>Yes I built the test and it is in <br><br>E:\CMakeDemo\BuildDir\tests\Debug\test_rev.exe<br>
<br></div>I don't know the right way to locate this test executable for cmake<br><br></div>Thanks,<br>
</div> Lloyd<div><div><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Apr 12, 2013 at 4:42 PM, Petr Kmoch <span dir="ltr"><<a href="mailto:petr.kmoch@gmail.com" target="_blank">petr.kmoch@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>Hi Lloyd.<br><br></div>Do you actually have a target (executable) named "test_rev"? And have you built it before running RUN_TESTS? RUN_TEST (or its Makefile equivalent 'make test') doesn't automatically build the test executables before running them.<br>
<br></div>Petr<br></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Fri, Apr 12, 2013 at 1:08 PM, Lloyd <span dir="ltr"><<a href="mailto:lloydkl.tech@gmail.com" target="_blank">lloydkl.tech@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div dir="ltr"><div><div><div><div><div><div>Hi,<br><br></div>I was successful in creating and compiling a simple project C++/Visual studio using cmake. I have also included one unit test project. All these projects builds successfully. The test project source and main project source resides in the root directory of the project. When I try to run "RUN_TESTS" it gives me an error <br>
<br>Test project E:/CMakeDemo/BuildDir<br>1> Start 1: Test<br>1> Could not find executable test_rev<br>1> Looked in the following places:<br>1> Unable to find executable: test_rev<br>1> test_rev<br>
1> test_rev.exe<br>1> Debug/test_rev<br>1> Debug/test_rev.exe<br>1> Debug/test_rev<br>1> Debug/test_rev.exe<br>1> 1/1 Test #1: Test .............................***Not Run 0.00 sec<br><br></div>
I have added the tests in my main cmake file as shown below<br>
<br>#Root cmake file<br>cmake_minimum_required (VERSION 2.6)<br>PROJECT (Tutorial)<br><br>ADD_SUBDIRECTORY(src/lib/reverse)<br>ADD_SUBDIRECTORY(src)<br>#SUBDIRS(src/lib/reverse src)<br><br>############################################################<br>
SET (DO_TEST false CACHE BOOL "Enable Testing?")<br>if(DO_TEST)<br>MESSAGE (STATUS "Testing is enabled")<br>ENABLE_TESTING()<br>ADD_SUBDIRECTORY(tests)<br><br><br>ADD_TEST(Test test_rev)<br><br><br>endif(DO_TEST)<br>
#############################################################<br></div><br><br></div>What am i missing here?<br><br></div>Thanks a lot,<br></div> Lloyd<br><div><div><div><div><div><br><br></div></div></div></div></div></div>
<br></div></div><span><font color="#888888">--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></font></span></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div></div></div><br></div></div>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>