[CMake] Building to a subdirectory UNDER Debug/Release/etc in a Visual Studio build

Timenkov Yuri ytimenkov at parallels.com
Fri Jun 20 11:51:15 EDT 2008


On Friday 20 June 2008 18:48:18 Mike Arthur wrote:
> Part 3 in my never-ending quest to replace our Visual-Studio-based build 
> system with CMake has me tearing my hair out...
> 
> I've set CMAKE_RUNTIME_OUTPUT_DIRECTORY to bin so everything is build 
> correctly in bin/Debug or bin/Release depending on the project.
> 
> What I'm trying to do now is get something built in bin/Debug/modules or 
> bin/Release/modules or, if not built there, then at least copied there later.
> 
> I, however, can't seem to find any way in CMake to allow me to do this.
If I'm right, CMake doesn't allow to specify anything after $(Configuration) in output directory.
However, (theoretically) you can copy modules to bin/Release/modules by using add_custom_command(TARGET ... POST_BUILD). You can use some Visual Studio variables there.

However, if you have complex deployment layout, you should prefer installing your project and running from target location. Trying to make in-source runs may be endless pain, while installing your project may require couple of seconds each run, but saving much more time, because you won't need to investigate why particular library is not loaded or loaded from wrong place.

> 
> Setting CMAKE_RUNTIME_OUTPUT_DIRECTORY to bin/modules just puts the modules in 
> bin/modules/Release or bin/modules/Debug.
> 
> Any ideas before I go mad?
> 
> Thanks guys!
> 




More information about the CMake mailing list