rd-cpp/PrecompiledHeader.cmake [120:214]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
endfunction()

function (gcc_pch_targets_for_mode _input _pch_path mode)
  get_filename_component(_name ${_input} NAME)
  set(_pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
  set(_pch_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/${_target}_${mode}_pch")
  set(_pchfile "${_pch_binary_dir}/${_input}")

  string(REGEX MATCH  "\.\.[/\\]" _has_parent_access "${_input}")
  if( "${_pch_path}" STREQUAL "" AND _has_parent_access)
    message(FATAL_ERROR "Precompiled header name contains ../, please specify an outputh path with the PCH_PATH option")
  endif()

  if( NOT "${_pch_path}" STREQUAL "" )
    set(_pchfile "${_pch_binary_dir}/${_pch_path}")
  endif()
  set(_output "${_pch_binary_dir}/${_input}.gch")
  if( NOT "${_pch_path}" STREQUAL "" )
    set(_output "${_pch_binary_dir}/${_pch_path}.gch")
  endif()

  set(_pch_flags_file "${_pch_binary_dir}/compile_flags.rsp")
  export_all_flags("${_pch_flags_file}" ${mode})
  set(_compiler_FLAGS "@${_pch_flags_file}")
  add_custom_command(
          OUTPUT "${_pchfile}"
          COMMAND "${CMAKE_COMMAND}" -E copy "${_pch_header}" "${_pchfile}"
          DEPENDS "${_pch_header}"
          COMMENT "Updating ${_name} (${mode})")
  if("${mode}" STREQUAL "CXX")
    add_custom_command(
            OUTPUT "${_output}"
            COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output}" "${_pchfile}"
            DEPENDS "${_pchfile}" "${_pch_flags_file}"
            COMMENT "Precompiling ${_name} for ${_target} (C++)")
  endif()
  if("${mode}" STREQUAL "C")
    add_custom_command(
            OUTPUT "${_output}"
            COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS_c} -x c-header -o "${_output}" "${_pchfile}"
            DEPENDS "${_pchfile}" "${_pch_flags_file}"
            COMMENT "Precompiling ${_name} for ${_target} (C)")
  endif()

  set(_extensions "")
  if("${mode}" STREQUAL "CXX")
    set(_extensions "cc|cxx|cpp")
  endif()
  if("${mode}" STREQUAL "C")
    set(_extensions "c")
  endif()

  get_property(_sources TARGET ${_target} PROPERTY SOURCES)
  foreach(_source ${_sources})
    set(_pch_compile_flags "")
    if(_source MATCHES \\.\(${_extensions}\)$)
      get_source_file_property(_pch_compile_flags "${_source}" COMPILE_FLAGS)
      if(NOT _pch_compile_flags)
        set(_pch_compile_flags)
      endif()
      separate_arguments(_pch_compile_flags)
      list(APPEND _pch_compile_flags -Winvalid-pch)
      if(_PCH_FORCEINCLUDE)
        list(APPEND _pch_compile_flags -include "${_pchfile}")
      else(_PCH_FORCEINCLUDE)
        list(APPEND _pch_compile_flags "-I${_pch_binary_dir}")
      endif(_PCH_FORCEINCLUDE)

      get_source_file_property(_object_depends "${_source}" OBJECT_DEPENDS)
      if(NOT _object_depends)
        set(_object_depends)
      endif()
      list(APPEND _object_depends "${_pchfile}")
      list(APPEND _object_depends "${_output}")

      combine_arguments(_pch_compile_flags)
      set_source_files_properties(${_source} PROPERTIES
              COMPILE_FLAGS "${_pch_compile_flags}"
              OBJECT_DEPENDS "${_object_depends}")
    endif()
  endforeach()
endfunction()

function(add_precompiled_header _target _input)
  cmake_parse_arguments(_PCH "FORCEINCLUDE" "SOURCE_CXX;SOURCE_C;PCH_PATH" "" ${ARGN})

  get_filename_component(_input_we ${_input} NAME_WE)
  if(NOT _PCH_SOURCE_CXX)
    set(_PCH_SOURCE_CXX "${_input_we}.cpp")
  endif()
  if(NOT _PCH_SOURCE_C)
    set(_PCH_SOURCE_C "${_input_we}.c")
  endif()

  if(MSVC)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



rd-kt/rd-gen/src/main/resources/cpp/PrecompiledHeader.cmake [115:209]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
endfunction()

function (gcc_pch_targets_for_mode _input _pch_path mode)
  get_filename_component(_name ${_input} NAME)
  set(_pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
  set(_pch_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/${_target}_${mode}_pch")
  set(_pchfile "${_pch_binary_dir}/${_input}")

  string(REGEX MATCH  "\.\.[/\\]" _has_parent_access "${_input}")
  if( "${_pch_path}" STREQUAL "" AND _has_parent_access)
    message(FATAL_ERROR "Precompiled header name contains ../, please specify an outputh path with the PCH_PATH option")
  endif()

  if( NOT "${_pch_path}" STREQUAL "" )
    set(_pchfile "${_pch_binary_dir}/${_pch_path}")
  endif()
  set(_output "${_pch_binary_dir}/${_input}.gch")
  if( NOT "${_pch_path}" STREQUAL "" )
    set(_output "${_pch_binary_dir}/${_pch_path}.gch")
  endif()

  set(_pch_flags_file "${_pch_binary_dir}/compile_flags.rsp")
  export_all_flags("${_pch_flags_file}" ${mode})
  set(_compiler_FLAGS "@${_pch_flags_file}")
  add_custom_command(
          OUTPUT "${_pchfile}"
          COMMAND "${CMAKE_COMMAND}" -E copy "${_pch_header}" "${_pchfile}"
          DEPENDS "${_pch_header}"
          COMMENT "Updating ${_name} (${mode})")
  if("${mode}" STREQUAL "CXX")
    add_custom_command(
            OUTPUT "${_output}"
            COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output}" "${_pchfile}"
            DEPENDS "${_pchfile}" "${_pch_flags_file}"
            COMMENT "Precompiling ${_name} for ${_target} (C++)")
  endif()
  if("${mode}" STREQUAL "C")
    add_custom_command(
            OUTPUT "${_output}"
            COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS_c} -x c-header -o "${_output}" "${_pchfile}"
            DEPENDS "${_pchfile}" "${_pch_flags_file}"
            COMMENT "Precompiling ${_name} for ${_target} (C)")
  endif()

  set(_extensions "")
  if("${mode}" STREQUAL "CXX")
    set(_extensions "cc|cxx|cpp")
  endif()
  if("${mode}" STREQUAL "C")
    set(_extensions "c")
  endif()

  get_property(_sources TARGET ${_target} PROPERTY SOURCES)
  foreach(_source ${_sources})
    set(_pch_compile_flags "")
    if(_source MATCHES \\.\(${_extensions}\)$)
      get_source_file_property(_pch_compile_flags "${_source}" COMPILE_FLAGS)
      if(NOT _pch_compile_flags)
        set(_pch_compile_flags)
      endif()
      separate_arguments(_pch_compile_flags)
      list(APPEND _pch_compile_flags -Winvalid-pch)
      if(_PCH_FORCEINCLUDE)
        list(APPEND _pch_compile_flags -include "${_pchfile}")
      else(_PCH_FORCEINCLUDE)
        list(APPEND _pch_compile_flags "-I${_pch_binary_dir}")
      endif(_PCH_FORCEINCLUDE)

      get_source_file_property(_object_depends "${_source}" OBJECT_DEPENDS)
      if(NOT _object_depends)
        set(_object_depends)
      endif()
      list(APPEND _object_depends "${_pchfile}")
      list(APPEND _object_depends "${_output}")

      combine_arguments(_pch_compile_flags)
      set_source_files_properties(${_source} PROPERTIES
              COMPILE_FLAGS "${_pch_compile_flags}"
              OBJECT_DEPENDS "${_object_depends}")
    endif()
  endforeach()
endfunction()

function(add_precompiled_header _target _input)
  cmake_parse_arguments(_PCH "FORCEINCLUDE" "SOURCE_CXX;SOURCE_C;PCH_PATH" "" ${ARGN})

  get_filename_component(_input_we ${_input} NAME_WE)
  if(NOT _PCH_SOURCE_CXX)
    set(_PCH_SOURCE_CXX "${_input_we}.cpp")
  endif()
  if(NOT _PCH_SOURCE_C)
    set(_PCH_SOURCE_C "${_input_we}.c")
  endif()

  if(MSVC)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



