Hi, I want some help to organize tests within cmake. Currently I have a test directory which contains some test files, eg : test_foo.cpp test_bar.cpp
In the CMakeLists.txt, I had: add_executable(test_foo test_foo.cpp) add_test(test_foo test_foo) add_executable(test_bar test_bar.cpp) add_test(test_bar test_bar) test_bar and test_foo have not the same dependencies so I did: find_package(Boost COMPONENTS thread) add_executable(test_foo test_foo.cpp) add_test(test_foo test_foo) target_link_libraries(test_foo ${Boost_LIBRARIES} my-project) find_package(Boost COMPONENTS system) add_executable(test_bar test_bar.cpp) add_test(test_bar test_bar) target_link_libraries(test_bar ${Boost_LIBRARIES} my-project) but it does not work as I expected (see bug http://www.cmake.org/Bug/view.php?id=13244). I realized that is not a cmake bug but my misunderstanding of cmake. Correct me if I am wrong but I think the cmake way looks like: test/CMakeLists.txt add_subdirectory(foo) add_subdirectory(bar) test/foo/CMakeLists.txt find_package(Boost COMPONENTS thread) add_executable(test_foo test_foo.cpp) add_test(test_foo test_foo) target_link_libraries(test_foo ${Boost_LIBRARIES} my-project) test/bar/CMakeLists.txt find_package(Boost COMPONENTS system) add_executable(test_bar test_bar.cpp) add_test(test_bar test_bar) target_link_libraries(test_bar ${Boost_LIBRARIES} my-project) but I think this solution is a bit verbose because we need to create a directory for each test. So, I have 2 questions: - how do you organize your tests within cmake? / what is the cmake way to organize test? - how do you handle multiple targets in the same CMakeLists.txt with differents dependencies? / what is the cmake way to handle multiple targets in the same CMakeLists.txt with differents dependencies? Regards, Damien R.
-- 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