On 10/24/2010 12:18 PM, Yann COLLETTE wrote:
> Hello,
>
> I have used cmake to build an executable (which is
> ${CMAKE_EXECUTABLE_DIR}/myprog.exe).
> I wanted to use ctest to test my executable. But I need to execute this
> program in specific directories with various data set (in
> ${CMAKE_SOURCE_DIR}/tests/first_test for example).
>
> Is it possible to do this with ctest ?
You might use "cmake -E chdir" as a simple test driver:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(CWD C)
ENABLE_TESTING()
FILE(WRITE ${CMAKE_BINARY_DIR}/main.c "
#include<unistd.h>
#include<stdio.h>
int main(void)
{
char cwd[1000];
getcwd(cwd,sizeof cwd);
printf(\"CWD: %s\\n\",cwd);
return 0;
}
")
ADD_EXECUTABLE(main main.c)
ADD_TEST(NAME maintest
COMMAND ${CMAKE_COMMAND} -E chdir /var/tmp $<TARGET_FILE:main>)
So, "ctest -V" issues "1: CWD: /var/tmp"; adapt for non-*nices.
Regards,
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