mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
cmake: Fix AutoInclude workaround always being used irrespective of version.
Also fixes Interrogate's reliance on the INTERFACE_INCLUDE_DIRECTORIES target property before generation time by using a generator expression to determine Interrogate's include flags.
This commit is contained in:
parent
f45b4a7917
commit
e58697bee4
@ -167,18 +167,13 @@ function(interrogate_sources target output database module)
|
|||||||
endforeach(source)
|
endforeach(source)
|
||||||
|
|
||||||
# Interrogate also needs the include paths, so we'll extract them from the
|
# Interrogate also needs the include paths, so we'll extract them from the
|
||||||
# target:
|
# target using a generator expression.
|
||||||
set(include_flags)
|
# Note, the \t is a workaround for a CMake bug where using a plain space in
|
||||||
get_target_property(include_dirs "${target}" INTERFACE_INCLUDE_DIRECTORIES)
|
# a JOIN will cause it to be escaped. Tabs are not escaped and will
|
||||||
foreach(include_dir ${include_dirs})
|
# separate correctly.
|
||||||
# To keep the command-line small, also make this relative:
|
set(include_flags "-I$<JOIN:$<TARGET_PROPERTY:${target},INTERFACE_INCLUDE_DIRECTORIES>,\t-I>")
|
||||||
# Note that Interrogate does NOT handle -I paths relative to -srcdir, so
|
|
||||||
# we make them relative to the directory where it's invoked.
|
|
||||||
file(RELATIVE_PATH rel_include_dir "${CMAKE_CURRENT_BINARY_DIR}" "${include_dir}")
|
|
||||||
list(APPEND include_flags "-I${rel_include_dir}")
|
|
||||||
endforeach(include_dir)
|
|
||||||
# The above must also be included when compiling the resulting _igate.cxx file:
|
# The above must also be included when compiling the resulting _igate.cxx file:
|
||||||
include_directories(${include_dirs})
|
include_directories("$<TARGET_PROPERTY:${target},INTERFACE_INCLUDE_DIRECTORIES>")
|
||||||
|
|
||||||
# Get the compiler definition flags. These must be passed to Interrogate
|
# Get the compiler definition flags. These must be passed to Interrogate
|
||||||
# in the same way that they are passed to the compiler so that Interrogate
|
# in the same way that they are passed to the compiler so that Interrogate
|
||||||
|
@ -6,10 +6,7 @@
|
|||||||
|
|
||||||
# Emulate CMake 2.8.11's CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE behavior if
|
# Emulate CMake 2.8.11's CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE behavior if
|
||||||
# this version doesn't define CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE.
|
# this version doesn't define CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE.
|
||||||
# CFSworks's version of CMake (2.8.12) doesn't have
|
if(CMAKE_VERSION VERSION_LESS 2.8.11)
|
||||||
# CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE even though it should be supported,
|
|
||||||
# hence test if it's defined (as either ON or OFF) before trying to use it.
|
|
||||||
if("${CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE}" STREQUAL "")
|
|
||||||
# Replace some built-in functions in order to extend their functionality.
|
# Replace some built-in functions in order to extend their functionality.
|
||||||
function(add_library target)
|
function(add_library target)
|
||||||
_add_library(${target} ${ARGN})
|
_add_library(${target} ${ARGN})
|
||||||
@ -26,11 +23,13 @@ if("${CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE}" STREQUAL "")
|
|||||||
get_target_property(target_interface_dirs "${target}" INTERFACE_INCLUDE_DIRECTORIES)
|
get_target_property(target_interface_dirs "${target}" INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
|
|
||||||
foreach(lib ${ARGN})
|
foreach(lib ${ARGN})
|
||||||
|
if(TARGET "${lib}")
|
||||||
get_target_property(lib_interface_dirs "${lib}" INTERFACE_INCLUDE_DIRECTORIES)
|
get_target_property(lib_interface_dirs "${lib}" INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
|
|
||||||
if(lib_interface_dirs)
|
if(lib_interface_dirs)
|
||||||
list(APPEND interface_dirs ${lib_interface_dirs})
|
list(APPEND interface_dirs ${lib_interface_dirs})
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(interface_dirs)
|
if(interface_dirs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user