[CMake] Visual Studio 6 generator and relative source file path

Alexey Livshits livchits at web.de
Wed Mar 30 09:09:22 EDT 2011


I've already posted the question about different targets with the same
name. I'm trying to change my project's cmake configuration towards it
like this (this is a very simplicated example):

|-- foo
|---- cmake_foo1
|------- CMakeLists.txt
|---- cmake_foo2
|------- CMakeLists.txt
|
|---- bar.cpp
|---- CMakeLists.txt
|---- foo.cpp
|---- foo.rc

cmake_foo1/CMakeLists.txt:
add_library(foo1 ../bar.cpp ../foo.cpp ../foo.rc)

cmake_foo2/CMakeLists.txt ist similar.

I've got the wrong intermediate path for foo.cpp and foo.rc, because
CMake thinks, its the same filename, so it must generate the output in
different dirs.
I've got the cmake source code and tried to debug. I've found out,
that the function cmLocalVisualStudioGenerator::CountObjectNames
calculates object file name wrong. It adds "obj" regardless source
file type. It must be
-----
objectName += this->GlobalGenerator->GetLanguageOutputExtension(*sf)
-----
instead.

I think, its a easy fix.
-- 
BG,
Alexey


More information about the CMake mailing list