On 8. Jul, 2010, at 4:40 , Paul Harris wrote: > On 7 July 2010 23:05, Michael Wild <them...@gmail.com> wrote: > >> >> On 7. Jul, 2010, at 16:01 , Paul Harris wrote: >> >>> Hi all, >>> >>> I have looked and can't find the answer, so I turn to the list. >>> >>> I have a CMakeLists.txt and a subdirectory called utils, which also has >> its >>> own CMakeLists.txt >>> >>> In the parent CML.txt, I have something like: >>> >>> ENABLE_TESTING() >>> add_subdirectory(utils) >>> >>> In my utils CML.txt, I have >>> >>> ADD_EXECUTABLE(unit_1 units/unit_1.cpp) >>> ADD_TEST( unit_1 ${EXECUTABLE_OUTPUT_PATH}/unit_1 ) >>> >> >> Simplify this to >> >> ADD_TEST(unit_1 unit_1) >> >> CMake will figure out by itself that unit_1 is a target and invoke the >> executable correctly (your code would break for multi-configuration IDE >> generators). >> >> > This does not work for me. If I do not have the EXECUTABLE_OUTPUT_PATH in > add_test, I get a message like this when i run "make test" (shortened for > brevity): > > 1/ 1 Testing unit_string_numeric_utils Could not find executable > unit_string_numeric_utils > Looked in the following places: > unit_string_numeric_utils > unit_string_numeric_utils > Release/unit_string_numeric_utils > Release/unit_string_numeric_utils
Mmmh, works fine for me: --------->8--------- cmake_minimum_required(VERSION 2.8) project(tmp) enable_testing() add_executable(unit1 unit1.cpp) add_test(unit1 unit1) ---------<8--------- Where unit1.cpp is just a simple hello-world program. Running it: --------->8--------- $ mkdir build $ cd build $ cmake .. -- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Checking whether C compiler has -isysroot -- Checking whether C compiler has -isysroot - yes -- Checking whether C compiler supports OSX deployment target flag -- Checking whether C compiler supports OSX deployment target flag - yes -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Checking whether CXX compiler has -isysroot -- Checking whether CXX compiler has -isysroot - yes -- Checking whether CXX compiler supports OSX deployment target flag -- Checking whether CXX compiler supports OSX deployment target flag - yes -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: /Users/mwild/tmp/cmake/tests/build $ make all test Scanning dependencies of target unit1 [100%] Building CXX object CMakeFiles/unit1.dir/unit1.cpp.o Linking CXX executable unit1 [100%] Built target unit1 Running tests... Test project /Users/mwild/tmp/cmake/tests/build Start 1: unit1 1/1 Test #1: unit1 ............................ Passed 0.00 sec 100% tests passed, 0 tests failed out of 1 Total Test time (real) = 0.01 sec ---------<8--------- Michael _______________________________________________ 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