diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 73d0440..db812bf 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -7,6 +7,10 @@ foreach(pkg_config_lib CAIRO) link_directories(${${pkg_config_lib}_LIBRARY_DIRS}) endforeach() +if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows") + add_definitions(-DTEST_BUILD_ON_WINDOWS) +endif() + # test suite set(testsuite_SOURCES diff --git a/test/harness.cpp b/test/harness.cpp index 522213d..ced5d6a 100644 --- a/test/harness.cpp +++ b/test/harness.cpp @@ -21,9 +21,12 @@ namespace Platform { } } -// The paths in __FILE__ are from the build system, but defined(WIN32) returns -// the value for the host system. -#define BUILD_PATH_SEP (__FILE__[0]=='/' ? '/' : '\\') + +#ifdef TEST_BUILD_ON_WINDOWS +static char BUILD_PATH_SEP = '\\'; +#else +static char BUILD_PATH_SEP = '/'; +#endif static std::string BuildRoot() { static std::string rootDir;