Skip to content

Commit

Permalink
modules: updated FindCorrade.cmake and FindMagnum.cmake.
Browse files Browse the repository at this point in the history
  • Loading branch information
mosra committed Jan 29, 2019
1 parent 13fdf69 commit a93e6dc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 73 deletions.
48 changes: 11 additions & 37 deletions modules/FindCorrade.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
#
# Features of found Corrade library are exposed in these variables:
#
# CORRADE_GCC47_COMPATIBILITY - Defined if compiled with compatibility mode
# for GCC 4.7
# CORRADE_MSVC2017_COMPATIBILITY - Defined if compiled with compatibility
# mode for MSVC 2017
# CORRADE_MSVC2015_COMPATIBILITY - Defined if compiled with compatibility
Expand Down Expand Up @@ -94,6 +92,7 @@
# CORRADE_INCLUDE_DIR - Root include dir
# CORRADE_*_LIBRARY_DEBUG - Debug version of given library, if found
# CORRADE_*_LIBRARY_RELEASE - Release version of given library, if found
# CORRADE_*_EXECUTABLE - Location of given executable, if found
# CORRADE_USE_MODULE - Path to UseCorrade.cmake module (included
# automatically)
# CORRADE_TESTSUITE_XCTEST_RUNNER - Path to XCTestRunner.mm.in file
Expand All @@ -108,8 +107,6 @@
# following variables are included just for backwards compatibility and only if
# :variable:`CORRADE_BUILD_DEPRECATED` is enabled:
#
# CORRADE_*_LIBRARIES - Expands to ``Corrade::*`` target. Use
# ``Corrade::*`` target directly instead.
# CORRADE_CXX_FLAGS - Pedantic compile flags. Use
# :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS` property or
# :variable:`CORRADE_PEDANTIC_COMPILER_DEFINITIONS` /
Expand Down Expand Up @@ -242,7 +239,7 @@
# This file is part of Corrade.
#
# Copyright © 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
# 2017, 2018 Vladimír Vondruš <[email protected]>
# 2017, 2018, 2019 Vladimír Vondruš <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -285,7 +282,6 @@ endif()
# Read flags from configuration
file(READ ${_CORRADE_CONFIGURE_FILE} _corradeConfigure)
set(_corradeFlags
GCC47_COMPATIBILITY
MSVC2015_COMPATIBILITY
MSVC2017_COMPATIBILITY
BUILD_DEPRECATED
Expand Down Expand Up @@ -391,8 +387,8 @@ foreach(_component ${Corrade_FIND_COMPONENTS})
endif()
endif()

# Header-only library components (CMake >= 3.0)
if(_component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS} AND NOT CMAKE_VERSION VERSION_LESS 3.0.0)
# Header-only library components
if(_component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS})
add_library(Corrade::${_component} INTERFACE IMPORTED)
endif()

Expand Down Expand Up @@ -448,26 +444,10 @@ foreach(_component ${Corrade_FIND_COMPONENTS})
INTERFACE_INCLUDE_DIRECTORIES ${CORRADE_INCLUDE_DIR})

# Require (at least) C++11 for users
if(NOT CMAKE_VERSION VERSION_LESS 3.0.0)
set_property(TARGET Corrade::${_component} PROPERTY
INTERFACE_CORRADE_CXX_STANDARD 11)
set_property(TARGET Corrade::${_component} APPEND PROPERTY
COMPATIBLE_INTERFACE_NUMBER_MAX CORRADE_CXX_STANDARD)
else()
# 2.8.12 is fucking buggy shit. Besides the fact that it
# doesn't know COMPATIBLE_INTERFACE_NUMBER_MAX, if I
# define_property() so I can inherit it from directory on a
# target, then I can't use it in COMPATIBLE_INTERFACE_STRING
# to inherit it from interfaces BECAUSE!! it thinks that it is
# not an user-defined property anymore. So I need to have two
# sets of properties, CORRADE_CXX_STANDARD_ used silently for
# inheritance from interfaces and CORRADE_CXX_STANDARD used
# publicly for inheritance from directories. AAAAAAAAARGH.
set_property(TARGET Corrade::${_component} PROPERTY
INTERFACE_CORRADE_CXX_STANDARD_ 11)
set_property(TARGET Corrade::${_component} APPEND PROPERTY
COMPATIBLE_INTERFACE_STRING CORRADE_CXX_STANDARD_)
endif()
set_property(TARGET Corrade::${_component} PROPERTY
INTERFACE_CORRADE_CXX_STANDARD 11)
set_property(TARGET Corrade::${_component} APPEND PROPERTY
COMPATIBLE_INTERFACE_NUMBER_MAX CORRADE_CXX_STANDARD)

# AndroidLogStreamBuffer class needs to be linked to log library
if(CORRADE_TARGET_ANDROID)
Expand All @@ -484,11 +464,10 @@ foreach(_component ${Corrade_FIND_COMPONENTS})
mark_as_advanced(_CORRADE_${_COMPONENT}_INCLUDE_DIR)
endif()

# Add inter-library dependencies (except for the header-only libraries
# on 2.8.12)
if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS} AND (NOT CMAKE_VERSION VERSION_LESS 3.0.0 OR NOT _component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}))
# Add inter-library dependencies
if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS} OR _component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS})
foreach(_dependency ${_CORRADE_${_COMPONENT}_DEPENDENCIES})
if(_dependency MATCHES ${_CORRADE_LIBRARY_COMPONENTS} AND (NOT CMAKE_VERSION VERSION_LESS 3.0.0 OR NOT _dependency MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}))
if(_dependency MATCHES ${_CORRADE_LIBRARY_COMPONENTS} OR _dependency MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS})
set_property(TARGET Corrade::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Corrade::${_dependency})
endif()
Expand All @@ -502,11 +481,6 @@ foreach(_component ${Corrade_FIND_COMPONENTS})
set(Corrade_${_component}_FOUND FALSE)
endif()
endif()

# Deprecated variables
if(CORRADE_BUILD_DEPRECATED AND _component MATCHES ${_CORRADE_LIBRARY_COMPONENTS} AND NOT _component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS})
set(CORRADE_${_COMPONENT}_LIBRARIES Corrade::${_component})
endif()
endforeach()

include(FindPackageHandleStandardArgs)
Expand Down
40 changes: 4 additions & 36 deletions modules/FindMagnum.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -178,26 +178,11 @@
# MAGNUM_INCLUDE_INSTALL_DIR - Header installation directory
# MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR - Plugin header installation directory
#
# Workflows without imported targets are deprecated and the following variables
# are included just for backwards compatibility and only if
# :variable:`MAGNUM_BUILD_DEPRECATED` is enabled:
#
# MAGNUM_LIBRARIES - Expands to ``Magnum::Magnum`` target. Use
# ``Magnum::Magnum`` target directly instead.
# MAGNUM_*_LIBRARIES - Expands to ``Magnum::*`` target. Use
# ``Magnum::*`` target directly instead.
# MAGNUM_APPLICATION_LIBRARIES / MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES
# - Expands to ``Magnum::Application`` /
# ``Magnum::WindowlessApplication`` target. Use ``Magnum::Application`` /
# ``Magnum::WindowlessApplication`` target directly instead.
# MAGNUM_CONTEXT_LIBRARIES - Expands to ``Magnum::Context`` target. Use
# ``Magnum::Context`` target directly instead.
#

#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019
# Vladimír Vondruš <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a
Expand Down Expand Up @@ -904,10 +889,9 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
mark_as_advanced(_MAGNUM_${_COMPONENT}_INCLUDE_DIR)
endif()

# Automatic import of static plugins on CMake >= 3.1. Skip in case the
# include dir was not found -- that'll fail later with a proper
# message.
if(_component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS} AND NOT CMAKE_VERSION VERSION_LESS 3.1 AND _MAGNUM_${_COMPONENT}_INCLUDE_DIR)
# Automatic import of static plugins. Skip in case the include dir was
# not found -- that'll fail later with a proper message.
if(_component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS} AND _MAGNUM_${_COMPONENT}_INCLUDE_DIR)
# Automatic import of static plugins
file(READ ${_MAGNUM_${_COMPONENT}_INCLUDE_DIR}/configure.h _magnum${_component}Configure)
string(FIND "${_magnum${_component}Configure}" "#define MAGNUM_${_COMPONENT}_BUILD_STATIC" _magnum${_component}_BUILD_STATIC)
Expand Down Expand Up @@ -967,11 +951,6 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
unset(_MAGNUM_GLCONTEXT_ALIAS)
endif()
endif()

# Deprecated variables
if(MAGNUM_BUILD_DEPRECATED AND _component MATCHES ${_MAGNUM_LIBRARY_COMPONENTS} OR _component MATCHES ${_MAGNUM_PLUGIN_COMPONENTS})
set(MAGNUM_${_COMPONENT}_LIBRARIES Magnum::${_component})
endif()
endforeach()

# Emscripten-specific files
Expand Down Expand Up @@ -1035,9 +1014,6 @@ if(_MAGNUM_WINDOWLESSAPPLICATION_ALIAS AND NOT TARGET Magnum::WindowlessApplicat
IMPORTED_LOCATION_DEBUG ${_MAGNUM_WINDOWLESSAPPLICATION_IMPORTED_LOCATION_DEBUG})
endif()
endif()
if(MAGNUM_BUILD_DEPRECATED)
set(MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES Magnum::WindowlessApplication)
endif()
# Prevent creating the alias again
unset(_MAGNUM_WINDOWLESSAPPLICATION_ALIAS)
endif()
Expand Down Expand Up @@ -1065,9 +1041,6 @@ if(_MAGNUM_APPLICATION_ALIAS AND NOT TARGET Magnum::Application)
IMPORTED_LOCATION_DEBUG ${_MAGNUM_APPLICATION_IMPORTED_LOCATION_DEBUG})
endif()
endif()
if(MAGNUM_BUILD_DEPRECATED)
set(MAGNUM_APPLICATION_LIBRARIES Magnum::Application)
endif()
# Prevent creating the alias again
unset(_MAGNUM_APPLICATION_ALIAS)
endif()
Expand Down Expand Up @@ -1162,8 +1135,3 @@ set(MAGNUM_PLUGINS_IMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DIR ${MAGNUM_PLUGINS_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/audioimporters)

# Deprecated variables
if(MAGNUM_BUILD_DEPRECATED)
set(MAGNUM_LIBRARIES Magnum::Magnum)
endif()

0 comments on commit a93e6dc

Please sign in to comment.