72 lines
3.5 KiB
CMake
72 lines
3.5 KiB
CMake
# Avoid multiple calls to find_package to append duplicated properties to the targets
|
|
include_guard()########### VARIABLES #######################################################################
|
|
#############################################################################################
|
|
set(imgui_FRAMEWORKS_FOUND_NONE "") # Will be filled later
|
|
conan_find_apple_frameworks(imgui_FRAMEWORKS_FOUND_NONE "${imgui_FRAMEWORKS_NONE}" "${imgui_FRAMEWORK_DIRS_NONE}")
|
|
|
|
set(imgui_LIBRARIES_TARGETS "") # Will be filled later
|
|
|
|
|
|
######## Create an interface target to contain all the dependencies (frameworks, system and conan deps)
|
|
if(NOT TARGET imgui_DEPS_TARGET)
|
|
add_library(imgui_DEPS_TARGET INTERFACE IMPORTED)
|
|
endif()
|
|
|
|
set_property(TARGET imgui_DEPS_TARGET
|
|
APPEND PROPERTY INTERFACE_LINK_LIBRARIES
|
|
$<$<CONFIG:None>:${imgui_FRAMEWORKS_FOUND_NONE}>
|
|
$<$<CONFIG:None>:${imgui_SYSTEM_LIBS_NONE}>
|
|
$<$<CONFIG:None>:>)
|
|
|
|
####### Find the libraries declared in cpp_info.libs, create an IMPORTED target for each one and link the
|
|
####### imgui_DEPS_TARGET to all of them
|
|
conan_package_library_targets("${imgui_LIBS_NONE}" # libraries
|
|
"${imgui_LIB_DIRS_NONE}" # package_libdir
|
|
"${imgui_BIN_DIRS_NONE}" # package_bindir
|
|
"${imgui_LIBRARY_TYPE_NONE}"
|
|
"${imgui_IS_HOST_WINDOWS_NONE}"
|
|
imgui_DEPS_TARGET
|
|
imgui_LIBRARIES_TARGETS # out_libraries_targets
|
|
"_NONE"
|
|
"imgui" # package_name
|
|
"${imgui_NO_SONAME_MODE_NONE}") # soname
|
|
|
|
# FIXME: What is the result of this for multi-config? All configs adding themselves to path?
|
|
set(CMAKE_MODULE_PATH ${imgui_BUILD_DIRS_NONE} ${CMAKE_MODULE_PATH})
|
|
|
|
########## GLOBAL TARGET PROPERTIES None ########################################
|
|
set_property(TARGET imgui::imgui
|
|
APPEND PROPERTY INTERFACE_LINK_LIBRARIES
|
|
$<$<CONFIG:None>:${imgui_OBJECTS_NONE}>
|
|
$<$<CONFIG:None>:${imgui_LIBRARIES_TARGETS}>
|
|
)
|
|
|
|
if("${imgui_LIBS_NONE}" STREQUAL "")
|
|
# If the package is not declaring any "cpp_info.libs" the package deps, system libs,
|
|
# frameworks etc are not linked to the imported targets and we need to do it to the
|
|
# global target
|
|
set_property(TARGET imgui::imgui
|
|
APPEND PROPERTY INTERFACE_LINK_LIBRARIES
|
|
imgui_DEPS_TARGET)
|
|
endif()
|
|
|
|
set_property(TARGET imgui::imgui
|
|
APPEND PROPERTY INTERFACE_LINK_OPTIONS
|
|
$<$<CONFIG:None>:${imgui_LINKER_FLAGS_NONE}>)
|
|
set_property(TARGET imgui::imgui
|
|
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
|
$<$<CONFIG:None>:${imgui_INCLUDE_DIRS_NONE}>)
|
|
# Necessary to find LINK shared libraries in Linux
|
|
set_property(TARGET imgui::imgui
|
|
APPEND PROPERTY INTERFACE_LINK_DIRECTORIES
|
|
$<$<CONFIG:None>:${imgui_LIB_DIRS_NONE}>)
|
|
set_property(TARGET imgui::imgui
|
|
APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS
|
|
$<$<CONFIG:None>:${imgui_COMPILE_DEFINITIONS_NONE}>)
|
|
set_property(TARGET imgui::imgui
|
|
APPEND PROPERTY INTERFACE_COMPILE_OPTIONS
|
|
$<$<CONFIG:None>:${imgui_COMPILE_OPTIONS_NONE}>)
|
|
|
|
########## For the modules (FindXXX)
|
|
set(imgui_LIBRARIES_NONE imgui::imgui)
|