You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

25 rivejä
1.1 KiB

  1. MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
  2. IF(MSVC)
  3. GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
  4. SET(PrecompiledBinary "${CMAKE_CFG_INTDIR}/${PrecompiledBasename}.pch")
  5. SET(Sources ${${SourcesVar}})
  6. SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
  7. PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\""
  8. OBJECT_OUTPUTS "${PrecompiledBinary}")
  9. # Do not consider .c files
  10. foreach(fname ${Sources})
  11. GET_FILENAME_COMPONENT(fext ${fname} EXT)
  12. if(fext STREQUAL ".cpp")
  13. SET_SOURCE_FILES_PROPERTIES(${fname}
  14. PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledBinary}\" /FI\"${PrecompiledBinary}\" /Fp\"${PrecompiledBinary}\""
  15. OBJECT_DEPENDS "${PrecompiledBinary}")
  16. endif(fext STREQUAL ".cpp")
  17. endforeach(fname)
  18. ENDIF(MSVC)
  19. # Add precompiled header to SourcesVar
  20. LIST(APPEND ${SourcesVar} ${PrecompiledSource})
  21. ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER)