Thanks for the tip. I'll see how I can adapt this to my scenario. Petr
On Tue, Oct 2, 2012 at 12:49 PM, David Cole <[email protected]> wrote: > CMake has code like this using the TEST_INCLUDE_FILE directory property to > deal with this situation: > > > # In the main CMakeLists.txt: > # Set up test-time configuration. > set_directory_properties(PROPERTIES > TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake") > > > # In Tests/CMakeLists.txt: > # Choose a default configuration for CTest tests. > set(CTestTest_CONFIG Debug) > if(NOT CMAKE_CONFIGURATION_TYPES AND CMAKE_BUILD_TYPE) > set(CTestTest_CONFIG ${CMAKE_BUILD_TYPE}) > endif() > > configure_file(${CMake_SOURCE_DIR}/Tests/EnforceConfig.cmake.in > ${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake @ONLY) > > > $ cat Tests/EnforceConfig.cmake.in > # Choose a configuration with which to drive CTest tests. > if(CTEST_CONFIGURATION_TYPE) > set(CTestTest_CONFIG "${CTEST_CONFIGURATION_TYPE}") > else() > set(CTestTest_CONFIG "@CTestTest_CONFIG@") > endif() > > # Choose a configuration that was built if none is given. > if(NOT CTEST_CONFIGURATION_TYPE) > set(CTEST_CMD "@CMAKE_CTEST_COMMAND@@CMAKE_EXECUTABLE_SUFFIX@") > get_filename_component(CTEST_DIR "${CTEST_CMD}" PATH) > get_filename_component(CTEST_EXE "${CTEST_CMD}" NAME) > foreach(cfg Release Debug MinSizeRel RelWithDebInfo) > if(NOT CTEST_CONFIGURATION_TYPE) > if(EXISTS "${CTEST_DIR}/${cfg}/${CTEST_EXE}") > set(CTEST_CONFIGURATION_TYPE ${cfg}) > endif() > endif() > endforeach() > if(NOT CTEST_CONFIGURATION_TYPE) > set(CTEST_CONFIGURATION_TYPE NoConfig) > endif() > message("Guessing configuration ${CTEST_CONFIGURATION_TYPE}") > endif() > > @TEST_HOME_ENV_CODE@ > > > Adapt accordingly for your own project. > > > HTH, > David > > > On Tue, Oct 2, 2012 at 2:28 AM, Petr Kmoch <[email protected]> wrote: > >> Anyone? Any suggestions would be appreciated. >> >> Petr >> >> >> On Mon, Sep 24, 2012 at 5:16 PM, Petr Kmoch <[email protected]> wrote: >> >>> Hi all, >>> >>> I seem to have a problem when using add_test(... CONFIGURATIONS ...) and >>> running 'make test' on Linux. It's skipping the test. >>> >>> The CMakeLists.txt contains: >>> #... >>> enable_testing() >>> add_test(NAME test1 CONFIGURATIONS db COMMAND ...) >>> #... >>> >>> On Windows, I invoke CMake like this: >>> cmake -DCMAKE_CONFIGURATION_TYPES:STRING=rel\;inhouse\;db -G "Visual >>> Studio 8 2005" >>> >>> All works fine and the test is run when I "build" RUN_TESTS in 'db' >>> configuration. >>> >>> When I invoke CMake on Linux, like this: >>> cmake -DCMAKE_CONFIGURATION_TYPES:STRING=rel\;inhouse\;db >>> -DCMAKE_BUILD_TYPE:STRING=db -G "Unix Makefiles" >>> >>> Then after 'make test', the test is not run. I tried manually injecting >>> a 'message(">${CTEST_CONFIGURATION_TYPE}<")' into the generated >>> CTestTestfile.cmake file, but the output was '><' (i.e. >>> CTEST_CONFIGURATION_TYPE is not set). Am I doing something wrong? >>> >>> Thanks in advance for your help. >>> >>> Petr >>> >> >> >> -- >> >> 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 >> > >
-- 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
