PostBuildEvent Create Directory
You need to do something like: if not exist DirToCreate mkdir DirToCreate
You need to do something like: if not exist DirToCreate mkdir DirToCreate
You can use ‘for’ either in a batch file or directly from the command prompt: for %I in (file1.txt file2.txt file3.txt) do copy %I c:\somedir\ Wildcards are supported in the filelist as well: for %I in (*.txt *.doc *.html) do copy %I c:\somedir\ For more info, just type for /? from a command prompt, or … Read more
Playing around with different project properties, I found that the project build order was the problem. The project that generated the files I wanted to copy was built second, but the project that was running the batch file as a post-build event was built first, so I simply attached the build event to the second … Read more
Rather than using the obsolete LOCATION property, prefer using generator expressions: add_custom_command(TARGET mylibrary POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:mylibrary> ${targetfile} ) You could also just generate the exe in the target directory directly by setting the target property RUNTIME_OUTPUT_DIRECTORY instead of copying it. This has per-configuration options (e.g. RUNTIME_OUTPUT_DIRECTORY_DEBUG). set_target_properties(mylibrary PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG <debug path> RUNTIME_OUTPUT_DIRECTORY_RELEASE … Read more
You can use the Custom Build Step property page to set up a batch file to run. This runs if the File specified in the Outputs setting is not found, or is out-of-date. Simply specify some non-existent file there, and the custom build step will always run. It will run even if your project is … Read more
Answer to use “/I” is working but with little trick – in target you must end with character \ to tell xcopy that target is directory and not file! Example: xcopy “$(TargetDir)$(TargetName).dll” “$(SolutionDir)_DropFolder” /F /R /Y /I does not work and return code 2, but this one: xcopy “$(TargetDir)$(TargetName).dll” “$(SolutionDir)_DropFolder\” /F /R /Y /I Command … Read more
Here is what you want to put in the project’s Post-build event command line: copy /Y “$(TargetDir)$(ProjectName).dll” “$(SolutionDir)lib\$(ProjectName).dll” EDIT: Or if your target name is different than the Project Name. copy /Y “$(TargetDir)$(TargetName).dll” “$(SolutionDir)lib\$(TargetName).dll”