|
|
|
@ -123,15 +123,10 @@ |
|
|
|
# CORRADE_PEDANTIC_COMPILER_DEFINITIONS - List of pedantic compiler |
|
|
|
# CORRADE_PEDANTIC_COMPILER_DEFINITIONS - List of pedantic compiler |
|
|
|
# definitions used for targets with :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS` |
|
|
|
# definitions used for targets with :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS` |
|
|
|
# enabled |
|
|
|
# enabled |
|
|
|
# |
|
|
|
# CORRADE_CXX{11,14,17,20}_STANDARD_FLAG - Compiler flag to use for targeting |
|
|
|
# Workflows without :prop_tgt:`IMPORTED` targets are deprecated and the |
|
|
|
# C++11, 14, 17 or 20 in cases where it's not possible to use |
|
|
|
# following variables are included just for backwards compatibility and only if |
|
|
|
# :prop_tgt:`CORRADE_CXX_STANDARD`. Not defined if a standard switch is |
|
|
|
# :variable:`CORRADE_BUILD_DEPRECATED` is enabled: |
|
|
|
# already present in :variable:`CMAKE_CXX_FLAGS`. |
|
|
|
# |
|
|
|
|
|
|
|
# CORRADE_CXX_FLAGS - Pedantic compile flags. Use |
|
|
|
|
|
|
|
# :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS` property or |
|
|
|
|
|
|
|
# :variable:`CORRADE_PEDANTIC_COMPILER_DEFINITIONS` / |
|
|
|
|
|
|
|
# :variable:`CORRADE_PEDANTIC_COMPILER_OPTIONS` list variables instead. |
|
|
|
|
|
|
|
# |
|
|
|
# |
|
|
|
# Corrade provides these macros and functions: |
|
|
|
# Corrade provides these macros and functions: |
|
|
|
# |
|
|
|
# |
|
|
|
@ -355,40 +350,47 @@ mark_as_advanced(_CORRADE_MODULE_DIR) |
|
|
|
set(CORRADE_USE_MODULE ${_CORRADE_MODULE_DIR}/UseCorrade.cmake) |
|
|
|
set(CORRADE_USE_MODULE ${_CORRADE_MODULE_DIR}/UseCorrade.cmake) |
|
|
|
set(CORRADE_LIB_SUFFIX_MODULE ${_CORRADE_MODULE_DIR}/CorradeLibSuffix.cmake) |
|
|
|
set(CORRADE_LIB_SUFFIX_MODULE ${_CORRADE_MODULE_DIR}/CorradeLibSuffix.cmake) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Component distinction (listing them explicitly to avoid mistakes with finding |
|
|
|
|
|
|
|
# unknown components) |
|
|
|
|
|
|
|
set(_CORRADE_LIBRARY_COMPONENTS |
|
|
|
|
|
|
|
Containers Interconnect Main PluginManager TestSuite Utility) |
|
|
|
|
|
|
|
set(_CORRADE_HEADER_ONLY_COMPONENTS Containers) |
|
|
|
|
|
|
|
if(NOT CORRADE_TARGET_WINDOWS) |
|
|
|
|
|
|
|
# CorradeMain is a real library only on windows, a dummy target elsewhere |
|
|
|
|
|
|
|
list(APPEND _CORRADE_HEADER_ONLY_COMPONENTS Main) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
set(_CORRADE_EXECUTABLE_COMPONENTS rc) |
|
|
|
|
|
|
|
# Currently everything is enabled implicitly. Keep in sync with Corrade's root |
|
|
|
|
|
|
|
# CMakeLists.txt. |
|
|
|
|
|
|
|
set(_CORRADE_IMPLICITLY_ENABLED_COMPONENTS |
|
|
|
|
|
|
|
Containers Interconnect Main PluginManager TestSuite Utility rc) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Inter-component dependencies |
|
|
|
|
|
|
|
set(_CORRADE_Containers_DEPENDENCIES Utility) |
|
|
|
|
|
|
|
set(_CORRADE_Interconnect_DEPENDENCIES Utility) |
|
|
|
|
|
|
|
set(_CORRADE_PluginManager_DEPENDENCIES Containers Utility rc) |
|
|
|
|
|
|
|
set(_CORRADE_TestSuite_DEPENDENCIES Utility Main) # see below |
|
|
|
|
|
|
|
set(_CORRADE_Utility_DEPENDENCIES Containers rc) |
|
|
|
|
|
|
|
|
|
|
|
# Ensure that all inter-component dependencies are specified as well |
|
|
|
# Ensure that all inter-component dependencies are specified as well |
|
|
|
foreach(_component ${Corrade_FIND_COMPONENTS}) |
|
|
|
foreach(_component ${Corrade_FIND_COMPONENTS}) |
|
|
|
string(TOUPPER ${_component} _COMPONENT) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(_component STREQUAL Containers) |
|
|
|
|
|
|
|
set(_CORRADE_${_COMPONENT}_DEPENDENCIES Utility) |
|
|
|
|
|
|
|
elseif(_component STREQUAL Interconnect) |
|
|
|
|
|
|
|
set(_CORRADE_${_COMPONENT}_DEPENDENCIES Utility) |
|
|
|
|
|
|
|
elseif(_component STREQUAL PluginManager) |
|
|
|
|
|
|
|
set(_CORRADE_${_COMPONENT}_DEPENDENCIES Containers Utility rc) |
|
|
|
|
|
|
|
elseif(_component STREQUAL TestSuite) |
|
|
|
|
|
|
|
set(_CORRADE_${_COMPONENT}_DEPENDENCIES Utility Main) # see below |
|
|
|
|
|
|
|
elseif(_component STREQUAL Utility) |
|
|
|
|
|
|
|
set(_CORRADE_${_COMPONENT}_DEPENDENCIES Containers rc) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Mark the dependencies as required if the component is also required |
|
|
|
# Mark the dependencies as required if the component is also required |
|
|
|
if(Corrade_FIND_REQUIRED_${_component}) |
|
|
|
if(Corrade_FIND_REQUIRED_${_component}) |
|
|
|
foreach(_dependency ${_CORRADE_${_COMPONENT}_DEPENDENCIES}) |
|
|
|
foreach(_dependency ${_CORRADE_${_component}_DEPENDENCIES}) |
|
|
|
set(Corrade_FIND_REQUIRED_${_dependency} TRUE) |
|
|
|
set(Corrade_FIND_REQUIRED_${_dependency} TRUE) |
|
|
|
endforeach() |
|
|
|
endforeach() |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
list(APPEND _CORRADE_ADDITIONAL_COMPONENTS ${_CORRADE_${_COMPONENT}_DEPENDENCIES}) |
|
|
|
list(APPEND _CORRADE_ADDITIONAL_COMPONENTS ${_CORRADE_${_component}_DEPENDENCIES}) |
|
|
|
|
|
|
|
|
|
|
|
# Main is linked only in corrade_add_test(), not to everything that depends |
|
|
|
|
|
|
|
# on TestSuite, so remove it from the list again once we filled the above |
|
|
|
|
|
|
|
# variables |
|
|
|
|
|
|
|
if(_component STREQUAL TestSuite) |
|
|
|
|
|
|
|
set(_CORRADE_${_COMPONENT}_DEPENDENCIES Utility) |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
endforeach() |
|
|
|
endforeach() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Main is linked only in corrade_add_test(), not to everything that depends on |
|
|
|
|
|
|
|
# TestSuite, so remove it from the list again once we filled the above |
|
|
|
|
|
|
|
# variables |
|
|
|
|
|
|
|
set(_CORRADE_TestSuite_DEPENDENCIES Utility) |
|
|
|
|
|
|
|
|
|
|
|
# Join the lists, remove duplicate components |
|
|
|
# Join the lists, remove duplicate components |
|
|
|
|
|
|
|
set(_CORRADE_ORIGINAL_FIND_COMPONENTS ${Corrade_FIND_COMPONENTS}) |
|
|
|
if(_CORRADE_ADDITIONAL_COMPONENTS) |
|
|
|
if(_CORRADE_ADDITIONAL_COMPONENTS) |
|
|
|
list(INSERT Corrade_FIND_COMPONENTS 0 ${_CORRADE_ADDITIONAL_COMPONENTS}) |
|
|
|
list(INSERT Corrade_FIND_COMPONENTS 0 ${_CORRADE_ADDITIONAL_COMPONENTS}) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
@ -396,16 +398,6 @@ if(Corrade_FIND_COMPONENTS) |
|
|
|
list(REMOVE_DUPLICATES Corrade_FIND_COMPONENTS) |
|
|
|
list(REMOVE_DUPLICATES Corrade_FIND_COMPONENTS) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
# Component distinction |
|
|
|
|
|
|
|
set(_CORRADE_LIBRARY_COMPONENTS "^(Containers|Interconnect|Main|PluginManager|TestSuite|Utility)$") |
|
|
|
|
|
|
|
if(CORRADE_TARGET_WINDOWS) |
|
|
|
|
|
|
|
# CorradeMain is a real library only on windows, a dummy target elsewhere |
|
|
|
|
|
|
|
set(_CORRADE_HEADER_ONLY_COMPONENTS "^(Containers)$") |
|
|
|
|
|
|
|
else() |
|
|
|
|
|
|
|
set(_CORRADE_HEADER_ONLY_COMPONENTS "^(Containers|Main)$") |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
set(_CORRADE_EXECUTABLE_COMPONENTS "^(rc)$") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Find all components |
|
|
|
# Find all components |
|
|
|
foreach(_component ${Corrade_FIND_COMPONENTS}) |
|
|
|
foreach(_component ${Corrade_FIND_COMPONENTS}) |
|
|
|
string(TOUPPER ${_component} _COMPONENT) |
|
|
|
string(TOUPPER ${_component} _COMPONENT) |
|
|
|
@ -417,7 +409,7 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) |
|
|
|
set(Corrade_${_component}_FOUND TRUE) |
|
|
|
set(Corrade_${_component}_FOUND TRUE) |
|
|
|
else() |
|
|
|
else() |
|
|
|
# Library (and not header-only) components |
|
|
|
# Library (and not header-only) components |
|
|
|
if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS} AND NOT _component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}) |
|
|
|
if(_component IN_LIST _CORRADE_LIBRARY_COMPONENTS AND NOT _component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS) |
|
|
|
add_library(Corrade::${_component} UNKNOWN IMPORTED) |
|
|
|
add_library(Corrade::${_component} UNKNOWN IMPORTED) |
|
|
|
|
|
|
|
|
|
|
|
# Try to find both debug and release version |
|
|
|
# Try to find both debug and release version |
|
|
|
@ -442,19 +434,19 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
# Header-only library components |
|
|
|
# Header-only library components |
|
|
|
if(_component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}) |
|
|
|
if(_component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS) |
|
|
|
add_library(Corrade::${_component} INTERFACE IMPORTED) |
|
|
|
add_library(Corrade::${_component} INTERFACE IMPORTED) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
# Default include path names to look for for library / header-only |
|
|
|
# Default include path names to look for for library / header-only |
|
|
|
# components |
|
|
|
# components |
|
|
|
if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS}) |
|
|
|
if(_component IN_LIST _CORRADE_LIBRARY_COMPONENTS) |
|
|
|
set(_CORRADE_${_COMPONENT}_INCLUDE_PATH_SUFFIX Corrade/${_component}) |
|
|
|
set(_CORRADE_${_COMPONENT}_INCLUDE_PATH_SUFFIX Corrade/${_component}) |
|
|
|
set(_CORRADE_${_COMPONENT}_INCLUDE_PATH_NAMES ${_component}.h) |
|
|
|
set(_CORRADE_${_COMPONENT}_INCLUDE_PATH_NAMES ${_component}.h) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
# Executable components |
|
|
|
# Executable components |
|
|
|
if(_component MATCHES ${_CORRADE_EXECUTABLE_COMPONENTS}) |
|
|
|
if(_component IN_LIST _CORRADE_EXECUTABLE_COMPONENTS) |
|
|
|
add_executable(Corrade::${_component} IMPORTED) |
|
|
|
add_executable(Corrade::${_component} IMPORTED) |
|
|
|
|
|
|
|
|
|
|
|
find_program(CORRADE_${_COMPONENT}_EXECUTABLE corrade-${_component}) |
|
|
|
find_program(CORRADE_${_COMPONENT}_EXECUTABLE corrade-${_component}) |
|
|
|
@ -552,7 +544,7 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
# Find library includes |
|
|
|
# Find library includes |
|
|
|
if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS}) |
|
|
|
if(_component IN_LIST _CORRADE_LIBRARY_COMPONENTS) |
|
|
|
find_path(_CORRADE_${_COMPONENT}_INCLUDE_DIR |
|
|
|
find_path(_CORRADE_${_COMPONENT}_INCLUDE_DIR |
|
|
|
NAMES ${_CORRADE_${_COMPONENT}_INCLUDE_PATH_NAMES} |
|
|
|
NAMES ${_CORRADE_${_COMPONENT}_INCLUDE_PATH_NAMES} |
|
|
|
HINTS ${CORRADE_INCLUDE_DIR}/${_CORRADE_${_COMPONENT}_INCLUDE_PATH_SUFFIX}) |
|
|
|
HINTS ${CORRADE_INCLUDE_DIR}/${_CORRADE_${_COMPONENT}_INCLUDE_PATH_SUFFIX}) |
|
|
|
@ -560,9 +552,9 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
# Add inter-library dependencies |
|
|
|
# Add inter-library dependencies |
|
|
|
if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS} OR _component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}) |
|
|
|
if(_component IN_LIST _CORRADE_LIBRARY_COMPONENTS OR _component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS) |
|
|
|
foreach(_dependency ${_CORRADE_${_COMPONENT}_DEPENDENCIES}) |
|
|
|
foreach(_dependency ${_CORRADE_${_component}_DEPENDENCIES}) |
|
|
|
if(_dependency MATCHES ${_CORRADE_LIBRARY_COMPONENTS} OR _dependency MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}) |
|
|
|
if(_dependency IN_LIST _CORRADE_LIBRARY_COMPONENTS OR _dependency IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS) |
|
|
|
set_property(TARGET Corrade::${_component} APPEND PROPERTY |
|
|
|
set_property(TARGET Corrade::${_component} APPEND PROPERTY |
|
|
|
INTERFACE_LINK_LIBRARIES Corrade::${_dependency}) |
|
|
|
INTERFACE_LINK_LIBRARIES Corrade::${_dependency}) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
@ -570,7 +562,7 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
# Decide if the component was found |
|
|
|
# Decide if the component was found |
|
|
|
if((_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS} AND _CORRADE_${_COMPONENT}_INCLUDE_DIR AND (_component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS} OR CORRADE_${_COMPONENT}_LIBRARY_RELEASE OR CORRADE_${_COMPONENT}_LIBRARY_DEBUG)) OR (_component MATCHES ${_CORRADE_EXECUTABLE_COMPONENTS} AND CORRADE_${_COMPONENT}_EXECUTABLE)) |
|
|
|
if((_component IN_LIST _CORRADE_LIBRARY_COMPONENTS AND _CORRADE_${_COMPONENT}_INCLUDE_DIR AND (_component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS OR CORRADE_${_COMPONENT}_LIBRARY_RELEASE OR CORRADE_${_COMPONENT}_LIBRARY_DEBUG)) OR (_component IN_LIST _CORRADE_EXECUTABLE_COMPONENTS AND CORRADE_${_COMPONENT}_EXECUTABLE)) |
|
|
|
set(Corrade_${_component}_FOUND TRUE) |
|
|
|
set(Corrade_${_component}_FOUND TRUE) |
|
|
|
else() |
|
|
|
else() |
|
|
|
set(Corrade_${_component}_FOUND FALSE) |
|
|
|
set(Corrade_${_component}_FOUND FALSE) |
|
|
|
@ -578,6 +570,39 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) |
|
|
|
endif() |
|
|
|
endif() |
|
|
|
endforeach() |
|
|
|
endforeach() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# For CMake 3.16+ with REASON_FAILURE_MESSAGE, provide additional potentially |
|
|
|
|
|
|
|
# useful info about the failed components. |
|
|
|
|
|
|
|
if(NOT CMAKE_VERSION VERSION_LESS 3.16) |
|
|
|
|
|
|
|
set(_CORRADE_REASON_FAILURE_MESSAGE) |
|
|
|
|
|
|
|
# Go only through the originally specified find_package() components, not |
|
|
|
|
|
|
|
# the dependencies added by us afterwards |
|
|
|
|
|
|
|
foreach(_component ${_CORRADE_ORIGINAL_FIND_COMPONENTS}) |
|
|
|
|
|
|
|
if(Corrade_${_component}_FOUND) |
|
|
|
|
|
|
|
continue() |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If it's not known at all, tell the user -- it might be a new library |
|
|
|
|
|
|
|
# and an old Find module, or something platform-specific. |
|
|
|
|
|
|
|
if(NOT _component IN_LIST _CORRADE_LIBRARY_COMPONENTS AND NOT _component IN_LIST _CORRADE_EXECUTABLE_COMPONENTS) |
|
|
|
|
|
|
|
list(APPEND _CORRADE_REASON_FAILURE_MESSAGE "${_component} is not a known component on this platform.") |
|
|
|
|
|
|
|
# Otherwise, if it's not among implicitly built components, hint that |
|
|
|
|
|
|
|
# the user may need to enable it. |
|
|
|
|
|
|
|
# TODO: currently, the _FOUND variable doesn't reflect if dependencies |
|
|
|
|
|
|
|
# were found. When it will, this needs to be updated to avoid |
|
|
|
|
|
|
|
# misleading messages. |
|
|
|
|
|
|
|
elseif(NOT _component IN_LIST _CORRADE_IMPLICITLY_ENABLED_COMPONENTS) |
|
|
|
|
|
|
|
string(TOUPPER ${_component} _COMPONENT) |
|
|
|
|
|
|
|
list(APPEND _CORRADE_REASON_FAILURE_MESSAGE "${_component} is not built by default. Make sure you enabled WITH_${_COMPONENT} when building Corrade.") |
|
|
|
|
|
|
|
# Otherwise we have no idea. Better be silent than to print something |
|
|
|
|
|
|
|
# misleading. |
|
|
|
|
|
|
|
else() |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
endforeach() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string(REPLACE ";" " " _CORRADE_REASON_FAILURE_MESSAGE "${_CORRADE_REASON_FAILURE_MESSAGE}") |
|
|
|
|
|
|
|
set(_CORRADE_REASON_FAILURE_MESSAGE REASON_FAILURE_MESSAGE "${_CORRADE_REASON_FAILURE_MESSAGE}") |
|
|
|
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs) |
|
|
|
include(FindPackageHandleStandardArgs) |
|
|
|
find_package_handle_standard_args(Corrade REQUIRED_VARS |
|
|
|
find_package_handle_standard_args(Corrade REQUIRED_VARS |
|
|
|
CORRADE_INCLUDE_DIR |
|
|
|
CORRADE_INCLUDE_DIR |
|
|
|
@ -586,7 +611,8 @@ find_package_handle_standard_args(Corrade REQUIRED_VARS |
|
|
|
${CORRADE_TESTSUITE_XCTEST_RUNNER_NEEDED} |
|
|
|
${CORRADE_TESTSUITE_XCTEST_RUNNER_NEEDED} |
|
|
|
${CORRADE_TESTSUITE_ADB_RUNNER_NEEDED} |
|
|
|
${CORRADE_TESTSUITE_ADB_RUNNER_NEEDED} |
|
|
|
${CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER_NEEDED} |
|
|
|
${CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER_NEEDED} |
|
|
|
HANDLE_COMPONENTS) |
|
|
|
HANDLE_COMPONENTS |
|
|
|
|
|
|
|
${_CORRADE_REASON_FAILURE_MESSAGE}) |
|
|
|
|
|
|
|
|
|
|
|
# Finalize the finding process |
|
|
|
# Finalize the finding process |
|
|
|
include(${CORRADE_USE_MODULE}) |
|
|
|
include(${CORRADE_USE_MODULE}) |
|
|
|
|