[CMake] Forcing C++: What Causes VC Warning D4025 : overriding /TP with /TC

Steve Johns steve.johns at verizon.net
Fri Jun 30 07:32:34 EDT 2006


>> Code is a mix of .c and .cpp files.  Some of the directories contain only 
>> .c files.
>> ...
>>
>> SET(CMAKE_C_COMPILER ${CMAKE_CXX_COMPILER})
>> SET_TARGET_PROPERITES( <tgt> PROPERTIES LINKER_LANGUAGE CXX)
>>
>>
>> Warning D4025 : overriding /TP with /TC
>
>
> I reported the same bug (05.06.2006 21:33), too.
> Will already fixed it in CVS.

Jan,

Thank you for this info.  I'm now looking at something that seems relevant, 
but this look has raised more questions in my mind.

I am currently running the binary distro of 2-4-2
Inside:

cmLocalVisualStudio7Generator.cxx
Revision: 1.125.2.3, Sun May 14 19:22:42 2006 UTC (6 weeks, 4 days ago) by 
hoffman
Branch: CMake-2-4
CVS Tags: CMake-2-4-2
Changes since 1.125.2.2: +107 -62 lines

I find:

    // if the source file does not match the linker language
    // then force c or c++
    if(linkLanguage && lang && strcmp(lang, linkLanguage) != 0)
      {
      if(strcmp(lang, "CXX") == 0)
      {
      // force a C++ file type
      compileFlags += " /TP ";
        }
      else if(strcmp(lang, "C") == 0)
        {
        // force to c
        compileFlags += " /TC ";
        }
      }

If I'm reading this right (?), this is the CAUSE of the problem - i.e. this 
is where the trailing " /TC" gets added at the end of the build command, 
when lang == "C", which is when the file has a .c extension.  Is this right 
so far?

then I find, in this later version, ( later than 2-4-2, meaning it's not in 
my CMake executable, yes?) :

cmLocalVisualStudio7Generator.cxx
Revision 1.135 - (view) (download) (as text) (annotate) - [select for diffs]
Tue Jun 6 16:01:23 2006 UTC (3 weeks, 2 days ago) by hoffman
Branch: MAIN

ENH: fix /TP for c code

Is this the fix you refer to?

I looked at the diff for these two versions, and see that 1.135 adds code 
down around line 1167 dealing with flags in some way that I can't quickly 
decipher, but which has no immediately recognizable reference to "/TC " or 
"/TP ".

If this is the fix, and it works, I'd be interested to understand how it 
works.

If this is not the fix, I'm sorry for getting it wrong, and I'd welcome a 
pointer to the correct revision.

Finally, it seems that binary distros are prepared relatively infrequently. 
Is getting this:

>> SET(CMAKE_C_COMPILER ${CMAKE_CXX_COMPILER})
>> SET_TARGET_PROPERITES( <tgt> PROPERTIES LINKER_LANGUAGE CXX)

to work as intended in these circumstances not judged important enough to 
warrant a 2-4-3 build?

It would be helpful, if possible, to be able to refer my development 
partner(s) to a binary distro of CMake that handles this situation.

If I have to bite the bullet and start compiling CMake's own source code, 
and getting partner(s) to do same, I imagine we can and will, but if 
generating a 2-4-3 binary at "home base" is not hard, perhaps it would be 
worthwhile and save some people from extra work and possible issues in the 
field.

- Steve



More information about the CMake mailing list