My team has been using precompiled headers under CMake and Visual Studio 2008
for quite a while. Now we've switched to VS 2010, the cmake code we used to
support precompiled headers is no longer working.
The following is the code in question and we're just using
set_source_files_properties to add the appropreiate /Yc , /Yu and /FI flags.
It appears, under VS 2010, the property manager is not accepting or over
writing these settings.
Doesn't anyone know how to get precompiled headers working under CMake for
Visual Studio 2010?
IF(EXISTS ${pch_unity})
FILE(READ ${pch_unity} buffer)
ENDIF(EXISTS ${pch_unity})
IF(NOT (${buffer} STREQUAL ${file_contents}))
FILE(WRITE ${pch_unity} ${file_contents})
ENDIF(NOT (${buffer} STREQUAL ${file_contents}))
SET_SOURCE_FILES_PROPERTIES(${pch_unity} PROPERTIES COMPILE_FLAGS
"/Yc\"${pch_abs}\"")
###########################################################
#
# Update properties of source files to use the precompiled header.
# Additionally, force the inclusion of the precompiled header at beginning of
each source file.
#
FOREACH(source_file ${srcFilesThatUsePCH} )
SET_SOURCE_FILES_PROPERTIES(
${source_file}
PROPERTIES COMPILE_FLAGS
"/Yu\"${pch_abs}\" /FI\"${pch_abs}\""
)
ENDFOREACH(source_file)
###########################################################
#
# Finally, update the source file collection to contain the precompiled header
translation unit
#
SET(${FILES_VARIABLE_NAME} ${${FILES_VARIABLE_NAME}} ${pch_unity} PARENT_SCOPE)
++David->Bjornbak;
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake