[CMake] Cmake parsing issue on Win32 platform

William A. Hoffman billlist at nycap.rr.com
Tue Apr 25 08:18:55 EDT 2006


At 08:05 AM 4/25/2006, Xavier Delannoy wrote:
>On Tue, 25 Apr 2006 07:28:22 -0400
>Andy Cedilnik <andy.cedilnik at kitware.com> wrote:
>
>> Hi Xavier,
>> 
>> For some reason all paths in DartTestfile.txt are windows style. What do 
>> your ADD_TEST commands look like?
>> 
>
>here is my CMakeLists.txt where I use the ADD_TEST command : 
>
>
>SET(EXECUTABLE_OUTPUT_PATH "$ENV{BUILDTESTDIR}")

You need to make sure that you convert this path to unix style.
In CMake cvs or 2.4 (soon to be released) , you can do this:

FILE(TO_CMAKE_PATH "$ENV{BUILDTESTDIR}" EXECUTABLE_OUTPUT_PATH)

In older versions of cmake, you will have to use regex replace
to change all of the \ to /.  
STRING(REGEX REPLACE "\\\\" "/"  "$ENV{BUILDTESTDIR}" EXECUTABLE_OUTPUT_PATH)

However, all said, this is a bug, all paths coming into cmake commands
should be converted.  I will fix the add_test command so that it does the conversion
automatically in cvs CMake.   

One last note, I am not sure why you would use an environment variable here
anyway.   It will only be evaluated at CMAke time, and if a user does
not set it prior to running cmake, your output path will be empty.  Seems
a cmake variable would be a better choice.


># force to enable test
>ENABLE_TESTING()
>#INCLUDE(Dart)
>
># C tests
>FOREACH(test
>    test_section
>    test_network
>    test_str
>    test_system
>    )
>  ADD_EXECUTABLE(${test} ${test}.c)
>  TARGET_LINK_LIBRARIES(${test} ntest nbase_static)
>ENDFOREACH(test)
>
># -- Section Test -- #
>ADD_TEST(libnbase.section_parseline ${EXECUTABLE_OUTPUT_PATH}/test_section 1)
>ADD_TEST(libnbase.section_new ${EXECUTABLE_OUTPUT_PATH}/test_section 2)
>ADD_TEST(libnbase.sec_remove_marked_elements ${EXECUTABLE_OUTPUT_PATH}/test_section 3)
>ADD_TEST(libnbase.sec_load_from_context ${EXECUTABLE_OUTPUT_PATH}/test_section 4)    
>ADD_TEST(libnbase.sec_get_names_from_context ${EXECUTABLE_OUTPUT_PATH}/test_section 5)
>ADD_TEST(libnbase.sec_add_at_pos ${EXECUTABLE_OUTPUT_PATH}/test_section 6)
>ADD_TEST(libnbase.section_deltoken ${EXECUTABLE_OUTPUT_PATH}/test_section 7)
>ADD_TEST(libnbase.section_getstr ${EXECUTABLE_OUTPUT_PATH}/test_section 8)
>ADD_TEST(libnbase.section_addstr ${EXECUTABLE_OUTPUT_PATH}/test_section 9)
>ADD_TEST(libnbase.section_clear ${EXECUTABLE_OUTPUT_PATH}/test_section 10)
>ADD_TEST(libnbase.section_write ${EXECUTABLE_OUTPUT_PATH}/test_section 11)
>ADD_TEST(libnbase.writestrtosection ${EXECUTABLE_OUTPUT_PATH}/test_section 12)
>ADD_TEST(libnbase.sec_loadall_from_context ${EXECUTABLE_OUTPUT_PATH}/test_section 13)
>
>
>BUILDTESTDIR is defined in .bat file. this file looks like : 
>
>@set BUILDROOTDIR=%cd%
>
>@set BUILDDESTLIB=%BUILDROOTDIR%\tmp
>@set BUILDTESTDIR=%BUILDROOTDIR%\tmp\test
>@set BUILDDESTSRC=%BUILDROOTDIR%\tmp
>
>
>best regards, 
>
>Xavier 
>_______________________________________________
>CMake mailing list
>CMake at cmake.org
>http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list