Browse Source

make precompiled header compilation depend on the actual compiler executable

master
Sascha Kratky 8 years ago
parent
commit
66c5491538
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      CMake/cotire.cmake

+ 6
- 2
CMake/cotire.cmake View File

@@ -2206,14 +2206,18 @@ function (cotire_setup_pch_file_compilation _language _target _targetScript _pre
else() else()
file (RELATIVE_PATH _pchFileLogPath "${CMAKE_BINARY_DIR}" "${_pchFile}") file (RELATIVE_PATH _pchFileLogPath "${CMAKE_BINARY_DIR}" "${_pchFile}")
endif() endif()
# make precompiled header compilation depend on the actual compiler executable to force
# re-compilation when the compiler executable is updated. This prevents "created by a different GCC executable"
# warnings when the precompiled header is included.
get_filename_component(_realCompilerExe "${CMAKE_${_language}_COMPILER}" ABSOLUTE)
if (COTIRE_DEBUG) if (COTIRE_DEBUG)
message (STATUS "add_custom_command: OUTPUT ${_pchFile} ${_cmds} DEPENDS ${_prefixFile} IMPLICIT_DEPENDS ${_language} ${_prefixFile}")
message (STATUS "add_custom_command: OUTPUT ${_pchFile} ${_cmds} DEPENDS ${_prefixFile} ${_realCompilerExe} IMPLICIT_DEPENDS ${_language} ${_prefixFile}")
endif() endif()
set_property (SOURCE "${_pchFile}" PROPERTY GENERATED TRUE) set_property (SOURCE "${_pchFile}" PROPERTY GENERATED TRUE)
add_custom_command( add_custom_command(
OUTPUT "${_pchFile}" OUTPUT "${_pchFile}"
COMMAND ${_cmds} COMMAND ${_cmds}
DEPENDS "${_prefixFile}"
DEPENDS "${_prefixFile}" "${_realCompilerExe}"
IMPLICIT_DEPENDS ${_language} "${_prefixFile}" IMPLICIT_DEPENDS ${_language} "${_prefixFile}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Building ${_language} precompiled header ${_pchFileLogPath}" COMMENT "Building ${_language} precompiled header ${_pchFileLogPath}"


Loading…
Cancel
Save