Changeset 10187
- Timestamp:
- Jan 10, 2015, 2:48:02 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/cmake/tools/PrecompiledHeaderFiles.cmake
r9685 r10187 98 98 ELSEIF(CMAKE_COMPILER_IS_GNU) 99 99 100 SET(_pch_file "${CMAKE_CURRENT_BINARY_DIR}/${_pch_header_filename}.gch")101 SET(_pch_dep_helper_file "${CMAKE_CURRENT_BINARY_DIR}/${_target_name}PCHDependencyHelper.h")102 103 100 # Append the gch-dir to make sure gcc finds the pch file 104 101 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) 105 106 # Get compiler flags of the source files (target does not yet exist!)107 # This is just the best possible opportunity to address this dependency issue108 GET_GCC_COMPILER_FLAGS(${_target_name} _pch_gcc_flags)109 # Make sure we recompile the pch file even if only the flags change110 IF(NOT "${_pch_gcc_flags}" STREQUAL "${_INTERNAL_${_target_name}_PCH_GCC_FLAGS}" OR NOT EXISTS "${_pch_dep_helper_file}")111 SET(_INTERNAL_${_target_name}_PCH_GCC_FLAGS "${_pch_gcc_flags}" CACHE INTERNAL "")112 FILE(WRITE ${_pch_dep_helper_file} "/* ${_pch_gcc_flags} */")113 ENDIF()114 102 115 103 # Set Compile flags for the other source files … … 136 124 IF(CMAKE_COMPILER_IS_GNU) 137 125 126 SET(_pch_file "${CMAKE_CURRENT_BINARY_DIR}/${_pch_header_filename}.gch") 127 SET(_pch_dep_helper_file "${CMAKE_CURRENT_BINARY_DIR}/${_target_name}PCHDependencyHelper.h") 128 138 129 # Workaround for distcc 139 130 IF(CMAKE_CXX_COMPILER_ARG1) … … 142 133 ENDIF() 143 134 144 # Get compiler flags of the source files again (target exists this time)135 # Get compiler flags of the source files 145 136 GET_GCC_COMPILER_FLAGS(${_target_name} _pch_gcc_flags) 137 138 # Make sure we recompile the pch file even if only the flags change 139 IF(NOT "${_pch_gcc_flags}" STREQUAL "${_INTERNAL_${_target_name}_PCH_GCC_FLAGS}" OR NOT EXISTS "${_pch_dep_helper_file}") 140 SET(_INTERNAL_${_target_name}_PCH_GCC_FLAGS "${_pch_gcc_flags}" CACHE INTERNAL "") 141 FILE(WRITE ${_pch_dep_helper_file} "/* ${_pch_gcc_flags} */") 142 ENDIF() 146 143 147 144 # Compile the header file
Note: See TracChangeset
for help on using the changeset viewer.