<br><br><div class="gmail_quote">On 8 July 2010 12:56, Michael Wild <span dir="ltr"><<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5"><br>
On 8. Jul, 2010, at 4:40 , Paul Harris wrote:<br>
<br>
> On 7 July 2010 23:05, Michael Wild <<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>> wrote:<br>
><br>
>><br>
>> On 7. Jul, 2010, at 16:01 , Paul Harris wrote:<br>
>><br>
>>> Hi all,<br>
>>><br>
>>> I have looked and can't find the answer, so I turn to the list.<br>
>>><br>
>>> I have a CMakeLists.txt and a subdirectory called utils, which also has<br>
>> its<br>
>>> own CMakeLists.txt<br>
>>><br>
>>> In the parent CML.txt, I have something like:<br>
>>><br>
>>> ENABLE_TESTING()<br>
>>> add_subdirectory(utils)<br>
>>><br>
>>> In my utils CML.txt, I have<br>
>>><br>
>>> ADD_EXECUTABLE(unit_1 units/unit_1.cpp)<br>
>>> ADD_TEST( unit_1 ${EXECUTABLE_OUTPUT_PATH}/unit_1 )<br>
>>><br>
>><br>
>> Simplify this to<br>
>><br>
>> ADD_TEST(unit_1 unit_1)<br>
>><br>
>> CMake will figure out by itself that unit_1 is a target and invoke the<br>
>> executable correctly (your code would break for multi-configuration IDE<br>
>> generators).<br>
>><br>
>><br>
> This does not work for me. If I do not have the EXECUTABLE_OUTPUT_PATH in<br>
> add_test, I get a message like this when i run "make test" (shortened for<br>
> brevity):<br>
><br>
> 1/ 1 Testing unit_string_numeric_utils Could not find executable<br>
> unit_string_numeric_utils<br>
> Looked in the following places:<br>
> unit_string_numeric_utils<br>
> unit_string_numeric_utils<br>
> Release/unit_string_numeric_utils<br>
> Release/unit_string_numeric_utils<br>
<br>
</div></div>Mmmh, works fine for me:<br>
<br>
--------->8---------<br>
cmake_minimum_required(VERSION 2.8)<br>
project(tmp)<br>
<br>
enable_testing()<br>
<br>
add_executable(unit1 unit1.cpp)<br>
add_test(unit1 unit1)<br>
---------<8---------<br>
<br>
Where unit1.cpp is just a simple hello-world program. Running it:<br>
<br></blockquote><div><br>snip<br><br>My project is a lot bigger than a hello-world program. It has subdirectories for a start, and I do things like<br> SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for building all executables.")<br>
</div></div><br>I'm not sure at which point things stop working, do you want me to try and build a test-case?<br><br>