On Sun, Dec 7, 2008 at 7:01 AM, Michael Jackson <span dir="ltr"><<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
There are a few variables that control where the final executables, libraries and archives are created.<br>
<br>
CMAKE_RUNTIME_OUTPUT_DIRECTORY<br>
CMAKE_LIBRARY_OUTPUT_DIRECTORY<br>
CMAKE_ARCHIVE_OUTPUT_DIRECTORY<br>
<br>
• RUNTIME_OUTPUT_DIRECTORY: Output directory in which to build RUNTIME target files.<br>
This property specifies the directory into which runtime target files should be built. There are three kinds of target files that may be built: archive, library, and runtime. Executables are always treated as runtime targets. Static libraries are always treated as archive targets. Module libraries are always treated as library targets. For non-DLL platforms shared libraries are treated as library targets. For DLL platforms the DLL part of a shared library is treated as a runtime target and the corresponding import library is treated as an archive target. All Windows-based systems including Cygwin are DLL platforms. This property is initialized by the value of the variable CMAKE_RUNTIME_OUTPUT_DIRECTORY if it is set when a target is created<br>
<br>
So you can do something like:<br>
<br>
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Bin CACHE PATH<br>
"Single Directory for all executables"<br>
)<br>
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Bin CACHE PATH<br>
"Single Directory for all dynamic Libraries"<br>
)<br>
SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Bin CACHE PATH<br>
"Single Directory for all static Libraries"<br>
)<br>
<br>
BEFORE any "add_library" or "add_executable" is called. That way all your built products will be created in the same directory when being built. Now, that assumes that your "couple of dlls" were built by your project. If they were NOT built by your project (say for example, Qt libraries) then you will want to try something a bit different.<br>
<br>
cmake -E can be used to copy files.<br>
<br>
You may want to look at the add_custom_command(TARGET ${yourExeTarget}<br>
POST_BUILD<br>
COMMAND ${CMAKE_COMMAND} -E {path to source dll} {path to dest}<br>
..... )<br>
<br>
This will probably copy the files _every_ time the target is built although I am not sure on that point.<br>
<br>
You can look up the help for add_custom_command and see if this will help you out.</blockquote></div><br>I tried the following, but it didn't print anything. Are you sure these variables even exist?<br>
<br>
message( "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" )<br>
message( "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" )<br>
message( "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}" )<br>