CMake: Don't always override target_link_libraries()

Previously, we would override target_link_libraries() to support
object "linking" since this wasn't supported in versions of CMake
before 3.12. Now that 3.12 is released, we only do it for versions
of CMake before that release.
This commit is contained in:
Sam Edwards 2018-10-10 20:16:04 -06:00
parent 90d3b29767
commit 47b5a50688

View File

@ -10,8 +10,9 @@
# #
# Overrides CMake's target_link_libraries() to support "linking" object # Overrides CMake's target_link_libraries() to support "linking" object
# libraries. This is a partial reimplementation of CMake commit dc38970f83, # libraries. This is a partial reimplementation of CMake commit dc38970f83,
# which as of this writing has not yet landed in any release. # which is only available in CMake 3.12+
# #
if(CMAKE_VERSION VERSION_LESS "3.12")
function(target_link_libraries target) function(target_link_libraries target)
get_target_property(target_type "${target}" TYPE) get_target_property(target_type "${target}" TYPE)
if(NOT target_type STREQUAL "OBJECT_LIBRARY") if(NOT target_type STREQUAL "OBJECT_LIBRARY")
@ -74,6 +75,7 @@ function(target_link_libraries target)
endforeach(library) endforeach(library)
endfunction(target_link_libraries) endfunction(target_link_libraries)
endif()
# #
# Function: add_component_library(target [SYMBOL building_symbol] # Function: add_component_library(target [SYMBOL building_symbol]