Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 25, 2010, 11:58:25 PM (13 years ago)
Author:
rgrieder
Message:

Changed source file handling procedure, especially for Qt moc files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/forks/sandbox_qt/cmake/tools/SourceFileUtilities.cmake

    r7415 r7805  
    3434
    3535FUNCTION(PREPARE_SOURCE_FILES)
    36   SET(_fullpath_sources)
     36  SET(_source_files)
    3737  FOREACH(_file ${ARGN})
    38     IF(_file STREQUAL "COMPILATION_BEGIN")
    39       SET(_compile TRUE)
    40       # Next file is the name of the compilation
    41       SET(_get_name TRUE)
    42     ELSEIF(_get_name)
    43       SET(_get_name FALSE)
    44       SET(_compilation_name ${_file})
    45     ELSEIF(_file STREQUAL "COMPILATION_END")
    46       IF(NOT _compilation_name)
    47         MESSAGE(FATAL_ERROR "No name provided for source file compilation")
    48       ENDIF()
    49       IF(NOT DISABLE_COMPILATIONS)
    50         SET(_compilation_file ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name})
    51         SET(_include_string)
    52         FOREACH(_file2 ${_compilation})
    53           SET(_include_string "${_include_string}#include \"${_file2}\"\n")
    54         ENDFOREACH(_file2)
    55         IF(EXISTS ${_compilation_file})
    56           FILE(READ ${_compilation_file} _include_string_file)
    57         ENDIF()
    58         IF(NOT _include_string STREQUAL "${_include_string_file}")
    59           FILE(WRITE ${_compilation_file} "${_include_string}")
    60         ENDIF()
    61         LIST(APPEND _fullpath_sources ${_compilation_file})
    62         # MSVC hack that excludes the compilations from the intellisense database
    63         # (There is a bug with the "-" instead of "/". Only works for "Zm#" argument)
    64         # 2nd Note: Exploiting this results in a strange separation of the compilation
    65         # file, causing the compiler not to use multi processing --> slower compiling.
    66         #IF(MSVC)
    67         #    SET_SOURCE_FILES_PROPERTIES(${_compilation_file} PROPERTIES COMPILE_FLAGS "-Zm1000")
    68         #ENDIF()
    69       ENDIF()
    70       SET(_compilation_name)
    71       SET(_compilation)
    72       SET(_compile FALSE)
     38    IF(_file MATCHES "^(COMPILATION_BEGIN|COMPILATION_END|QT)$")
     39      # Append keywords verbatim
     40      LIST(APPEND _source_files ${_file})
    7341    ELSE()
    74       # Prefix the full path
    75       GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION)
    76       LIST(APPEND _fullpath_sources ${_filepath})
    77       IF(_compile AND NOT DISABLE_COMPILATIONS)
    78         LIST(APPEND _compilation ${_filepath})
    79         LIST(APPEND _fullpath_sources "H")
    80       ENDIF()
     42      # Store file with path relative to the root source directory
     43      FILE(RELATIVE_PATH _file_rel ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
     44      LIST(APPEND _source_files ${_file_rel})
    8145    ENDIF()
    8246  ENDFOREACH(_file)
    83   SET(_fullpath_sources ${_fullpath_sources} PARENT_SCOPE)
     47  SET(_source_files ${_source_files} PARENT_SCOPE)
    8448ENDFUNCTION(PREPARE_SOURCE_FILES)
    8549
     
    8953  PREPARE_SOURCE_FILES(${ARGN})
    9054  # Write into the cache to avoid variable scoping in subdirs
    91   SET(${_varname} ${${_varname}} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
     55  SET(${_varname} ${${_varname}} ${_source_files} CACHE INTERNAL "Do not edit")
    9256ENDFUNCTION(ADD_SOURCE_FILES)
    9357
     
    9761  PREPARE_SOURCE_FILES(${ARGN})
    9862  # Write into the cache to avoid variable scoping in subdirs
    99   SET(${_varname} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
     63  SET(${_varname} ${_source_files} CACHE INTERNAL "Do not edit")
    10064ENDFUNCTION(SET_SOURCE_FILES)
    10165
     
    11377    GET_SOURCE_FILE_PROPERTY(_full_filepath ${_file} LOCATION)
    11478    FILE(RELATIVE_PATH _relative_path ${CMAKE_CURRENT_SOURCE_DIR} ${_full_filepath})
    115     IF(NOT _relative_path MATCHES "^\\.\\.")
     79    IF(NOT _relative_path MATCHES "^\\.\\./") # Has "../" at the beginning
    11680      GET_FILENAME_COMPONENT(_relative_path ${_relative_path} PATH)
    11781      STRING(REPLACE "/" "\\\\" _group_path "${_relative_path}")
Note: See TracChangeset for help on using the changeset viewer.