Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10187 for code/trunk/cmake


Ignore:
Timestamp:
Jan 10, 2015, 2:48:02 PM (10 years ago)
Author:
landauf
Message:

fixed dependency issue in cmake script (which also fixes a bunch of warnings with cmake 3.1). I hope this works because I don't really understand why it was done like that before.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/cmake/tools/PrecompiledHeaderFiles.cmake

    r9685 r10187  
    9898  ELSEIF(CMAKE_COMPILER_IS_GNU)
    9999
    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 
    103100    # Append the gch-dir to make sure gcc finds the pch file
    104101    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 issue
    108     GET_GCC_COMPILER_FLAGS(${_target_name} _pch_gcc_flags)
    109     # Make sure we recompile the pch file even if only the flags change
    110     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()
    114102
    115103    # Set Compile flags for the other source files
     
    136124    IF(CMAKE_COMPILER_IS_GNU)
    137125
     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
    138129      # Workaround for distcc
    139130      IF(CMAKE_CXX_COMPILER_ARG1)
     
    142133      ENDIF()
    143134
    144       # Get compiler flags of the source files again (target exists this time)
     135      # Get compiler flags of the source files
    145136      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()
    146143
    147144      # Compile the header file
Note: See TracChangeset for help on using the changeset viewer.