1#.rst: 2# Find Corrade 3# ------------ 4# 5# Finds the Corrade library. Basic usage:: 6# 7# find_package(Corrade REQUIRED) 8# 9# This module tries to find the base Corrade library and then defines the 10# following: 11# 12# Corrade_FOUND - Whether the base library was found 13# CORRADE_LIB_SUFFIX_MODULE - Path to CorradeLibSuffix.cmake module 14# CORRADE_INCLUDE_INSTALL_PREFIX - Prefix where to put platform-independent 15# include and other files, defaults to ``.``. If a relative path is used, 16# it's relative to :variable:`CMAKE_INSTALL_PREFIX`. 17# 18# This command will try to find only the base library, not the optional 19# components, which are: 20# 21# Containers - Containers library 22# PluginManager - PluginManager library 23# TestSuite - TestSuite library 24# Utility - Utility library 25# rc - corrade-rc executable 26# 27# Example usage with specifying additional components is:: 28# 29# find_package(Corrade REQUIRED Utility TestSuite) 30# 31# For each component is then defined: 32# 33# Corrade_*_FOUND - Whether the component was found 34# Corrade::* - Component imported target 35# 36# The package is found if either debug or release version of each library is 37# found. If both debug and release libraries are found, proper version is 38# chosen based on actual build configuration of the project (i.e. Debug build 39# is linked to debug libraries, Release build to release libraries). 40# 41# Corrade conditionally defines ``CORRADE_IS_DEBUG_BUILD`` preprocessor 42# variable in case build configuration is ``Debug`` (not Corrade itself, but 43# build configuration of the project using it). Useful e.g. for selecting 44# proper plugin directory. 45# 46# Corrade defines the following custom target properties: 47# 48# CORRADE_CXX_STANDARD - C++ standard to require when compiling given 49# target. Does nothing if :variable:`CMAKE_CXX_FLAGS` already contains 50# particular standard setting flag or if given target contains 51# :prop_tgt:`CMAKE_CXX_STANDARD` property. Allowed value is 11, 14 or 17. 52# INTERFACE_CORRADE_CXX_STANDARD - C++ standard to require when using given 53# target. Does nothing if :variable:`CMAKE_CXX_FLAGS` already contains 54# particular standard setting flag or if given target contains 55# :prop_tgt:`CMAKE_CXX_STANDARD` property. Allowed value is 11, 14 or 17. 56# CORRADE_USE_PEDANTIC_FLAGS - Enable additional compiler/linker flags. 57# Boolean. 58# 59# These properties are inherited from directory properties, meaning that if you 60# set them on directories, they get implicitly set on all targets in given 61# directory (with a possibility to do target-specific overrides). All Corrade 62# libraries have the :prop_tgt:`INTERFACE_CORRADE_CXX_STANDARD` property set to 63# 11, meaning that you will always have at least C++11 enabled once you link to 64# any Corrade library. 65# 66# Features of found Corrade library are exposed in these variables: 67# 68# CORRADE_MSVC2019_COMPATIBILITY - Defined if compiled with compatibility 69# mode for MSVC 2019 70# CORRADE_MSVC2017_COMPATIBILITY - Defined if compiled with compatibility 71# mode for MSVC 2017 72# CORRADE_MSVC2015_COMPATIBILITY - Defined if compiled with compatibility 73# mode for MSVC 2015 74# CORRADE_BUILD_DEPRECATED - Defined if compiled with deprecated APIs 75# included 76# CORRADE_BUILD_STATIC - Defined if compiled as static libraries. 77# Default are shared libraries. 78# CORRADE_BUILD_MULTITHREADED - Defined if compiled in a way that makes it 79# possible to safely use certain Corrade features simultaenously in multiple 80# threads 81# CORRADE_TARGET_UNIX - Defined if compiled for some Unix flavor 82# (Linux, BSD, macOS) 83# CORRADE_TARGET_APPLE - Defined if compiled for Apple platforms 84# CORRADE_TARGET_IOS - Defined if compiled for iOS (device or 85# simulator) 86# CORRADE_TARGET_IOS_SIMULATOR - Defined if compiled for iOS Simulator 87# CORRADE_TARGET_WINDOWS - Defined if compiled for Windows 88# CORRADE_TARGET_WINDOWS_RT - Defined if compiled for Windows RT 89# CORRADE_TARGET_EMSCRIPTEN - Defined if compiled for Emscripten 90# CORRADE_TARGET_ANDROID - Defined if compiled for Android 91# CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - Defined if PluginManager 92# doesn't support dynamic plugin loading due to platform limitations 93# CORRADE_TESTSUITE_TARGET_XCTEST - Defined if TestSuite is targetting Xcode 94# XCTest 95# CORRADE_UTILITY_USE_ANSI_COLORS - Defined if ANSI escape sequences are used 96# for colored output with Utility::Debug on Windows 97# 98# Additionally these variables are defined for internal usage: 99# 100# CORRADE_INCLUDE_DIR - Root include dir 101# CORRADE_*_LIBRARY_DEBUG - Debug version of given library, if found 102# CORRADE_*_LIBRARY_RELEASE - Release version of given library, if found 103# CORRADE_*_EXECUTABLE - Location of given executable, if found 104# CORRADE_USE_MODULE - Path to UseCorrade.cmake module (included 105# automatically) 106# CORRADE_TESTSUITE_XCTEST_RUNNER - Path to XCTestRunner.mm.in file 107# CORRADE_TESTSUITE_ADB_RUNNER - Path to AdbRunner.sh file 108# CORRADE_PEDANTIC_COMPILER_OPTIONS - List of pedantic compiler options used 109# for targets with :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS` enabled 110# CORRADE_PEDANTIC_COMPILER_DEFINITIONS - List of pedantic compiler 111# definitions used for targets with :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS` 112# enabled 113# 114# Workflows without :prop_tgt:`IMPORTED` targets are deprecated and the 115# following variables are included just for backwards compatibility and only if 116# :variable:`CORRADE_BUILD_DEPRECATED` is enabled: 117# 118# CORRADE_CXX_FLAGS - Pedantic compile flags. Use 119# :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS` property or 120# :variable:`CORRADE_PEDANTIC_COMPILER_DEFINITIONS` / 121# :variable:`CORRADE_PEDANTIC_COMPILER_OPTIONS` list variables instead. 122# 123# Corrade provides these macros and functions: 124# 125# .. command:: corrade_add_test 126# 127# Add unit test using Corrade's TestSuite:: 128# 129# corrade_add_test(<test name> 130# <sources>... 131# [LIBRARIES <libraries>...] 132# [FILES <files>...] 133# [ARGUMENTS <arguments>...]) 134# 135# Test name is also executable name. You can use ``LIBRARIES`` to specify 136# libraries to link with instead of using :command:`target_link_libraries()`. 137# The ``Corrade::TestSuite`` target is linked automatically to each test. Note 138# that the :command:`enable_testing()` function must be called explicitly. 139# Arguments passed after ``ARGUMENTS`` will be appended to the test 140# command line. ``ARGUMENTS`` are supported everywhere except when 141# ``CORRADE_TESTSUITE_TARGET_XCTEST`` is enabled. 142# 143# You can list files needed by the test in the ``FILES`` section. If given 144# filename is relative, it is treated relatively to `CMAKE_CURRENT_SOURCE_DIR`. 145# The files are added to the :prop_test:`REQUIRED_FILES` target property. On 146# Emscripten they are bundled to the executable and available in the virtual 147# filesystem root. On Android they are copied along the executable to the 148# target. In case of Emscripten and Android, if the file is absolute or 149# contains ``..``, only the leaf name is used. Alternatively you can have a 150# filename formatted as ``<input>@<output>``, in which case the ``<input>`` is 151# treated as local filesystem location and ``<output>`` as remote/virtual 152# filesystem location. The remote location can't be absolute or contain ``..`` 153# / ``@`` characters. 154# 155# Unless :variable:`CORRADE_TESTSUITE_TARGET_XCTEST` is set, test cases on iOS 156# targets are created as bundles with bundle identifier set to CMake project 157# name by default. Use the cache variable :variable:`CORRADE_TESTSUITE_BUNDLE_IDENTIFIER_PREFIX` 158# to change it to something else. 159# 160# .. command:: corrade_add_resource 161# 162# Compile data resources into application binary:: 163# 164# corrade_add_resource(<name> <resources.conf>) 165# 166# Depends on ``Corrade::rc``, which is part of Corrade utilities. This command 167# generates resource data using given configuration file in current build 168# directory. Argument name is name under which the resources can be explicitly 169# loaded. Variable ``<name>`` contains compiled resource filename, which is 170# then used for compiling library / executable. On CMake >= 3.1 the 171# `resources.conf` file can contain UTF-8-encoded filenames. Example usage:: 172# 173# corrade_add_resource(app_resources resources.conf) 174# add_executable(app source1 source2 ... ${app_resources}) 175# 176# .. command:: corrade_add_plugin 177# 178# Add dynamic plugin:: 179# 180# corrade_add_plugin(<plugin name> 181# "<debug binary install dir>;<debug library install dir>" 182# "<release binary install dir>;<release library install dir>" 183# <metadata file> 184# <sources>...) 185# 186# The macro adds preprocessor directive ``CORRADE_DYNAMIC_PLUGIN``. Additional 187# libraries can be linked in via :command:`target_link_libraries(plugin_name ...) <target_link_libraries>`. 188# On DLL platforms, the plugin DLLs and metadata files are put into 189# ``<debug binary install dir>``/``<release binary install dir>`` and the 190# ``*.lib`` files into ``<debug library install dir>``/``<release library install dir>``. 191# On non-DLL platforms everything is put into ``<debug library install dir>``/ 192# ``<release library install dir>``. 193# 194# corrade_add_plugin(<plugin name> 195# <debug install dir> 196# <release install dir> 197# <metadata file> 198# <sources>...) 199# 200# Unline the above version this puts everything into ``<debug install dir>`` on 201# both DLL and non-DLL platforms. If ``<debug install dir>`` is set to 202# :variable:`CMAKE_CURRENT_BINARY_DIR` (e.g. for testing purposes), the files 203# are copied directly, without the need to perform install step. Note that the 204# files are actually put into configuration-based subdirectory, i.e. 205# ``${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}``. See documentation of 206# :variable:`CMAKE_CFG_INTDIR` variable for more information. 207# 208# .. command:: corrade_add_static_plugin 209# 210# Add static plugin:: 211# 212# corrade_add_static_plugin(<plugin name> 213# "<binary install dir>;<library install dir>" 214# <metadata file> 215# <sources>...) 216# 217# The macro adds preprocessor directive ``CORRADE_STATIC_PLUGIN``. Additional 218# libraries can be linked in via :command:`target_link_libraries(plugin_name ...) <target_link_libraries>`. 219# The ``<binary install dir>`` is ignored and included just for compatibility 220# with the :command:`corrade_add_plugin` command, everything is installed into 221# ``<library install dir>``. Note that plugins built in debug configuration 222# (e.g. with :variable:`CMAKE_BUILD_TYPE` set to ``Debug``) have ``"-d"`` 223# suffix to make it possible to have both debug and release plugins installed 224# alongside each other. 225# 226# corrade_add_static_plugin(<plugin name> 227# <install dir> 228# <metadata file> 229# <sources>...) 230# 231# Equivalent to the above with ``<library install dir>`` set to ``<install dir>``. 232# If ``<install dir>`` is set to :variable:`CMAKE_CURRENT_BINARY_DIR` (e.g. for 233# testing purposes), no installation rules are added. 234# 235# .. command:: corrade_find_dlls_for_libs 236# 237# Find corresponding DLLs for library files:: 238# 239# corrade_find_dlls_for_libs(<output variable> <libs>...) 240# 241# Available only on Windows, for all ``*.lib`` files tries to find 242# corresponding DLL file. Useful for bundling dependencies for e.g. WinRT 243# packages. 244# 245 246# 247# This file is part of Corrade. 248# 249# Copyright © 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 250# 2017, 2018, 2019 Vladimír Vondruš <mosra@centrum.cz> 251# 252# Permission is hereby granted, free of charge, to any person obtaining a 253# copy of this software and associated documentation files (the "Software"), 254# to deal in the Software without restriction, including without limitation 255# the rights to use, copy, modify, merge, publish, distribute, sublicense, 256# and/or sell copies of the Software, and to permit persons to whom the 257# Software is furnished to do so, subject to the following conditions: 258# 259# The above copyright notice and this permission notice shall be included 260# in all copies or substantial portions of the Software. 261# 262# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 263# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 264# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 265# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 266# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 267# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 268# DEALINGS IN THE SOFTWARE. 269# 270 271# Root include dir 272find_path(CORRADE_INCLUDE_DIR 273 NAMES Corrade/Corrade.h) 274mark_as_advanced(CORRADE_INCLUDE_DIR) 275 276# Configuration file 277find_file(_CORRADE_CONFIGURE_FILE configure.h 278 HINTS ${CORRADE_INCLUDE_DIR}/Corrade/) 279mark_as_advanced(_CORRADE_CONFIGURE_FILE) 280 281# We need to open configure.h file from CORRADE_INCLUDE_DIR before we check for 282# the components. Bail out with proper error message if it wasn't found. The 283# complete check with all components is further below. 284if(NOT CORRADE_INCLUDE_DIR) 285 include(FindPackageHandleStandardArgs) 286 find_package_handle_standard_args(Corrade 287 REQUIRED_VARS CORRADE_INCLUDE_DIR _CORRADE_CONFIGURE_FILE) 288endif() 289 290# Read flags from configuration 291file(READ ${_CORRADE_CONFIGURE_FILE} _corradeConfigure) 292set(_corradeFlags 293 # WARNING: CAREFUL HERE, the string(FIND) succeeds even if a subset is 294 # found -- so e.g. looking for TARGET_GL will match TARGET_GLES2 as well. 295 # So far that's not a problem, but might become an issue for new flags. 296 MSVC2015_COMPATIBILITY 297 MSVC2017_COMPATIBILITY 298 MSVC2019_COMPATIBILITY 299 BUILD_DEPRECATED 300 BUILD_STATIC 301 BUILD_MULTITHREADED 302 TARGET_UNIX 303 TARGET_APPLE 304 TARGET_IOS 305 TARGET_IOS_SIMULATOR 306 TARGET_WINDOWS 307 TARGET_WINDOWS_RT 308 TARGET_EMSCRIPTEN 309 TARGET_ANDROID 310 PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT 311 TESTSUITE_TARGET_XCTEST 312 UTILITY_USE_ANSI_COLORS) 313foreach(_corradeFlag ${_corradeFlags}) 314 string(FIND "${_corradeConfigure}" "#define CORRADE_${_corradeFlag}" _corrade_${_corradeFlag}) 315 if(NOT _corrade_${_corradeFlag} EQUAL -1) 316 set(CORRADE_${_corradeFlag} 1) 317 endif() 318endforeach() 319 320# CMake module dir 321find_path(_CORRADE_MODULE_DIR 322 NAMES UseCorrade.cmake CorradeLibSuffix.cmake 323 PATH_SUFFIXES share/cmake/Corrade) 324mark_as_advanced(_CORRADE_MODULE_DIR) 325 326set(CORRADE_USE_MODULE ${_CORRADE_MODULE_DIR}/UseCorrade.cmake) 327set(CORRADE_LIB_SUFFIX_MODULE ${_CORRADE_MODULE_DIR}/CorradeLibSuffix.cmake) 328 329# Ensure that all inter-component dependencies are specified as well 330foreach(_component ${Corrade_FIND_COMPONENTS}) 331 string(TOUPPER ${_component} _COMPONENT) 332 333 if(_component STREQUAL Containers) 334 set(_CORRADE_${_COMPONENT}_DEPENDENCIES Utility) 335 elseif(_component STREQUAL Interconnect) 336 set(_CORRADE_${_COMPONENT}_DEPENDENCIES Utility) 337 elseif(_component STREQUAL PluginManager) 338 set(_CORRADE_${_COMPONENT}_DEPENDENCIES Containers Utility rc) 339 elseif(_component STREQUAL TestSuite) 340 set(_CORRADE_${_COMPONENT}_DEPENDENCIES Utility Main) # see below 341 elseif(_component STREQUAL Utility) 342 set(_CORRADE_${_COMPONENT}_DEPENDENCIES Containers rc) 343 endif() 344 345 # Mark the dependencies as required if the component is also required 346 if(Corrade_FIND_REQUIRED_${_component}) 347 foreach(_dependency ${_CORRADE_${_COMPONENT}_DEPENDENCIES}) 348 set(Corrade_FIND_REQUIRED_${_dependency} TRUE) 349 endforeach() 350 endif() 351 352 list(APPEND _CORRADE_ADDITIONAL_COMPONENTS ${_CORRADE_${_COMPONENT}_DEPENDENCIES}) 353 354 # Main is linked only in corrade_add_test(), not to everything that depends 355 # on TestSuite, so remove it from the list again once we filled the above 356 # variables 357 if(_component STREQUAL TestSuite) 358 set(_CORRADE_${_COMPONENT}_DEPENDENCIES Utility) 359 endif() 360endforeach() 361 362# Join the lists, remove duplicate components 363if(_CORRADE_ADDITIONAL_COMPONENTS) 364 list(INSERT Corrade_FIND_COMPONENTS 0 ${_CORRADE_ADDITIONAL_COMPONENTS}) 365endif() 366if(Corrade_FIND_COMPONENTS) 367 list(REMOVE_DUPLICATES Corrade_FIND_COMPONENTS) 368endif() 369 370# Component distinction 371set(_CORRADE_LIBRARY_COMPONENTS "^(Containers|Interconnect|Main|PluginManager|TestSuite|Utility)$") 372if(CORRADE_TARGET_WINDOWS) 373 # CorradeMain is a real library only on windows, a dummy target elsewhere 374 set(_CORRADE_HEADER_ONLY_COMPONENTS "^(Containers)$") 375else() 376 set(_CORRADE_HEADER_ONLY_COMPONENTS "^(Containers|Main)$") 377endif() 378set(_CORRADE_EXECUTABLE_COMPONENTS "^(rc)$") 379 380# Find all components 381foreach(_component ${Corrade_FIND_COMPONENTS}) 382 string(TOUPPER ${_component} _COMPONENT) 383 384 # Create imported target in case the library is found. If the project is 385 # added as subproject to CMake, the target already exists and all the 386 # required setup is already done from the build tree. 387 if(TARGET Corrade::${_component}) 388 set(Corrade_${_component}_FOUND TRUE) 389 else() 390 # Library (and not header-only) components 391 if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS} AND NOT _component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}) 392 add_library(Corrade::${_component} UNKNOWN IMPORTED) 393 394 # Try to find both debug and release version 395 find_library(CORRADE_${_COMPONENT}_LIBRARY_DEBUG Corrade${_component}-d) 396 find_library(CORRADE_${_COMPONENT}_LIBRARY_RELEASE Corrade${_component}) 397 mark_as_advanced(CORRADE_${_COMPONENT}_LIBRARY_DEBUG 398 CORRADE_${_COMPONENT}_LIBRARY_RELEASE) 399 400 if(CORRADE_${_COMPONENT}_LIBRARY_RELEASE) 401 set_property(TARGET Corrade::${_component} APPEND PROPERTY 402 IMPORTED_CONFIGURATIONS RELEASE) 403 set_property(TARGET Corrade::${_component} PROPERTY 404 IMPORTED_LOCATION_RELEASE ${CORRADE_${_COMPONENT}_LIBRARY_RELEASE}) 405 endif() 406 407 if(CORRADE_${_COMPONENT}_LIBRARY_DEBUG) 408 set_property(TARGET Corrade::${_component} APPEND PROPERTY 409 IMPORTED_CONFIGURATIONS DEBUG) 410 set_property(TARGET Corrade::${_component} PROPERTY 411 IMPORTED_LOCATION_DEBUG ${CORRADE_${_COMPONENT}_LIBRARY_DEBUG}) 412 endif() 413 endif() 414 415 # Header-only library components 416 if(_component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}) 417 add_library(Corrade::${_component} INTERFACE IMPORTED) 418 endif() 419 420 # Default include path names to look for for library / header-only 421 # components 422 if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS}) 423 set(_CORRADE_${_COMPONENT}_INCLUDE_PATH_SUFFIX Corrade/${_component}) 424 set(_CORRADE_${_COMPONENT}_INCLUDE_PATH_NAMES ${_component}.h) 425 endif() 426 427 # Executable components 428 if(_component MATCHES ${_CORRADE_EXECUTABLE_COMPONENTS}) 429 add_executable(Corrade::${_component} IMPORTED) 430 431 find_program(CORRADE_${_COMPONENT}_EXECUTABLE corrade-${_component}) 432 mark_as_advanced(CORRADE_${_COMPONENT}_EXECUTABLE) 433 434 if(CORRADE_${_COMPONENT}_EXECUTABLE) 435 set_property(TARGET Corrade::${_component} PROPERTY 436 IMPORTED_LOCATION ${CORRADE_${_COMPONENT}_EXECUTABLE}) 437 endif() 438 endif() 439 440 # No special setup for Containers library 441 442 # Interconnect library 443 if(_component STREQUAL Interconnect) 444 # Disable /OPT:ICF on MSVC, which merges functions with identical 445 # contents and thus breaks signal comparison 446 if(CORRADE_TARGET_WINDOWS AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") 447 if(CMAKE_VERSION VERSION_LESS 3.13) 448 set_property(TARGET Corrade::${_component} PROPERTY 449 INTERFACE_LINK_LIBRARIES "-OPT:NOICF,REF") 450 else() 451 set_property(TARGET Corrade::${_component} PROPERTY 452 INTERFACE_LINK_OPTIONS "/OPT:NOICF,REF") 453 endif() 454 endif() 455 456 # Main library 457 elseif(_component STREQUAL Main) 458 set(_CORRADE_${_COMPONENT}_INCLUDE_PATH_SUFFIX Corrade) 459 set(_CORRADE_${_COMPONENT}_INCLUDE_PATH_NAMES Corrade.h) 460 461 if(CORRADE_TARGET_WINDOWS) 462 if(NOT MINGW) 463 # Abusing INTERFACE_LINK_LIBRARIES because 464 # INTERFACE_LINK_OPTIONS is only since 3.13. They treat 465 # things with `-` in front as linker flags and fortunately 466 # I can use `-ENTRY` instead of `/ENTRY`. 467 # https://gitlab.kitware.com/cmake/cmake/issues/16543 468 set_property(TARGET Corrade::${_component} APPEND PROPERTY 469 INTERFACE_LINK_LIBRARIES "-ENTRY:$<$<NOT:$<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>>:wmainCRTStartup>$<$<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>:wWinMainCRTStartup>") 470 else() 471 set_property(TARGET Corrade::${_component} APPEND PROPERTY 472 INTERFACE_LINK_LIBRARIES "-municode") 473 endif() 474 endif() 475 476 # PluginManager library 477 elseif(_component STREQUAL PluginManager) 478 # At least static build needs this 479 if(CORRADE_TARGET_UNIX) 480 set_property(TARGET Corrade::${_component} APPEND PROPERTY 481 INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}) 482 endif() 483 484 # TestSuite library has some additional files 485 elseif(_component STREQUAL TestSuite) 486 # XCTest runner file 487 if(CORRADE_TESTSUITE_TARGET_XCTEST) 488 find_file(CORRADE_TESTSUITE_XCTEST_RUNNER XCTestRunner.mm.in 489 PATH_SUFFIXES share/corrade/TestSuite) 490 set(CORRADE_TESTSUITE_XCTEST_RUNNER_NEEDED CORRADE_TESTSUITE_XCTEST_RUNNER) 491 492 # ADB runner file 493 elseif(CORRADE_TARGET_ANDROID) 494 find_file(CORRADE_TESTSUITE_ADB_RUNNER AdbRunner.sh 495 PATH_SUFFIXES share/corrade/TestSuite) 496 set(CORRADE_TESTSUITE_ADB_RUNNER_NEEDED CORRADE_TESTSUITE_ADB_RUNNER) 497 498 # Emscripten runner file 499 elseif(CORRADE_TARGET_EMSCRIPTEN) 500 find_file(CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER EmscriptenRunner.html.in 501 PATH_SUFFIXES share/corrade/TestSuite) 502 set(CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER_NEEDED CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER) 503 endif() 504 505 # Utility library (contains all setup that is used by others) 506 elseif(_component STREQUAL Utility) 507 # Top-level include directory 508 set_property(TARGET Corrade::${_component} APPEND PROPERTY 509 INTERFACE_INCLUDE_DIRECTORIES ${CORRADE_INCLUDE_DIR}) 510 511 # Require (at least) C++11 for users 512 set_property(TARGET Corrade::${_component} PROPERTY 513 INTERFACE_CORRADE_CXX_STANDARD 11) 514 set_property(TARGET Corrade::${_component} APPEND PROPERTY 515 COMPATIBLE_INTERFACE_NUMBER_MAX CORRADE_CXX_STANDARD) 516 517 # AndroidLogStreamBuffer class needs to be linked to log library 518 if(CORRADE_TARGET_ANDROID) 519 set_property(TARGET Corrade::${_component} APPEND PROPERTY 520 INTERFACE_LINK_LIBRARIES "log") 521 endif() 522 endif() 523 524 # Find library includes 525 if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS}) 526 find_path(_CORRADE_${_COMPONENT}_INCLUDE_DIR 527 NAMES ${_CORRADE_${_COMPONENT}_INCLUDE_PATH_NAMES} 528 HINTS ${CORRADE_INCLUDE_DIR}/${_CORRADE_${_COMPONENT}_INCLUDE_PATH_SUFFIX}) 529 mark_as_advanced(_CORRADE_${_COMPONENT}_INCLUDE_DIR) 530 endif() 531 532 # Add inter-library dependencies 533 if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS} OR _component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}) 534 foreach(_dependency ${_CORRADE_${_COMPONENT}_DEPENDENCIES}) 535 if(_dependency MATCHES ${_CORRADE_LIBRARY_COMPONENTS} OR _dependency MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}) 536 set_property(TARGET Corrade::${_component} APPEND PROPERTY 537 INTERFACE_LINK_LIBRARIES Corrade::${_dependency}) 538 endif() 539 endforeach() 540 endif() 541 542 # Decide if the component was found 543 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)) 544 set(Corrade_${_component}_FOUND TRUE) 545 else() 546 set(Corrade_${_component}_FOUND FALSE) 547 endif() 548 endif() 549endforeach() 550 551include(FindPackageHandleStandardArgs) 552find_package_handle_standard_args(Corrade REQUIRED_VARS 553 CORRADE_INCLUDE_DIR 554 _CORRADE_MODULE_DIR 555 _CORRADE_CONFIGURE_FILE 556 ${CORRADE_TESTSUITE_XCTEST_RUNNER_NEEDED} 557 ${CORRADE_TESTSUITE_ADB_RUNNER_NEEDED} 558 ${CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER_NEEDED} 559 HANDLE_COMPONENTS) 560 561# Finalize the finding process 562include(${CORRADE_USE_MODULE}) 563 564# Installation dirs 565set(CORRADE_INCLUDE_INSTALL_PREFIX "." 566 CACHE STRING "Prefix where to put platform-independent include and other files") 567 568set(CORRADE_INCLUDE_INSTALL_DIR ${CORRADE_INCLUDE_INSTALL_PREFIX}/include/Corrade) 569