138 lines
3.5 KiB
CMake
138 lines
3.5 KiB
CMake
#[[
|
|
|
|
Create imported targets:
|
|
* CD::Core
|
|
* CD::Qt
|
|
|
|
These targets include directories and dependencies
|
|
|
|
]]
|
|
|
|
cmake_policy(SET CMP0011 NEW) # don`t affect includer policies
|
|
cmake_policy(SET CMP0020 NEW) # Automatically link Qt executables to qtmain target on Windows
|
|
find_package(PIP REQUIRED)
|
|
find_package(QAD QUIET)
|
|
include(QtWraps)
|
|
include(SHSTKMacros)
|
|
|
|
shstk_is_parent_exists(hasParent PARENT_DIRECTORY)
|
|
|
|
shstk_set_find_dirs(cd)
|
|
set(_SEARCH_DIR ${cd_LIBDIR})
|
|
|
|
if (NOT BUILDING_cd)
|
|
list(APPEND _SEARCH_DIR $ENV{SMSDK_DIR}/lib)
|
|
shstk_find_header(cd CD "cd_version.h" "")
|
|
endif()
|
|
|
|
if(CD_FIND_VERSION VERSION_GREATER CD_VERSION)
|
|
message(FATAL_ERROR "CD version ${CD_VERSION} is available, but ${CD_FIND_VERSION} requested!")
|
|
endif()
|
|
|
|
|
|
set(__libs "core")
|
|
|
|
set(__module_core Core)
|
|
set( __inc_core "")
|
|
set(__libs_core "")
|
|
set(__deps_core "PIP")
|
|
|
|
if (BUILDING_cd)
|
|
|
|
if (NOT SET_TARGETS_cd)
|
|
#message("create aliases")
|
|
foreach (_l ${__libs})
|
|
set(_m ${__module_${_l}})
|
|
if((NOT TARGET CD::${_m}) AND TARGET cd_${_l})
|
|
#message("alias CD::${_m} = cd_${_l}")
|
|
add_library(CD::${_m} ALIAS cd_${_l})
|
|
endif()
|
|
endforeach()
|
|
endif()
|
|
|
|
else()
|
|
|
|
#message("create interfaces")
|
|
foreach (_l ${__libs})
|
|
set(_m ${__module_${_l}})
|
|
find_library(CD_LIBRARY_${_l} cd_${_l} HINTS ${_SEARCH_DIR})
|
|
if((NOT TARGET CD::${_m}) AND CD_LIBRARY_${_l})
|
|
add_library(CD::${_m} UNKNOWN IMPORTED)
|
|
set_target_properties(CD::${_m} PROPERTIES
|
|
IMPORTED_LOCATION "${CD_LIBRARY_${_l}}"
|
|
INTERFACE_INCLUDE_DIRECTORIES "${cd_INCLUDES};${__inc_${_l}}"
|
|
INTERFACE_LINK_LIBRARIES "${__deps_${_l}};${__libs_${_l}}")
|
|
#message("imported CD::${_m} = ${CD_LIBRARY_${_l}} ${__deps_${_l}} ${__libs_${_l}} ${__inc_${_l}}")
|
|
endif()
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|
|
if (QAD_FOUND OR BUILDING_qad)
|
|
|
|
set(__libs "qt")
|
|
|
|
set(__module_qt Qt)
|
|
set( __inc_qt "")
|
|
set(__libs_qt "")
|
|
set(__deps_qt "QAD::PIQt;QAD::Graphic;CD::Core")
|
|
|
|
if (BUILDING_cd)
|
|
|
|
if (NOT SET_TARGETS_cd)
|
|
set(SET_TARGETS_cd ON CACHE BOOL "")
|
|
#message("create aliases")
|
|
foreach(_l ${__libs})
|
|
foreach(_v ${_QT_VERSIONS_})
|
|
set(_m ${__module_${_l}})
|
|
if((NOT TARGET CD::${_m}${_v}) AND TARGET cd_${_l}${_v})
|
|
#message("alias CD::${_m}${_v} = cd_${_l}${_v}")
|
|
set(MULTILIB_CD__${_m}_SUFFIX_Qt${_v} ${_v} CACHE STRING "")
|
|
add_library(CD::${_m}${_v} ALIAS cd_${_l}${_v})
|
|
endif()
|
|
endforeach()
|
|
list(APPEND QT_MULTILIB_LIST CD::${_m})
|
|
endforeach()
|
|
endif()
|
|
|
|
else()
|
|
|
|
#message("create interfaces")
|
|
foreach(_l ${__libs})
|
|
foreach(_v ${_QT_VERSIONS_})
|
|
set(_m ${__module_${_l}})
|
|
find_library(CD_LIBRARY_${_l}${_v} cd_${_l}${_v} HINTS ${cd_LIBDIR})
|
|
#message("found ${_l}${_v} = ${CD_LIBRARY_${_l}${_v}}")
|
|
if((NOT TARGET CD::${_m}${_v}) AND CD_LIBRARY_${_l}${_v})
|
|
#message("imported CD::${_m}${_v} = ${CD_LIBRARY_${_l}${_v}}")
|
|
set(MULTILIB_CD__${_m}_SUFFIX_Qt${_v} ${_v} CACHE STRING "")
|
|
add_library(CD::${_m}${_v} UNKNOWN IMPORTED)
|
|
set(_deps)
|
|
foreach (_d ${__deps_${_l}})
|
|
if (${_d} MATCHES "QAD::*")
|
|
list(APPEND _deps ${_d}${_v})
|
|
else()
|
|
list(APPEND _deps ${_d})
|
|
endif()
|
|
endforeach()
|
|
set_target_properties(CD::${_m}${_v} PROPERTIES
|
|
IMPORTED_LOCATION "${CD_LIBRARY_${_l}${_v}}"
|
|
INTERFACE_INCLUDE_DIRECTORIES "${cd_INCLUDES}"
|
|
INTERFACE_LINK_LIBRARIES "${_deps}")
|
|
endif()
|
|
endforeach()
|
|
list(APPEND QT_MULTILIB_LIST CD::${_m})
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
if(hasParent)
|
|
set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE)
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
set(CD_FOUND ON CACHE BOOL "")
|