[CMake] VC7.1 project files and /TP

Torsten Martinsen tma at gatehouse.dk
Tue Jul 24 08:05:05 EDT 2007


Hi,
 
I have a library that contains both C++ and C files. For various
reasons, the C files must be compiled as C++. In my CMakeLists.txt file
I have

	IF(OPT_DEST_VISUALSTUDIO)
	   ADD_DEFINITIONS(-TP)
	ENDIF(OPT_DEST_VISUALSTUDIO)
 
This works fine for "NMake Makefiles" output, but for "Visual Studio 7
.NET 2003" the C files are always compiled with /TP (and in the project
file, "Compile As" is set to "Compile as C Code (/TC)". Looking at
cmLocalVisualStudio7Generator.cxx, it looks as if this is indeed
hardcoded:

    if(strcmp(linkLanguage, "C") == 0)
    {
        flags += " /TC ";
    }
    if(strcmp(linkLanguage, "CXX") == 0)
    {
        flags += " /TP ";
    }

I have also tried

	SET_SOURCE_FILES_PROPERTIES(
	   ${C_SOURCE}
	   PROPERTIES COMPILE_FLAGS "-TP")

with the same (lack of) result. Any ideas?

-Torsten

This e-mail and any files sent with it contain information that may be privileged or confidential and is the property of the GateHouse Group. This information is intended solely for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use the message or any part thereof. If you have received this e-mail in error, please notify the sender immediately, and delete all copies of this message. In accordance with GateHouse Security Policy, e-mails sent or received may be monitored. 


More information about the CMake mailing list