Hi,
In my tests (I use google test) I use some external my_file.txt. Thus I need to put this my_file.txt to the build dir.
It is known that MSVC creates additional config (Debug/Release) folder and other compilers don’t.
I ve tried to remove these additional config folders in the same way as it was proposed in the link above:
# First for the generic no-config case (e.g. with mingw)
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${youroutputdirectory} )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${youroutputdirectory} )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${youroutputdirectory} )
# Second, for multi-config builds (e.g. msvc)
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${youroutputdirectory} )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${youroutputdirectory} )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${youroutputdirectory} )
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
It works for my own project but google test (wich is a subproject) creates Debug
folder and put there its .moc-files like in the picture:
If someone has idea how to make this approach crosscompile please share.
For now I copy my file (folder actually) with command:
file(COPY "data"
DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})