On Dec 7, 2008, at 1:02 PM, Robert Dailey wrote:
On Sun, Dec 7, 2008 at 7:01 AM, Michael Jackson <[EMAIL PROTECTED]
> wrote:
There are a few variables that control where the final executables,
libraries and archives are created.
CMAKE_RUNTIME_OUTPUT_DIRECTORY
CMAKE_LIBRARY_OUTPUT_DIRECTORY
CMAKE_ARCHIVE_OUTPUT_DIRECTORY
• RUNTIME_OUTPUT_DIRECTORY: Output directory in which to
build RUNTIME target files.
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
So you can do something like:
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Bin CACHE
PATH
"Single Directory for all executables"
)
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Bin CACHE
PATH
"Single Directory for all dynamic Libraries"
)
SET (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Bin CACHE
PATH
"Single Directory for all static Libraries"
)
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.
cmake -E can be used to copy files.
You may want to look at the add_custom_command(TARGET ${yourExeTarget}
POST_BUILD
COMMAND $
{CMAKE_COMMAND} -E {path to source dll} {path to dest}
..... )
This will probably copy the files _every_ time the target is built
although I am not sure on that point.
You can look up the help for add_custom_command and see if this will
help you out.
I tried the following, but it didn't print anything. Are you sure
these variables even exist?
message( "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" )
message( "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" )
message( "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}" )
#------------
project(test)
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Bin
CACHE PATH
"Single Directory for all executables"
)
message(STATUS "CMAKE_RUNTIME_OUTPUT_DIRECTORY: $
{CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
Then I ran cmake 2.6.2 on that CMakeLists.txt file and I get the
following:
-- CMAKE_RUNTIME_OUTPUT_DIRECTORY: /Users/mjackson/Desktop/test/Build/
Bin
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/mjackson/Desktop/test/Build
Odd yours does not print anything out. Can you run the above short
CMakeLists.txt file and see what gets output? Also is this what you
are looking for or did you want to copy external libraries into the
build directory?
_________________________________________________________
Mike Jackson [EMAIL PROTECTED]
BlueQuartz Software www.bluequartz.net
Principal Software Engineer Dayton, Ohio
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake