[CMake] debug/release subdirs in visual studio projects

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


Christian

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
ok.
then when loading them I do this...

//----------------------------------------------------------------------------
std::string GetResourcePath()
{
   std::string apppath = 
QCoreApplication::applicationDirPath().toAscii().constData();
   vtksys::SystemTools::ConvertToUnixSlashes(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);
   vtksys::SystemTools::ReplaceString(ResourceDir, 
"bin/debug/resources",          "bin/resources");
   vtksys::SystemTools::ReplaceString(ResourceDir, 
"bin/release/resources",        "bin/resources");
   vtksys::SystemTools::ReplaceString(ResourceDir, 
"bin/relwithdebinfo/resources", "bin/resources");
#endif
   return ResourceDir;
}

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

JB


> 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
http://www.cscs.ch/about/BJohn.php
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