[CMAKE]: Introduce a evil workaround for the problem described in CORE-12205/CORE-12206, that was unveiled by commit r73024. CMake gurus, please review & make suggestions! :)

svn path=/trunk/; revision=73027
This commit is contained in:
Hermès Bélusca-Maïto 2016-10-22 22:51:34 +00:00
parent 00a8b0a3c8
commit 6fcebba53b

View file

@ -496,6 +496,18 @@ elseif(USE_FOLDER_STRUCTURE)
function(add_library name)
_add_library(${name} ${ARGN})
##
## The following is a workaround for a CMake bug. Inspired by:
## http://stackoverflow.com/questions/24926868/cmake-3-0-add-library-of-type-interface-breaks-get-target-property
##
## Beginning of the workaround:
get_target_property(_TARGET_TYPE ${name} TYPE)
if(_TARGET_TYPE STREQUAL "INTERFACE_LIBRARY")
unset(_target_excluded)
else()
##
## This is the original code:
##
get_target_property(_target_excluded ${name} EXCLUDE_FROM_ALL)
if(_target_excluded AND ${name} MATCHES "^lib.*")
set_property(TARGET "${name}" PROPERTY FOLDER "Importlibs")
@ -503,6 +515,10 @@ elseif(USE_FOLDER_STRUCTURE)
string(SUBSTRING ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR_LENGTH} -1 CMAKE_CURRENT_SOURCE_DIR_RELATIVE)
set_property(TARGET "${name}" PROPERTY FOLDER "${CMAKE_CURRENT_SOURCE_DIR_RELATIVE}")
endif()
##
## End of workaround
endif()
##
endfunction()
function(add_executable name)