On Sun, 2010-01-31 at 01:20 +0000, Mateusz Loskot wrote:
> Hi,
> 
> I have just learned by trial and error that enable_testing()
> macro should be called before a subdirector(y|ies) with tests
> are added, otherwise tests are not configured.
> 
> Here is a bit of CMakeLists.txt in root directory of my project
> 
> 1) This option works properly
> 
> enable_testing()
> add_subdirectory(include)
> add_subdirectory(src)
> add_subdirectory(tests) # Here are my tests
> 
> 2) This does not configure any tests
> 
> add_subdirectory(include)
> add_subdirectory(src)
> add_subdirectory(tests) # Here are my tests
> enable_testing()
> 
> and make test or ctest -N does not show anything but message like:
> 
> Running tests...
> Test project /home/mloskot/dev/geos/_svn/build
> No tests were found!!!
> 
> 
> Is my conclusion correct, that the order of enable_testing and
> add_subdirectory is relevant?
> If it is, perhaps it would be good to update the manual
> appropriate note on how things in the CMakeLists.txt are being
processed.
> 
> Best regards,

Hi Mateusz,

Yes, your conclusion is correct. I think the docs are clear about this. 

>From the docs:

enable_testing: Enable testing for current directory and below.

add_test: Add a test to the project with the specified arguments.
If the ENABLE_TESTING command has been run, this command adds a test
target to the current directory. If ENABLE_TESTING has not been run,
this command does nothing.

So order *does* matter here.

Best regards,
Marcel Loose.


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to