File: PrecompiledHeader.cmake

package info (click to toggle)
assimp 5.4.3%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 100,104 kB
  • sloc: cpp: 164,162; cobol: 65,664; ansic: 16,520; xml: 11,246; python: 5,311; java: 2,303; sh: 398; objc: 122; pascal: 100; makefile: 66
file content (25 lines) | stat: -rw-r--r-- 1,018 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
  IF(MSVC)
    GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
    SET(PrecompiledBinary "${CMAKE_CFG_INTDIR}/${PrecompiledBasename}.pch")
    SET(Sources ${${SourcesVar}})

    SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
      PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\""
      OBJECT_OUTPUTS "${PrecompiledBinary}")

    # Do not consider .c files
    foreach(fname ${Sources}) 
      GET_FILENAME_COMPONENT(fext ${fname} EXT)
      if(fext STREQUAL ".cpp")
	SET_SOURCE_FILES_PROPERTIES(${fname}
	  PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledBinary}\" /FI\"${PrecompiledBinary}\" /Fp\"${PrecompiledBinary}\""
          OBJECT_DEPENDS "${PrecompiledBinary}")     
      endif(fext STREQUAL ".cpp")
    endforeach(fname) 

  ENDIF(MSVC)
  # Add precompiled header to SourcesVar
  LIST(APPEND ${SourcesVar} ${PrecompiledSource})

ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER)