<div>CMake 2.8.5, Debian Linux</div><div><br></div><div>I have tests in two different directories; the tests in one directory depend on one test that is found in another directory. </div><div><br></div><div>If I try to test using 'make test', the tests run. Same for a ctest -S script that doesn't use labels, and a script that runs all tests in the proper order with labels. If I use a 'ctest -S' script that only tests certain labels, I get an error in spite of the dependencies:</div>
<div><div>$ ctest -S run_ctest.cmake</div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
Unable to find executable: p21read<br>Error in read script: /opt/step/scl/run_ctest.cmake</blockquote><div><br></div><div>It seems that test dependencies are ignored when the dependencies refer to tests in another directory. If a test is being built because of its label, aren't its dependencies also supposed to be built?</div>
</div><div><br></div><div>Also, when I add a test in test/p21 that uses a binary built in data/, I have to specify the full path to the binary instead of just specifying the target name (p21read). Is this correct behavior?</div>
<div><br></div><div>Regards</div><div>Mark</div><div><br></div><div>The following has been shortened a lot - I hope there are no typos.</div><div><br></div><div><br></div><div>In project/CMakeLists.txt, I have</div><div><div>
ADD_SUBDIRECTORY(data)</div><div> ADD_SUBDIRECTORY( test/p21 )</div><div><br></div></div>In project/data/CMakeLists.txt, I have<div> set( SRCS "..." )<br> set( LIBS "..." )<br><div> add_executable( p21read ${SRCS} )</div>
<div> target_link_libraries( p21read ${LIBS} ) </div>
<div> set_target_properties( p21read PROPERTIES EXCLUDE_FROM_ALL ON ) ### some of the source for this target is generated, exclude it from all so it can be used for a test<br>
<div><div> add_test( NAME build_p21read</div><div> WORKING_DIRECTORY ${CMAKE_BINARY_DIR}</div><div> COMMAND ${CMAKE_COMMAND} --build .</div><div> --target p21read</div>
<div> --config $<CONFIGURATION> )</div></div><div> add_test( NAME generate_cpp COMMAND ... ) ### details omitted</div><div> set_tests_properties( build_p21read PROPERTIES DEPENDS generate_cpp LABELS cpp_schema_build )</div>
<div><div> set_tests_properties( generate_cpp PROPERTIES LABELS cpp_schema_gen )</div></div><div><br></div></div><div>
In project/test/p21/CMakeLists.txt, I have</div><div><div> add_test( test_good_schema_name "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/p21read" path/file.p21 ) ###even though p21read is a target, I have to specify the path to the binary</div>
</div><div><div> set_tests_properties( test_good_schema_name PROPERTIES DEPENDS build_p21read LABELS exchange_file )</div></div><div><br></div><div><div><div> #get_property(dep TEST build_p21read PROPERTY DEPENDS ) ### added for troubleshooting</div>
<div> #message("test dir - build dep ${dep}")</div></div></div><div><br></div><div>#########################</div><div>If I uncomment the get_property() and message() lines immediately above, configuration fails. The message that appears in Config.xml is </div>
</div><div><div><blockquote>CMake Error at test/p21/CMakeLists.txt:27 (get_property):<br> get_property given TEST name that does not exist:<br> build_p21read<br> test dir - build dep <br><br></blockquote></div></div>