Torsten Martinsen wrote:
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?
Try this:
SET_SOURCE_FILES_PROPERTIES( ${C_SOURCE} PROPERTIES LANGUAGE CXX)
It should work in 2.4.7, but the docs for 2.4.7 have not been updated to
include this,
but the code has it.
-Bill
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake