[CMake] Defer compiler to different file in Visual Studio

Andreas Haferburg ahaferburg at scopis.com
Mon Mar 12 15:28:50 EDT 2012


Hello,

I'm currently evaluating Lazy C++ [1], which generates both header and 
source files. I'm using add_custom_command() to invoke the generator on 
*.lzz file, and for each .lzz file it generates one .hpp file and one 
.cpp file. What I'm missing is the ability to compile the file I'm 
currently editing from within Visual Studio.

With .cpp files it's possible to compile just one file, e.g. by 
right-clicking it in the Solution Explorer, then selecting "Compile". Or 
even better, bind it to a hotkey.

So what I'd like to do is for each lzz file, set the compile command to 
compile the corresponding cpp file. I can't imagine it being that hard, 
since one would merely have to change the file extension in the command 
line from cpp to lzz. Any ideas?

I'm not sure though, this might be more of a Visual Studio-specific 
question than a CMake-specific one.

Thanks,
Andreas

[1] http://www.lazycplusplus.com/index.html


More information about the CMake mailing list