[CMake] Output directory

David.Karr at L-3COM.COM David.Karr at L-3COM.COM
Fri Dec 5 15:53:11 EST 2008


Ioan Calin Borcoman wrote:
> I dump all my apps in the CMAKE_BUILD_DIR with:
>
> set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})

This is a useful thing to do if you're using CMake to generate a Visual
Studio 6.0 workspace.  But as far as I can tell, if you generate a
"solution" for any later version of Visual Studio,
EXECUTABLE_OUTPUT_PATH does not work the way it does for VS 6.0, if
indeed it works at all.

Robert Dailey wrote:
> I'm having a hard time understanding how this works. My project
structure
> looks like this:
>
> myroot/
>   component1/
>   component2/
>   component3/
>
> Each "component" under the "myroot" directory is a separate project.
Each
> component's project should output executable and library files to
> component1/build/${project_name}, and place intermediate files into
> component1/build/obj. How can I do this?

As far as I can tell, you CANNOT do this for Visual Studio 7.0 or later.
The closest you can get is the following, where ${config} is the
configuration you select when you run Visual Studio (for example,
"Debug" or "Release"):

component1/build/${project_name}/${config}         : executables and
DLLs
component1/build/obj/${config}                     : intermediate files 
component1/build/obj/${project_name}.dir/${config} : intermediate files

So, for example, you can get some of the intermediate files to be
written to component1/build/obj/Release, but you can't get them written
directly to component1/build/obj.  Unless you are willing to download
CMake source code, modify your copy of it, and recompile it (which I
have already done, by the way), there does not appear to be any way to
avoid having the "Release" (or other configuration name) as part of the
path to these files.

(I list two directories for "intermediate files" because the *.pdb,
*.idb, and some other files are written to one of them, while the *.obj
files are written to the other; and you have no choice in this.)

I didn't list LIB files because I'm still trying to figure the ins and
outs of these.  I suspect they are written to the same directory as some
of the intermediate files, no matter what you say in CMakeLists.txt.

A user can control these things in Visual Studio 6.0 without recompiling
CMake.  (Some fine points of control may require user-written template
files.)  So there is a loss of functionality in transitioning from
Visual Studio 6.0 to a later Visual Studio while still using CMake.

I complained about this last month, but you finally spurred me to enter
the complaint in the CMake bug tracker.  It's issue number 8243:

http://public.kitware.com/Bug/view.php?id=8243

David Karr



More information about the CMake mailing list