[CMake] How to make Visual Studio .vcproj with relative paths

Bill Hoffman bill.hoffman at kitware.com
Tue Mar 25 15:36:57 EDT 2008


Ben Ratzlaff wrote:
> I cant help but comment that this is unnecessarily complicated when
> all that is desired is simply compiling without the Cmake dependency.
> Conceptually it should not be this hard.
> 
> Recently I was tasked to help develop a small static library (4 source
> files), the primay developer works in Linux and the library will be
> primarily used in Linux. Thankfully we use CMake and the visual studio
> project file was created without any hassle at all (woot!)
> 
> I still needed to make a visual studio tweak: "compile .c files as
> c++". I would make the change in the IDE, but every so often CMake
> would regenerate the project and force me to do it again. Its
> irritating, but the time fixing CMakeLists.txt adds nothing when win32
> is not the target platform this library runs on.

see set_source_file_properties and set the LANGUAGE to CXX for getting 
.c files to compile as c++.
> 
> So yes, an option to generate a project without CMake dependency would
> be value-added for me.
> 

Although not strictly supported.  If you set CMAKE_SUPPRESS_REGENERATION 
to true, and CMAKE_USE_RELATIVE_PATHS to true, you might get things to 
work for a small project.   Doing it from Linux is not currently possible.

-Bill


More information about the CMake mailing list