diff --git a/cpp/ycm/tests/CMakeLists.txt b/cpp/ycm/tests/CMakeLists.txt index e2c564af..c4d8aa7c 100644 --- a/cpp/ycm/tests/CMakeLists.txt +++ b/cpp/ycm/tests/CMakeLists.txt @@ -70,12 +70,24 @@ target_link_libraries( ${PROJECT_NAME} ycm_core gmock_main ) -# The test executable expects a "testdata" dir in its working directory. Why? -# Because there's NO reliable, cross-platform way of getting the directory in -# which the executable is located. -add_custom_target( copy_testdata - COMMAND cmake -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR}/testdata - ${CMAKE_CURRENT_BINARY_DIR}/testdata ) + +if ( NOT CMAKE_GENERATOR_IS_XCODE ) + # The test executable expects a "testdata" dir in its working directory. Why? + # Because there's NO reliable, cross-platform way of getting the directory in + # which the executable is located. + add_custom_target( copy_testdata + COMMAND cmake -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/testdata + ${CMAKE_CURRENT_BINARY_DIR}/testdata ) +else() + add_custom_target( copy_testdata + COMMAND cmake -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/testdata + ${CMAKE_CURRENT_BINARY_DIR}/Debug/testdata + COMMAND cmake -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/testdata + ${CMAKE_CURRENT_BINARY_DIR}/Release/testdata ) + +endif() add_dependencies( ${PROJECT_NAME} copy_testdata )