Quellcode durchsuchen

fix bugs related to handling of interface libraries

master
Sascha Kratky vor 10 Jahren
Ursprung
Commit
6b1f2c888d
1 geänderte Dateien mit 42 neuen und 9 gelöschten Zeilen
  1. +42
    -9
      CMake/cotire.cmake

+ 42
- 9
CMake/cotire.cmake Datei anzeigen

@@ -389,6 +389,24 @@ function (cotire_filter_compile_flags _language _flagFilter _matchedOptionsVar _
set (${_unmatchedOptionsVar} ${_unmatchedOptions} PARENT_SCOPE) set (${_unmatchedOptionsVar} ${_unmatchedOptions} PARENT_SCOPE)
endfunction() endfunction()


function (cotire_is_target_supported _target _isSupportedVar)
if (NOT TARGET "${_target}")
set (${_isSupportedVar} FALSE PARENT_SCOPE)
return()
endif()
get_target_property(_imported ${_target} IMPORTED)
if (_imported)
set (${_isSupportedVar} FALSE PARENT_SCOPE)
return()
endif()
get_target_property(_targetType ${_target} TYPE)
if (NOT _targetType MATCHES "EXECUTABLE|(STATIC|SHARED|MODULE|OBJECT)_LIBRARY")
set (${_isSupportedVar} FALSE PARENT_SCOPE)
return()
endif()
set (${_isSupportedVar} TRUE PARENT_SCOPE)
endfunction()

function (cotire_get_target_compile_flags _config _language _target _flagsVar) function (cotire_get_target_compile_flags _config _language _target _flagsVar)
string (TOUPPER "${_config}" _upperConfig) string (TOUPPER "${_config}" _upperConfig)
# collect options from CMake language variables # collect options from CMake language variables
@@ -3029,10 +3047,16 @@ function (cotire_target _target)
if (NOT _option_CONFIGURATIONS) if (NOT _option_CONFIGURATIONS)
cotire_get_configuration_types(_option_CONFIGURATIONS) cotire_get_configuration_types(_option_CONFIGURATIONS)
endif() endif()
# trivial checks
get_target_property(_imported ${_target} IMPORTED)
if (_imported)
message (WARNING "cotire: imported target ${_target} cannot be cotired.")
# check if cotire can be applied to target at all
cotire_is_target_supported(${_target} _isSupported)
if (NOT _isSupported)
get_target_property(_imported ${_target} IMPORTED)
get_target_property(_targetType ${_target} TYPE)
if (_imported)
message (WARNING "cotire: imported ${_targetType} target ${_target} cannot be cotired.")
else()
message (STATUS "cotire: ${_targetType} target ${_target} cannot be cotired.")
endif()
return() return()
endif() endif()
# resolve alias # resolve alias
@@ -3097,11 +3121,16 @@ endfunction(cotire_target)
function (cotire_map_libraries _strategy _mappedLibrariesVar) function (cotire_map_libraries _strategy _mappedLibrariesVar)
set (_mappedLibraries "") set (_mappedLibraries "")
foreach (_library ${ARGN}) foreach (_library ${ARGN})
if (TARGET "${_library}" AND "${_strategy}" MATCHES "COPY_UNITY")
# use target's corresponding unity target, if available
get_target_property(_libraryUnityTargetName ${_library} COTIRE_UNITY_TARGET_NAME)
if (TARGET "${_libraryUnityTargetName}")
list (APPEND _mappedLibraries "${_libraryUnityTargetName}")
if ("${_strategy}" MATCHES "COPY_UNITY")
cotire_is_target_supported(${_library} _isSupported)
if (_isSupported)
# use target's corresponding unity target, if available
get_target_property(_libraryUnityTargetName ${_library} COTIRE_UNITY_TARGET_NAME)
if (TARGET "${_libraryUnityTargetName}")
list (APPEND _mappedLibraries "${_libraryUnityTargetName}")
else()
list (APPEND _mappedLibraries "${_library}")
endif()
else() else()
list (APPEND _mappedLibraries "${_library}") list (APPEND _mappedLibraries "${_library}")
endif() endif()
@@ -3114,6 +3143,10 @@ function (cotire_map_libraries _strategy _mappedLibrariesVar)
endfunction() endfunction()


function (cotire_target_link_libraries _target) function (cotire_target_link_libraries _target)
cotire_is_target_supported(${_target} _isSupported)
if (NOT _isSupported)
return()
endif()
get_target_property(_unityTargetName ${_target} COTIRE_UNITY_TARGET_NAME) get_target_property(_unityTargetName ${_target} COTIRE_UNITY_TARGET_NAME)
if (TARGET "${_unityTargetName}") if (TARGET "${_unityTargetName}")
get_target_property(_linkLibrariesStrategy ${_target} COTIRE_UNITY_LINK_LIBRARIES_INIT) get_target_property(_linkLibrariesStrategy ${_target} COTIRE_UNITY_LINK_LIBRARIES_INIT)


Laden…
Abbrechen
Speichern