[CMake] Some issues with visual studio

Clifford Yapp cliffyapp at gmail.com
Sun Jan 8 16:49:27 EST 2012


I can say that in my particular case, in order to be able to
successfully run compiled binaries from the build directory it is
necessary to have a broad variety of files in a sane position relative
to the compiled binary.  So far as I know, the only way I can do this
in systems that like to have multiple binary output locations is to
copy the files in question to their proper locations ahead of time
*for each possible configuration*.  Ouch.  And even that may not quite
be enough, depending on the specifics of the layouts in question.

My current work-around is to peg all of the output directories for all
the active configurations to the same directory - that negates much of
the benefit of multiple-configuration IDE options, but does at least
result in the expected run-from-build-directory behavior.  (It works
for MSVC - we apparently have too many targets or something for
XCode...)  You have to switch configs and re-build just like with Make
files, but that's the tradeoff currently required for being able to
run in the build directory.

Cheers,
CY

On Sun, Jan 8, 2012 at 4:08 PM, Michael Jackson
<mike.jackson at bluequartz.net> wrote:
> This is going to sound either harsh or "flame bait" but is written in all seriousness and with a lot of practical experience.
>
>  When coming from a "makefile" based system like Unix and going to Visual Studio there are a few things you need to "give up on" (In my opinion). Visual Studio (And Xcode) both like to separate build types into Debug/Release/Others and put those items compiled into those subfolders. If you try to have your output files put anywhere else you are endlessly "fighting the system" and in the you will waste more time trying to fight the system rather then working on your code. Unless you have a very valid reason why your built items MUST be in the binary folder then I wouldn't really worry where they land. Let Visual Studio or Xcode put them where they want. You only need to realize that there _are_ Debug and Release subfolders and it is in there that you will find your executables and libraries. This is said with about 3 or 4 years of working with Linux, OS X, Windows, Visual Studio, Xcode, Makefiles. Don't fight the system, just adapt to it and move on.
>
>  I guess that was harsh. Sorry. Having said that I am very interested in knowing the specific reasons why you need your executables in the CMAKE_BINARY_DIRECTORY and can not have them in a subfolder.
> --
> Mike Jackson <www.bluequartz.net>


More information about the CMake mailing list