[CMake] debug/release subdirs in visual studio projects

John Biddiscombe biddisco at cscs.ch
Wed Jun 14 07:25:08 EDT 2006


This is not the solution that you want...but it works for me

I use a configure step in cmake to copy any resource the app will need 
them to the build dir in the location ${PROJECT_BINARY_DIR}/resources
then when loading them I do this...

std::string GetResourcePath()
   std::string apppath = 
   if (!vtksys::SystemTools::FileIsDirectory(apppath.c_str())) {
     throw std::runtime_error("Can't locate Resources");
   std::string ResourceDir = apppath + "/resources";
#if WIN32
   ResourceDir = vtksys::SystemTools::LowerCase(ResourceDir);
"bin/debug/resources",          "bin/resources");
"bin/release/resources",        "bin/resources");
"bin/relwithdebinfo/resources", "bin/resources");
   return ResourceDir;

on win32 it does what we want. on other system it is just skipped.


> This had been discussed in
> http://public.kitware.com/pipermail/cmake/2004-January/004644.html
> Now more than two years have passed by and the problem still remains. In
> visual studio the generated files go into a Release/Debug subdir
> depending on the build type choosen in the IDE. If your application
> depends on relative pathes to find other stuff (like plugins) this is a
> problem. I really would like to skip these subdirs to make the directory
> structure of the build output identitcal to what you get with nmake or make.
> Any ideas?
> Christian
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake

John Biddiscombe,                            email:biddisco @ cscs.ch
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82

More information about the CMake mailing list